r_cstore.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_CSTORE_H__
00024 #define __BARRY_RECORD_CSTORE_H__
00025
00026 #include "dll.h"
00027 #include "record.h"
00028 #include <iosfwd>
00029 #include <string>
00030 #include <vector>
00031 #include <map>
00032 #include <stdint.h>
00033
00034 namespace Barry {
00035
00036
00037 class IConverter;
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052 class BXEXPORT ContentStore
00053 {
00054 public:
00055 typedef Barry::UnknownsType UnknownsType;
00056
00057
00058
00059
00060
00061
00062 uint8_t RecType;
00063 uint32_t RecordId;
00064
00065 std::string Filename;
00066 bool FolderFlag;
00067 std::string FileContent;
00068 std::string FileDescriptor;
00069
00070 UnknownsType Unknowns;
00071
00072 private:
00073 uint64_t FileSize;
00074
00075 public:
00076 const unsigned char* ParseField(const unsigned char *begin,
00077 const unsigned char *end, const IConverter *ic = 0);
00078
00079 public:
00080 ContentStore();
00081 ~ContentStore();
00082
00083
00084 void Clear();
00085 void Dump(std::ostream &os) const;
00086 std::string GetDescription() const;
00087
00088
00089
00090 bool operator<(const ContentStore &other) const;
00091
00092
00093 uint8_t GetRecType() const { return RecType; }
00094 uint32_t GetUniqueId() const { return RecordId; }
00095 void SetIds(uint8_t Type, uint32_t Id) { RecType = Type; RecordId = Id; }
00096 void ParseHeader(const Data &data, size_t &offset);
00097 void ParseFields(const Data &data, size_t &offset, const IConverter *ic = 0);
00098 void BuildHeader(Data &data, size_t &offset) const;
00099 void BuildFields(Data &data, size_t &offset, const IConverter *ic = 0) const;
00100 static const char * GetDBName() { return "Content Store"; }
00101 static uint8_t GetDefaultRecType() { return 0; }
00102 };
00103
00104 BXEXPORT inline std::ostream& operator<< (std::ostream &os,
00105 const ContentStore &cstore)
00106 {
00107 cstore.Dump(os);
00108 return os;
00109 }
00110
00111
00112
00113 }
00114
00115 #endif
00116