00001 #ifndef _WINC_FORETIME
00002 #define _WINC_FORETIME
00003
00004 #include <WXP/Const.h>
00005 #include <WXP/DateVal.h>
00006 #include <WXP/String.h>
00007
00008 namespace WXP {
00009 class ForeTime {
00010 int type;
00011 int unit;
00012 float tim1, tim2;
00013 DateVal end;
00014
00015 public:
00016 ForeTime();
00017 ForeTime( int t, int t1, int t2 );
00018 ForeTime( int t );
00019 ForeTime( const char *str );
00020 int init();
00021 inline bool isSet(){ return type != NONE; };
00022 int decode( const char *str );
00023 int toString( String &str );
00024 float getFore();
00025 float getHour();
00026 int getSecs();
00027 int toTimeLabelDay( String &str );
00028 int toTimeLabel( String &str );
00029 int toVarLabel( String &str );
00030 int set( int t, float t1, float t2 );
00031 int set( int t, int u, float t1, float t2 );
00032 int set( int val );
00033 int set( const char *str );
00034 int setEnd( DateVal &dv );
00035 inline int getType(){ return type; };
00036 inline float getTim1(){ return tim1; };
00037 inline float getTim2(){ return tim2; };
00038 inline DateVal getEnd(){ return end; };
00039 inline bool validEnd(){ return end.year != Const::MISS; };
00040 inline bool valid(){ return tim1 != Const::MISS; };
00041 int toCode();
00042 int print();
00043
00044
00045
00046 static const int NONE = -9999;
00047 static const int FORE = 0;
00048 static const int ANAL = 1;
00049 static const int RNG = 2;
00050 static const int AVG = 3;
00051 static const int ACC = 4;
00052 static const int DIFF = 5;
00053 static const int MAX = 6;
00054 static const int MIN = 7;
00055
00056
00057
00058 static const int MINUTE = 0;
00059 static const int HOUR = 1;
00060 static const int DAY = 2;
00061 static const int MONTH = 3;
00062 static const int YEAR = 4;
00063 };
00064 }
00065 #endif