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_SERVICEBOOK_H__
00024 #define __BARRY_RECORD_SERVICEBOOK_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
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047 class BXEXPORT ServiceBookConfig
00048 {
00049 public:
00050 typedef std::vector<UnknownField> UnknownsType;
00051
00052 uint8_t Format;
00053
00054 UnknownsType Unknowns;
00055
00056 public:
00057 const unsigned char* ParseField(const unsigned char *begin,
00058 const unsigned char *end);
00059
00060 public:
00061 ServiceBookConfig();
00062 ~ServiceBookConfig();
00063
00064
00065 void ParseHeader(const Data &data, size_t &offset);
00066 void ParseFields(const Data &data, size_t &offset);
00067 void BuildHeader(Data &data, size_t &offset) const;
00068 void BuildFields(Data &data, size_t &offset) const;
00069
00070 void Clear();
00071
00072 void Dump(std::ostream &os) const;
00073 };
00074
00075 BXEXPORT inline std::ostream& operator<<(std::ostream &os, const ServiceBookConfig &msg) {
00076 msg.Dump(os);
00077 return os;
00078 }
00079
00080
00081 class BXEXPORT ServiceBook
00082 {
00083 int NameType, DescType, UniqueIdType;
00084
00085 public:
00086 typedef std::vector<UnknownField> UnknownsType;
00087
00088 uint8_t RecType;
00089 uint32_t RecordId;
00090 std::string Name;
00091 std::string HiddenName;
00092 std::string Description;
00093 std::string DSID;
00094 std::string BesDomain;
00095 std::string UniqueId;
00096 std::string ContentId;
00097 ServiceBookConfig Config;
00098
00099 UnknownsType Unknowns;
00100
00101 public:
00102 const unsigned char* ParseField(const unsigned char *begin,
00103 const unsigned char *end);
00104
00105 public:
00106 ServiceBook();
00107 ~ServiceBook();
00108
00109
00110 uint8_t GetRecType() const { return RecType; }
00111 uint32_t GetUniqueId() const { return RecordId; }
00112 void SetIds(uint8_t Type, uint32_t Id) { RecType = Type; RecordId = Id; }
00113 void ParseHeader(const Data &data, size_t &offset);
00114 void ParseFields(const Data &data, size_t &offset);
00115 void BuildHeader(Data &data, size_t &offset) const;
00116 void BuildFields(Data &data, size_t &offset) const;
00117
00118 void Clear();
00119
00120 void Dump(std::ostream &os) const;
00121
00122
00123 bool operator<(const ServiceBook &other) const { return RecordId < RecordId; }
00124
00125
00126 static const char * GetDBName() { return "Service Book"; }
00127 static uint8_t GetDefaultRecType() { return 0; }
00128 };
00129
00130 BXEXPORT inline std::ostream& operator<<(std::ostream &os, const ServiceBook &msg) {
00131 msg.Dump(os);
00132 return os;
00133 }
00134
00135
00136
00137 }
00138
00139 #endif
00140