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_MEMO_H__
00024 #define __BARRY_RECORD_MEMO_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 class BXEXPORT Memo
00035 {
00036 public:
00037 typedef std::vector<UnknownField> UnknownsType;
00038
00039 uint8_t RecType;
00040 uint32_t RecordId;
00041
00042 uint8_t MemoType;
00043 std::string Title;
00044 std::string Body;
00045 std::string Category;
00046
00047 UnknownsType Unknowns;
00048
00049 public:
00050 const unsigned char* ParseField(const unsigned char *begin,
00051 const unsigned char *end);
00052
00053 public:
00054 Memo();
00055 ~Memo();
00056
00057
00058 uint8_t GetRecType() const { return RecType; }
00059 uint32_t GetUniqueId() const { return RecordId; }
00060 void SetIds(uint8_t Type, uint32_t Id) { RecType = Type; RecordId = Id; }
00061 void ParseHeader(const Data &data, size_t &offset);
00062 void ParseFields(const Data &data, size_t &offset);
00063 void BuildHeader(Data &data, size_t &offset) const;
00064
00065 void Clear();
00066
00067 void Dump(std::ostream &os) const;
00068
00069 bool operator<(const Memo &other) const { return Title < other.Title; }
00070
00071 static const char * GetDBName() { return "Memos"; }
00072 static uint8_t GetDefaultRecType() { return 0; }
00073 };
00074
00075 BXEXPORT inline std::ostream& operator<<(std::ostream &os, const Memo &msg) {
00076 msg.Dump(os);
00077 return os;
00078 }
00079
00080 }
00081
00082 #endif
00083