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