00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef _OASYS_STRING_SERIALIZE_H_
00018 #define _OASYS_STRING_SERIALIZE_H_
00019
00020 #include "Serialize.h"
00021 #include "../util/StringBuffer.h"
00022
00023 namespace oasys {
00024
00029 class StringSerialize : public SerializeAction {
00030 public:
00032 enum {
00033 INCLUDE_NAME = 1 << 0,
00034 INCLUDE_TYPE = 1 << 1,
00035 SCHEMA_ONLY = 1 << 2,
00036 DOT_SEPARATED = 1 << 3,
00037 };
00038
00042 StringSerialize(context_t context, int options);
00043
00047 int action(const SerializableObject* const_object)
00048 {
00049 SerializableObject* object = (SerializableObject*)const_object;
00050 return SerializeAction::action(object);
00051 }
00052
00053 void process(const char* name, SerializableObject* const_object)
00054 {
00055 SerializableObject* object = (SerializableObject*)const_object;
00056 return SerializeAction::process(name, object);
00057 }
00058
00062 const StringBuffer& buf() { return buf_; }
00063
00066 void end_action();
00067 void process(const char* name, u_int64_t* i);
00068 void process(const char* name, u_int32_t* i);
00069 void process(const char* name, u_int16_t* i);
00070 void process(const char* name, u_int8_t* i);
00071 void process(const char* name, bool* b);
00072 void process(const char* name, u_char* bp, u_int32_t len);
00073 void process(const char* name, u_char** bp, u_int32_t* lenp, int flags);
00074 void process(const char* name, std::string* s);
00076
00077 private:
00078 void add_preamble(const char* name, const char* type);
00079
00080 StringBuffer buf_;
00081 char sep_;
00082 };
00083
00084 }
00085
00086 #endif