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