123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- #ifndef __INTEGERFIELD_H
- #define __INTEGERFIELD_H
- #include <foundation/types.h>
- class TimeParse {
- public:
- int is_relative;
- int absolute_datetime;
- int absolute_hasdate;
- int absolute_hastime;
- int relative_year;
- int relative_month;
- int relative_day;
- int relative_hour;
- int relative_min;
- int relative_sec;
- int relative_kwday;
- int offset_value;
- int offset_what;
- int offset_whence;
- int offset_used;
- };
- class IntegerField : public Field
- {
- protected:
- virtual void ReadTypedData(const uint8_t *, size_t len);
- virtual void WriteTypedData(uint8_t *, size_t len);
- virtual size_t GetDataSize(void);
- virtual int Compare(Field *Entry);
- virtual bool ApplyFilter(Field *Data, int op);
- void InitField(void);
- int Value;
- enum {
- WHAT_YEARS,
- WHAT_MONTHS,
- WHAT_WEEKS,
- WHAT_DAYS,
- WHAT_HOURS,
- WHAT_MINUTES,
- WHAT_SECONDS,
- };
- enum {
- FROM_BARE,
- FROM_AGO,
- FROM_SINCE,
- };
- public:
- ~IntegerField();
- IntegerField(int);
- IntegerField();
- int GetValue(void);
- void SetValue(int);
- int ApplyConversion(const char *format, TimeParse *tp=NULL);
- static int LookupToken(const char *t);
- };
- class DateTimeField : public IntegerField {
- public:
- DateTimeField();
- DateTimeField(int Val);
- virtual ~DateTimeField();
- };
- class LengthField : public IntegerField {
- public:
- LengthField();
- LengthField(int Val);
- virtual ~LengthField();
- };
- #endif
|