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_FOLDER_H__
00024 #define __BARRY_RECORD_FOLDER_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 Folder
00035 {
00036 public:
00037 typedef std::vector<UnknownField> UnknownsType;
00038 uint8_t RecType;
00039 uint32_t RecordId;
00040
00041 std::string FolderName;
00042 uint16_t FolderNumber;
00043 uint16_t FolderLevel;
00044
00045 enum FolderTypeEnum {
00046 FolderSubtree = 0,
00047 FolderDeleted,
00048 FolderInbox,
00049 FolderOutbox,
00050 FolderSent,
00051 FolderOther,
00052 FolderDraft = 0x0a
00053 };
00054 FolderTypeEnum FolderType;
00055
00056 enum FolderStatusType {
00057 FolderOrphan = 0x50,
00058 FolderUnfiled,
00059 FolderFiled
00060 };
00061
00062 UnknownsType Unknowns;
00063
00064 public:
00065 Folder();
00066 ~Folder();
00067
00068 const unsigned char* ParseField(const unsigned char *begin,
00069 const unsigned char *end);
00070 uint8_t GetRecType() const { return RecType; }
00071 uint32_t GetUniqueId() const { return RecordId; }
00072 void SetIds(uint8_t Type, uint32_t Id) { RecType = Type; RecordId = Id; }
00073 void ParseHeader(const Data &data, size_t &offset);
00074 void ParseFields(const Data &data, size_t &offset);
00075 void BuildHeader(Data &data, size_t &offset) const;
00076
00077 void Clear();
00078
00079 void Dump(std::ostream &os) const;
00080 bool operator<(const Folder &other) const { return FolderName < other.FolderName; }
00081
00082
00083 static const char * GetDBName() { return "Folders"; }
00084 static uint8_t GetDefaultRecType() { return 0; }
00085
00086 };
00087
00088 BXEXPORT inline std::ostream& operator<<(std::ostream &os, const Folder &msg) {
00089 msg.Dump(os);
00090 return os;
00091 }
00092
00093 }
00094
00095 #endif // __BARRY_RECORD_FOLDER_H__
00096
00097