diff options
Diffstat (limited to 'linden/indra/llmessage/llsdmessagebuilder.cpp')
-rwxr-xr-x | linden/indra/llmessage/llsdmessagebuilder.cpp | 80 |
1 files changed, 54 insertions, 26 deletions
diff --git a/linden/indra/llmessage/llsdmessagebuilder.cpp b/linden/indra/llmessage/llsdmessagebuilder.cpp index b7deb48..d3dcd5b 100755 --- a/linden/indra/llmessage/llsdmessagebuilder.cpp +++ b/linden/indra/llmessage/llsdmessagebuilder.cpp | |||
@@ -1,3 +1,31 @@ | |||
1 | /** | ||
2 | * @file llsdmessagebuilder.cpp | ||
3 | * @brief LLSDMessageBuilder class implementation. | ||
4 | * | ||
5 | * Copyright (c) 2007-2007, Linden Research, Inc. | ||
6 | * | ||
7 | * Second Life Viewer Source Code | ||
8 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
9 | * to you under the terms of the GNU General Public License, version 2.0 | ||
10 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
11 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
12 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
13 | * online at http://secondlife.com/developers/opensource/gplv2 | ||
14 | * | ||
15 | * There are special exceptions to the terms and conditions of the GPL as | ||
16 | * it is applied to this Source Code. View the full text of the exception | ||
17 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
18 | * online at http://secondlife.com/developers/opensource/flossexception | ||
19 | * | ||
20 | * By copying, modifying or distributing this software, you acknowledge | ||
21 | * that you have read and understood your obligations described above, | ||
22 | * and agree to abide by those obligations. | ||
23 | * | ||
24 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
25 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
26 | * COMPLETENESS OR PERFORMANCE. | ||
27 | */ | ||
28 | |||
1 | #include "linden_common.h" | 29 | #include "linden_common.h" |
2 | 30 | ||
3 | #include "llsdmessagebuilder.h" | 31 | #include "llsdmessagebuilder.h" |
@@ -28,13 +56,13 @@ LLSDMessageBuilder::~LLSDMessageBuilder() | |||
28 | 56 | ||
29 | 57 | ||
30 | // virtual | 58 | // virtual |
31 | void LLSDMessageBuilder::newMessage(const char *name) | 59 | void LLSDMessageBuilder::newMessage(const char* name) |
32 | { | 60 | { |
33 | mbSBuilt = FALSE; | 61 | mbSBuilt = FALSE; |
34 | mbSClear = FALSE; | 62 | mbSClear = FALSE; |
35 | 63 | ||
36 | mCurrentMessage = LLSD::emptyMap(); | 64 | mCurrentMessage = LLSD::emptyMap(); |
37 | mCurrentMessageName = (char *)name; | 65 | mCurrentMessageName = (char*)name; |
38 | } | 66 | } |
39 | 67 | ||
40 | // virtual | 68 | // virtual |
@@ -74,8 +102,10 @@ BOOL LLSDMessageBuilder::removeLastBlock() | |||
74 | return FALSE; | 102 | return FALSE; |
75 | } | 103 | } |
76 | 104 | ||
77 | void LLSDMessageBuilder::addBinaryData(const char *varname, | 105 | void LLSDMessageBuilder::addBinaryData( |
78 | const void *data, S32 size) | 106 | const char* varname, |
107 | const void* data, | ||
108 | S32 size) | ||
79 | { | 109 | { |
80 | std::vector<U8> v; | 110 | std::vector<U8> v; |
81 | v.resize(size); | 111 | v.resize(size); |
@@ -83,57 +113,57 @@ void LLSDMessageBuilder::addBinaryData(const char *varname, | |||
83 | (*mCurrentBlock)[varname] = v; | 113 | (*mCurrentBlock)[varname] = v; |
84 | } | 114 | } |
85 | 115 | ||
86 | void LLSDMessageBuilder::addS8(const char *varname, S8 v) | 116 | void LLSDMessageBuilder::addS8(const char* varname, S8 v) |
87 | { | 117 | { |
88 | (*mCurrentBlock)[varname] = v; | 118 | (*mCurrentBlock)[varname] = v; |
89 | } | 119 | } |
90 | 120 | ||
91 | void LLSDMessageBuilder::addU8(const char *varname, U8 v) | 121 | void LLSDMessageBuilder::addU8(const char* varname, U8 v) |
92 | { | 122 | { |
93 | (*mCurrentBlock)[varname] = v; | 123 | (*mCurrentBlock)[varname] = v; |
94 | } | 124 | } |
95 | 125 | ||
96 | void LLSDMessageBuilder::addS16(const char *varname, S16 v) | 126 | void LLSDMessageBuilder::addS16(const char* varname, S16 v) |
97 | { | 127 | { |
98 | (*mCurrentBlock)[varname] = v; | 128 | (*mCurrentBlock)[varname] = v; |
99 | } | 129 | } |
100 | 130 | ||
101 | void LLSDMessageBuilder::addU16(const char *varname, U16 v) | 131 | void LLSDMessageBuilder::addU16(const char* varname, U16 v) |
102 | { | 132 | { |
103 | (*mCurrentBlock)[varname] = v; | 133 | (*mCurrentBlock)[varname] = v; |
104 | } | 134 | } |
105 | 135 | ||
106 | void LLSDMessageBuilder::addF32(const char *varname, F32 v) | 136 | void LLSDMessageBuilder::addF32(const char* varname, F32 v) |
107 | { | 137 | { |
108 | (*mCurrentBlock)[varname] = v; | 138 | (*mCurrentBlock)[varname] = v; |
109 | } | 139 | } |
110 | 140 | ||
111 | void LLSDMessageBuilder::addS32(const char *varname, S32 v) | 141 | void LLSDMessageBuilder::addS32(const char* varname, S32 v) |
112 | { | 142 | { |
113 | (*mCurrentBlock)[varname] = v; | 143 | (*mCurrentBlock)[varname] = v; |
114 | } | 144 | } |
115 | 145 | ||
116 | void LLSDMessageBuilder::addU32(const char *varname, U32 v) | 146 | void LLSDMessageBuilder::addU32(const char* varname, U32 v) |
117 | { | 147 | { |
118 | (*mCurrentBlock)[varname] = ll_sd_from_U32(v); | 148 | (*mCurrentBlock)[varname] = ll_sd_from_U32(v); |
119 | } | 149 | } |
120 | 150 | ||
121 | void LLSDMessageBuilder::addU64(const char *varname, U64 v) | 151 | void LLSDMessageBuilder::addU64(const char* varname, U64 v) |
122 | { | 152 | { |
123 | (*mCurrentBlock)[varname] = ll_sd_from_U64(v); | 153 | (*mCurrentBlock)[varname] = ll_sd_from_U64(v); |
124 | } | 154 | } |
125 | 155 | ||
126 | void LLSDMessageBuilder::addF64(const char *varname, F64 v) | 156 | void LLSDMessageBuilder::addF64(const char* varname, F64 v) |
127 | { | 157 | { |
128 | (*mCurrentBlock)[varname] = v; | 158 | (*mCurrentBlock)[varname] = v; |
129 | } | 159 | } |
130 | 160 | ||
131 | void LLSDMessageBuilder::addIPAddr(const char *varname, U32 v) | 161 | void LLSDMessageBuilder::addIPAddr(const char* varname, U32 v) |
132 | { | 162 | { |
133 | (*mCurrentBlock)[varname] = ll_sd_from_ipaddr(v); | 163 | (*mCurrentBlock)[varname] = ll_sd_from_ipaddr(v); |
134 | } | 164 | } |
135 | 165 | ||
136 | void LLSDMessageBuilder::addIPPort(const char *varname, U16 v) | 166 | void LLSDMessageBuilder::addIPPort(const char* varname, U16 v) |
137 | { | 167 | { |
138 | (*mCurrentBlock)[varname] = v; | 168 | (*mCurrentBlock)[varname] = v; |
139 | } | 169 | } |
@@ -159,27 +189,27 @@ void LLSDMessageBuilder::addString(const char* varname, const std::string& v) | |||
159 | (*mCurrentBlock)[varname] = ""; | 189 | (*mCurrentBlock)[varname] = ""; |
160 | } | 190 | } |
161 | 191 | ||
162 | void LLSDMessageBuilder::addVector3(const char *varname, const LLVector3& v) | 192 | void LLSDMessageBuilder::addVector3(const char* varname, const LLVector3& v) |
163 | { | 193 | { |
164 | (*mCurrentBlock)[varname] = ll_sd_from_vector3(v); | 194 | (*mCurrentBlock)[varname] = ll_sd_from_vector3(v); |
165 | } | 195 | } |
166 | 196 | ||
167 | void LLSDMessageBuilder::addVector4(const char *varname, const LLVector4& v) | 197 | void LLSDMessageBuilder::addVector4(const char* varname, const LLVector4& v) |
168 | { | 198 | { |
169 | (*mCurrentBlock)[varname] = ll_sd_from_vector4(v); | 199 | (*mCurrentBlock)[varname] = ll_sd_from_vector4(v); |
170 | } | 200 | } |
171 | 201 | ||
172 | void LLSDMessageBuilder::addVector3d(const char *varname, const LLVector3d& v) | 202 | void LLSDMessageBuilder::addVector3d(const char* varname, const LLVector3d& v) |
173 | { | 203 | { |
174 | (*mCurrentBlock)[varname] = ll_sd_from_vector3d(v); | 204 | (*mCurrentBlock)[varname] = ll_sd_from_vector3d(v); |
175 | } | 205 | } |
176 | 206 | ||
177 | void LLSDMessageBuilder::addQuat(const char *varname, const LLQuaternion& v) | 207 | void LLSDMessageBuilder::addQuat(const char* varname, const LLQuaternion& v) |
178 | { | 208 | { |
179 | (*mCurrentBlock)[varname] = ll_sd_from_quaternion(v); | 209 | (*mCurrentBlock)[varname] = ll_sd_from_quaternion(v); |
180 | } | 210 | } |
181 | 211 | ||
182 | void LLSDMessageBuilder::addUUID(const char *varname, const LLUUID& v) | 212 | void LLSDMessageBuilder::addUUID(const char* varname, const LLUUID& v) |
183 | { | 213 | { |
184 | (*mCurrentBlock)[varname] = v; | 214 | (*mCurrentBlock)[varname] = v; |
185 | } | 215 | } |
@@ -193,9 +223,7 @@ BOOL LLSDMessageBuilder::isMessageFull(const char* blockname) const | |||
193 | return FALSE; | 223 | return FALSE; |
194 | } | 224 | } |
195 | 225 | ||
196 | // make sure that all the desired data is in place and then copy the data | 226 | U32 LLSDMessageBuilder::buildMessage(U8*, U32, U8) |
197 | // into MAX_BUFFER_SIZEd buffer | ||
198 | U32 LLSDMessageBuilder::buildMessage(U8* buffer, U32 buffer_size) | ||
199 | { | 227 | { |
200 | return 0; | 228 | return 0; |
201 | } | 229 | } |
@@ -205,7 +233,7 @@ void LLSDMessageBuilder::copyFromMessageData(const LLMsgData& data) | |||
205 | // copy the blocks | 233 | // copy the blocks |
206 | // counting variables used to encode multiple block info | 234 | // counting variables used to encode multiple block info |
207 | S32 block_count = 0; | 235 | S32 block_count = 0; |
208 | char *block_name = NULL; | 236 | char* block_name = NULL; |
209 | 237 | ||
210 | // loop through msg blocks to loop through variables, totalling up size | 238 | // loop through msg blocks to loop through variables, totalling up size |
211 | // data and filling the new (send) message | 239 | // data and filling the new (send) message |
@@ -222,7 +250,7 @@ void LLSDMessageBuilder::copyFromMessageData(const LLMsgData& data) | |||
222 | if (block_count == 0) | 250 | if (block_count == 0) |
223 | { | 251 | { |
224 | block_count = mbci->mBlockNumber; | 252 | block_count = mbci->mBlockNumber; |
225 | block_name = (char *)mbci->mName; | 253 | block_name = (char*)mbci->mName; |
226 | } | 254 | } |
227 | 255 | ||
228 | // counting down mutliple blocks | 256 | // counting down mutliple blocks |
@@ -248,7 +276,7 @@ void LLSDMessageBuilder::copyFromMessageData(const LLMsgData& data) | |||
248 | void LLSDMessageBuilder::copyFromLLSD(const LLSD& msg) | 276 | void LLSDMessageBuilder::copyFromLLSD(const LLSD& msg) |
249 | { | 277 | { |
250 | mCurrentMessage = msg; | 278 | mCurrentMessage = msg; |
251 | llinfos << LLSDXMLStreamer(mCurrentMessage) << llendl; | 279 | lldebugs << LLSDXMLStreamer(mCurrentMessage) << llendl; |
252 | } | 280 | } |
253 | 281 | ||
254 | const LLSD& LLSDMessageBuilder::getMessage() const | 282 | const LLSD& LLSDMessageBuilder::getMessage() const |