diff options
Diffstat (limited to 'linden/indra/llmessage/llsdmessagebuilder.h')
-rwxr-xr-x | linden/indra/llmessage/llsdmessagebuilder.h | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/linden/indra/llmessage/llsdmessagebuilder.h b/linden/indra/llmessage/llsdmessagebuilder.h new file mode 100755 index 0000000..f04194d --- /dev/null +++ b/linden/indra/llmessage/llsdmessagebuilder.h | |||
@@ -0,0 +1,98 @@ | |||
1 | #ifndef LL_LLSDMESSAGEBUILDER_H | ||
2 | #define LL_LLSDMESSAGEBUILDER_H | ||
3 | |||
4 | #include <map> | ||
5 | |||
6 | #include "llmessagebuilder.h" | ||
7 | #include "llmsgvariabletype.h" | ||
8 | #include "llsd.h" | ||
9 | |||
10 | class LLMessageTemplate; | ||
11 | class LLMsgData; | ||
12 | |||
13 | class LLSDMessageBuilder : public LLMessageBuilder | ||
14 | { | ||
15 | public: | ||
16 | |||
17 | //CLASS_LOG_TYPE(LLSDMessageBuilder); | ||
18 | |||
19 | LLSDMessageBuilder(); | ||
20 | virtual ~LLSDMessageBuilder(); | ||
21 | |||
22 | virtual void newMessage(const char *name); | ||
23 | |||
24 | virtual void nextBlock(const char* blockname); | ||
25 | virtual BOOL removeLastBlock(); // TODO: babbage: remove this horror... | ||
26 | |||
27 | /** All add* methods expect pointers to canonical varname strings. */ | ||
28 | virtual void addBinaryData(const char *varname, const void *data, | ||
29 | S32 size); | ||
30 | virtual void addBOOL(const char* varname, BOOL b); | ||
31 | virtual void addS8(const char *varname, S8 s); | ||
32 | virtual void addU8(const char *varname, U8 u); | ||
33 | virtual void addS16(const char *varname, S16 i); | ||
34 | virtual void addU16(const char *varname, U16 i); | ||
35 | virtual void addF32(const char *varname, F32 f); | ||
36 | virtual void addS32(const char *varname, S32 s); | ||
37 | virtual void addU32(const char *varname, U32 u); | ||
38 | virtual void addU64(const char *varname, U64 lu); | ||
39 | virtual void addF64(const char *varname, F64 d); | ||
40 | virtual void addVector3(const char *varname, const LLVector3& vec); | ||
41 | virtual void addVector4(const char *varname, const LLVector4& vec); | ||
42 | virtual void addVector3d(const char *varname, const LLVector3d& vec); | ||
43 | virtual void addQuat(const char *varname, const LLQuaternion& quat); | ||
44 | virtual void addUUID(const char *varname, const LLUUID& uuid); | ||
45 | virtual void addIPAddr(const char *varname, const U32 ip); | ||
46 | virtual void addIPPort(const char *varname, const U16 port); | ||
47 | virtual void addString(const char* varname, const char* s); | ||
48 | virtual void addString(const char* varname, const std::string& s); | ||
49 | |||
50 | virtual BOOL isMessageFull(const char* blockname) const; | ||
51 | virtual void compressMessage(U8*& buf_ptr, U32& buffer_length); | ||
52 | |||
53 | virtual BOOL isBuilt() const; | ||
54 | virtual BOOL isClear() const; | ||
55 | virtual U32 buildMessage(U8* buffer, U32 buffer_size); | ||
56 | /**< Return built message size */ | ||
57 | |||
58 | virtual void clearMessage(); | ||
59 | |||
60 | // TODO: babbage: remove this horror. | ||
61 | virtual void setBuilt(BOOL b); | ||
62 | |||
63 | virtual S32 getMessageSize(); | ||
64 | virtual const char* getMessageName() const; | ||
65 | |||
66 | virtual void copyFromMessageData(const LLMsgData& data); | ||
67 | |||
68 | virtual void copyFromLLSD(const LLSD& msg); | ||
69 | |||
70 | const LLSD& getMessage() const; | ||
71 | private: | ||
72 | |||
73 | /* mCurrentMessage is of the following format: | ||
74 | mCurrentMessage = { 'block_name1' : [ { 'block1_field1' : 'b1f1_data', | ||
75 | 'block1_field2' : 'b1f2_data', | ||
76 | ... | ||
77 | 'block1_fieldn' : 'b1fn_data'}, | ||
78 | { 'block2_field1' : 'b2f1_data', | ||
79 | 'block2_field2' : 'b2f2_data', | ||
80 | ... | ||
81 | 'block2_fieldn' : 'b2fn_data'}, | ||
82 | ... | ||
83 | { 'blockm_field1' : 'bmf1_data', | ||
84 | 'blockm_field2' : 'bmf2_data', | ||
85 | ... | ||
86 | 'blockm_fieldn' : 'bmfn_data'} ], | ||
87 | 'block_name2' : ..., | ||
88 | ... | ||
89 | 'block_namem' } */ | ||
90 | LLSD mCurrentMessage; | ||
91 | LLSD* mCurrentBlock; | ||
92 | std::string mCurrentMessageName; | ||
93 | std::string mCurrentBlockName; | ||
94 | BOOL mbSBuilt; | ||
95 | BOOL mbSClear; | ||
96 | }; | ||
97 | |||
98 | #endif // LL_LLSDMESSAGEBUILDER_H | ||