r_task.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef __BARRY_RECORD_TASK_H__
00024 #define __BARRY_RECORD_TASK_H__
00025
00026 #include "dll.h"
00027 #include "record.h"
00028 #include <vector>
00029 #include <string>
00030 #include <stdint.h>
00031
00032 namespace Barry {
00033
00034
00035 class IConverter;
00036
00037 class BXEXPORT Task
00038 {
00039 public:
00040 typedef std::vector<UnknownField> UnknownsType;
00041 uint8_t RecType;
00042 uint32_t RecordId;
00043
00044 uint8_t TaskType;
00045 std::string Summary;
00046 std::string Notes;
00047 std::string Categories;
00048 std::string UID;
00049
00050 time_t StartTime;
00051 time_t DueTime;
00052 time_t AlarmTime;
00053 int TimeZoneCode;
00054
00055 enum AlarmFlagType
00056 {
00057 Date = 1,
00058 Relative
00059 };
00060 AlarmFlagType AlarmType;
00061
00062 unsigned short Interval;
00063 enum RecurringCodeType {
00064 Day = 1,
00065
00066 MonthByDate = 3,
00067
00068 MonthByDay = 4,
00069
00070 YearByDate = 5,
00071
00072 YearByDay = 6,
00073
00074
00075 Week = 12
00076
00077 };
00078 RecurringCodeType RecurringType;
00079 time_t RecurringEndTime;
00080 unsigned short
00081 DayOfWeek,
00082 WeekOfMonth,
00083 DayOfMonth,
00084 MonthOfYear;
00085 unsigned char WeekDays;
00086
00087 int ClassType;
00088 enum PriorityFlagType
00089 {
00090 High = 0,
00091 Normal,
00092 Low
00093 };
00094 PriorityFlagType PriorityFlag;
00095
00096 enum StatusFlagType
00097 {
00098 NotStarted = 0,
00099 InProgress,
00100 Completed,
00101 Waiting,
00102 Deferred
00103 };
00104 StatusFlagType StatusFlag;
00105
00106 bool Recurring;
00107 bool Perpetual;
00108 bool DueDateFlag;
00109
00110 UnknownsType Unknowns;
00111
00112 public:
00113 Task();
00114 ~Task();
00115
00116 const unsigned char* ParseField(const unsigned char *begin,
00117 const unsigned char *end, const IConverter *ic = 0);
00118 void ParseRecurrenceData(const void *data);
00119 void BuildRecurrenceData(void *data);
00120 uint8_t GetRecType() const { return RecType; }
00121 uint32_t GetUniqueId() const { return RecordId; }
00122 void SetIds(uint8_t Type, uint32_t Id) { RecType = Type; RecordId = Id; }
00123 void ParseHeader(const Data &data, size_t &offset);
00124 void ParseFields(const Data &data, size_t &offset, const IConverter *ic = 0);
00125 void BuildHeader(Data &data, size_t &offset) const;
00126
00127 void Clear();
00128
00129 void Dump(std::ostream &os) const;
00130 bool operator<(const Task &other) const { return Summary < other.Summary; }
00131
00132
00133 static const char * GetDBName() { return "Tasks"; }
00134 static uint8_t GetDefaultRecType() { return 2; }
00135
00136 };
00137
00138 BXEXPORT inline std::ostream& operator<<(std::ostream &os, const Task &msg) {
00139 msg.Dump(os);
00140 return os;
00141 }
00142
00143 }
00144
00145 #endif
00146