aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llxml/llxmltree.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-09-06 18:24:57 -0500
committerJacek Antonelli2008-09-06 18:25:07 -0500
commit798d367d54a6c6379ad355bd8345fa40e31e7fe9 (patch)
tree1921f1708cd0240648c97bc02df2c2ab5f2fc41e /linden/indra/llxml/llxmltree.cpp
parentSecond Life viewer sources 1.20.15 (diff)
downloadmeta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.zip
meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.gz
meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.bz2
meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.xz
Second Life viewer sources 1.21.0-RC
Diffstat (limited to '')
-rw-r--r--linden/indra/llxml/llxmltree.cpp94
1 files changed, 48 insertions, 46 deletions
diff --git a/linden/indra/llxml/llxmltree.cpp b/linden/indra/llxml/llxmltree.cpp
index 4ac05f9..0c24d9f 100644
--- a/linden/indra/llxml/llxmltree.cpp
+++ b/linden/indra/llxml/llxmltree.cpp
@@ -90,11 +90,11 @@ void LLXmlTree::dump()
90 } 90 }
91} 91}
92 92
93void LLXmlTree::dumpNode( LLXmlTreeNode* node, const LLString& prefix ) 93void LLXmlTree::dumpNode( LLXmlTreeNode* node, const std::string& prefix )
94{ 94{
95 node->dump( prefix ); 95 node->dump( prefix );
96 96
97 LLString new_prefix = prefix + " "; 97 std::string new_prefix = prefix + " ";
98 for( LLXmlTreeNode* child = node->getFirstChild(); child; child = node->getNextChild() ) 98 for( LLXmlTreeNode* child = node->getFirstChild(); child; child = node->getNextChild() )
99 { 99 {
100 dumpNode( child, new_prefix ); 100 dumpNode( child, new_prefix );
@@ -121,7 +121,7 @@ LLXmlTreeNode::~LLXmlTreeNode()
121 delete *child_iter; 121 delete *child_iter;
122} 122}
123 123
124void LLXmlTreeNode::dump( const LLString& prefix ) 124void LLXmlTreeNode::dump( const std::string& prefix )
125{ 125{
126 llinfos << prefix << mName ; 126 llinfos << prefix << mName ;
127 if( !mContents.empty() ) 127 if( !mContents.empty() )
@@ -132,7 +132,7 @@ void LLXmlTreeNode::dump( const LLString& prefix )
132 for (iter=mAttributes.begin(); iter != mAttributes.end(); iter++) 132 for (iter=mAttributes.begin(); iter != mAttributes.end(); iter++)
133 { 133 {
134 LLStdStringHandle key = iter->first; 134 LLStdStringHandle key = iter->first;
135 const LLString* value = iter->second; 135 const std::string* value = iter->second;
136 llcont << prefix << " " << key << "=" << (value->empty() ? "NULL" : *value); 136 llcont << prefix << " " << key << "=" << (value->empty() ? "NULL" : *value);
137 } 137 }
138 llcont << llendl; 138 llcont << llendl;
@@ -148,7 +148,7 @@ BOOL LLXmlTreeNode::hasAttribute(const std::string& name)
148void LLXmlTreeNode::addAttribute(const std::string& name, const std::string& value) 148void LLXmlTreeNode::addAttribute(const std::string& name, const std::string& value)
149{ 149{
150 LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString( name ); 150 LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString( name );
151 const LLString *newstr = new LLString(value); 151 const std::string *newstr = new std::string(value);
152 mAttributes[canonical_name] = newstr; // insert + copy 152 mAttributes[canonical_name] = newstr; // insert + copy
153} 153}
154 154
@@ -204,103 +204,103 @@ void LLXmlTreeNode::addChild(LLXmlTreeNode* child)
204 204
205BOOL LLXmlTreeNode::getFastAttributeBOOL(LLStdStringHandle canonical_name, BOOL& value) 205BOOL LLXmlTreeNode::getFastAttributeBOOL(LLStdStringHandle canonical_name, BOOL& value)
206{ 206{
207 const LLString *s = getAttribute( canonical_name ); 207 const std::string *s = getAttribute( canonical_name );
208 return s && LLString::convertToBOOL( *s, value ); 208 return s && LLStringUtil::convertToBOOL( *s, value );
209} 209}
210 210
211BOOL LLXmlTreeNode::getFastAttributeU8(LLStdStringHandle canonical_name, U8& value) 211BOOL LLXmlTreeNode::getFastAttributeU8(LLStdStringHandle canonical_name, U8& value)
212{ 212{
213 const LLString *s = getAttribute( canonical_name ); 213 const std::string *s = getAttribute( canonical_name );
214 return s && LLString::convertToU8( *s, value ); 214 return s && LLStringUtil::convertToU8( *s, value );
215} 215}
216 216
217BOOL LLXmlTreeNode::getFastAttributeS8(LLStdStringHandle canonical_name, S8& value) 217BOOL LLXmlTreeNode::getFastAttributeS8(LLStdStringHandle canonical_name, S8& value)
218{ 218{
219 const LLString *s = getAttribute( canonical_name ); 219 const std::string *s = getAttribute( canonical_name );
220 return s && LLString::convertToS8( *s, value ); 220 return s && LLStringUtil::convertToS8( *s, value );
221} 221}
222 222
223BOOL LLXmlTreeNode::getFastAttributeS16(LLStdStringHandle canonical_name, S16& value) 223BOOL LLXmlTreeNode::getFastAttributeS16(LLStdStringHandle canonical_name, S16& value)
224{ 224{
225 const LLString *s = getAttribute( canonical_name ); 225 const std::string *s = getAttribute( canonical_name );
226 return s && LLString::convertToS16( *s, value ); 226 return s && LLStringUtil::convertToS16( *s, value );
227} 227}
228 228
229BOOL LLXmlTreeNode::getFastAttributeU16(LLStdStringHandle canonical_name, U16& value) 229BOOL LLXmlTreeNode::getFastAttributeU16(LLStdStringHandle canonical_name, U16& value)
230{ 230{
231 const LLString *s = getAttribute( canonical_name ); 231 const std::string *s = getAttribute( canonical_name );
232 return s && LLString::convertToU16( *s, value ); 232 return s && LLStringUtil::convertToU16( *s, value );
233} 233}
234 234
235BOOL LLXmlTreeNode::getFastAttributeU32(LLStdStringHandle canonical_name, U32& value) 235BOOL LLXmlTreeNode::getFastAttributeU32(LLStdStringHandle canonical_name, U32& value)
236{ 236{
237 const LLString *s = getAttribute( canonical_name ); 237 const std::string *s = getAttribute( canonical_name );
238 return s && LLString::convertToU32( *s, value ); 238 return s && LLStringUtil::convertToU32( *s, value );
239} 239}
240 240
241BOOL LLXmlTreeNode::getFastAttributeS32(LLStdStringHandle canonical_name, S32& value) 241BOOL LLXmlTreeNode::getFastAttributeS32(LLStdStringHandle canonical_name, S32& value)
242{ 242{
243 const LLString *s = getAttribute( canonical_name ); 243 const std::string *s = getAttribute( canonical_name );
244 return s && LLString::convertToS32( *s, value ); 244 return s && LLStringUtil::convertToS32( *s, value );
245} 245}
246 246
247BOOL LLXmlTreeNode::getFastAttributeF32(LLStdStringHandle canonical_name, F32& value) 247BOOL LLXmlTreeNode::getFastAttributeF32(LLStdStringHandle canonical_name, F32& value)
248{ 248{
249 const LLString *s = getAttribute( canonical_name ); 249 const std::string *s = getAttribute( canonical_name );
250 return s && LLString::convertToF32( *s, value ); 250 return s && LLStringUtil::convertToF32( *s, value );
251} 251}
252 252
253BOOL LLXmlTreeNode::getFastAttributeF64(LLStdStringHandle canonical_name, F64& value) 253BOOL LLXmlTreeNode::getFastAttributeF64(LLStdStringHandle canonical_name, F64& value)
254{ 254{
255 const LLString *s = getAttribute( canonical_name ); 255 const std::string *s = getAttribute( canonical_name );
256 return s && LLString::convertToF64( *s, value ); 256 return s && LLStringUtil::convertToF64( *s, value );
257} 257}
258 258
259BOOL LLXmlTreeNode::getFastAttributeColor(LLStdStringHandle canonical_name, LLColor4& value) 259BOOL LLXmlTreeNode::getFastAttributeColor(LLStdStringHandle canonical_name, LLColor4& value)
260{ 260{
261 const LLString *s = getAttribute( canonical_name ); 261 const std::string *s = getAttribute( canonical_name );
262 return s ? LLColor4::parseColor(s->c_str(), &value) : FALSE; 262 return s ? LLColor4::parseColor(*s, &value) : FALSE;
263} 263}
264 264
265BOOL LLXmlTreeNode::getFastAttributeColor4(LLStdStringHandle canonical_name, LLColor4& value) 265BOOL LLXmlTreeNode::getFastAttributeColor4(LLStdStringHandle canonical_name, LLColor4& value)
266{ 266{
267 const LLString *s = getAttribute( canonical_name ); 267 const std::string *s = getAttribute( canonical_name );
268 return s ? LLColor4::parseColor4(s->c_str(), &value) : FALSE; 268 return s ? LLColor4::parseColor4(*s, &value) : FALSE;
269} 269}
270 270
271BOOL LLXmlTreeNode::getFastAttributeColor4U(LLStdStringHandle canonical_name, LLColor4U& value) 271BOOL LLXmlTreeNode::getFastAttributeColor4U(LLStdStringHandle canonical_name, LLColor4U& value)
272{ 272{
273 const LLString *s = getAttribute( canonical_name ); 273 const std::string *s = getAttribute( canonical_name );
274 return s ? LLColor4U::parseColor4U(s->c_str(), &value ) : FALSE; 274 return s ? LLColor4U::parseColor4U(*s, &value ) : FALSE;
275} 275}
276 276
277BOOL LLXmlTreeNode::getFastAttributeVector3(LLStdStringHandle canonical_name, LLVector3& value) 277BOOL LLXmlTreeNode::getFastAttributeVector3(LLStdStringHandle canonical_name, LLVector3& value)
278{ 278{
279 const LLString *s = getAttribute( canonical_name ); 279 const std::string *s = getAttribute( canonical_name );
280 return s ? LLVector3::parseVector3(s->c_str(), &value ) : FALSE; 280 return s ? LLVector3::parseVector3(*s, &value ) : FALSE;
281} 281}
282 282
283BOOL LLXmlTreeNode::getFastAttributeVector3d(LLStdStringHandle canonical_name, LLVector3d& value) 283BOOL LLXmlTreeNode::getFastAttributeVector3d(LLStdStringHandle canonical_name, LLVector3d& value)
284{ 284{
285 const LLString *s = getAttribute( canonical_name ); 285 const std::string *s = getAttribute( canonical_name );
286 return s ? LLVector3d::parseVector3d(s->c_str(), &value ) : FALSE; 286 return s ? LLVector3d::parseVector3d(*s, &value ) : FALSE;
287} 287}
288 288
289BOOL LLXmlTreeNode::getFastAttributeQuat(LLStdStringHandle canonical_name, LLQuaternion& value) 289BOOL LLXmlTreeNode::getFastAttributeQuat(LLStdStringHandle canonical_name, LLQuaternion& value)
290{ 290{
291 const LLString *s = getAttribute( canonical_name ); 291 const std::string *s = getAttribute( canonical_name );
292 return s ? LLQuaternion::parseQuat(s->c_str(), &value ) : FALSE; 292 return s ? LLQuaternion::parseQuat(*s, &value ) : FALSE;
293} 293}
294 294
295BOOL LLXmlTreeNode::getFastAttributeUUID(LLStdStringHandle canonical_name, LLUUID& value) 295BOOL LLXmlTreeNode::getFastAttributeUUID(LLStdStringHandle canonical_name, LLUUID& value)
296{ 296{
297 const LLString *s = getAttribute( canonical_name ); 297 const std::string *s = getAttribute( canonical_name );
298 return s ? LLUUID::parseUUID(s->c_str(), &value ) : FALSE; 298 return s ? LLUUID::parseUUID(*s, &value ) : FALSE;
299} 299}
300 300
301BOOL LLXmlTreeNode::getFastAttributeString(LLStdStringHandle canonical_name, LLString& value) 301BOOL LLXmlTreeNode::getFastAttributeString(LLStdStringHandle canonical_name, std::string& value)
302{ 302{
303 const LLString *s = getAttribute( canonical_name ); 303 const std::string *s = getAttribute( canonical_name );
304 if( !s ) 304 if( !s )
305 { 305 {
306 return FALSE; 306 return FALSE;
@@ -409,7 +409,7 @@ BOOL LLXmlTreeNode::getAttributeUUID(const std::string& name, LLUUID& value)
409 return getFastAttributeUUID(canonical_name, value); 409 return getFastAttributeUUID(canonical_name, value);
410} 410}
411 411
412BOOL LLXmlTreeNode::getAttributeString(const std::string& name, LLString& value) 412BOOL LLXmlTreeNode::getAttributeString(const std::string& name, std::string& value)
413{ 413{
414 LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString( name ); 414 LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString( name );
415 return getFastAttributeString(canonical_name, value); 415 return getFastAttributeString(canonical_name, value);
@@ -437,7 +437,7 @@ The quick brown fox
437 437
438*/ 438*/
439 439
440LLString LLXmlTreeNode::getTextContents() 440std::string LLXmlTreeNode::getTextContents()
441{ 441{
442 std::string msg; 442 std::string msg;
443 LLXmlTreeNode* p = getChildByName("p"); 443 LLXmlTreeNode* p = getChildByName("p");
@@ -541,7 +541,7 @@ BOOL LLXmlTreeParser::parseFile(const std::string &path, LLXmlTreeNode** root, B
541 541
542const std::string& LLXmlTreeParser::tabs() 542const std::string& LLXmlTreeParser::tabs()
543{ 543{
544 static LLString s; 544 static std::string s;
545 s = ""; 545 s = "";
546 S32 num_tabs = getDepth() - 1; 546 S32 num_tabs = getDepth() - 1;
547 for( S32 i = 0; i < num_tabs; i++) 547 for( S32 i = 0; i < num_tabs; i++)
@@ -602,8 +602,8 @@ void LLXmlTreeParser::endElement(const char* name)
602 602
603 if( !mCurrent->mContents.empty() ) 603 if( !mCurrent->mContents.empty() )
604 { 604 {
605 LLString::trim(mCurrent->mContents); 605 LLStringUtil::trim(mCurrent->mContents);
606 LLString::removeCRLF(mCurrent->mContents); 606 LLStringUtil::removeCRLF(mCurrent->mContents);
607 } 607 }
608 608
609 mCurrent = mCurrent->getParent(); 609 mCurrent = mCurrent->getParent();
@@ -611,7 +611,8 @@ void LLXmlTreeParser::endElement(const char* name)
611 611
612void LLXmlTreeParser::characterData(const char *s, int len) 612void LLXmlTreeParser::characterData(const char *s, int len)
613{ 613{
614 LLString str(s, len); 614 std::string str;
615 if (s) str = std::string(s, len);
615 if( mDump ) 616 if( mDump )
616 { 617 {
617 llinfos << tabs() << "CharacterData " << str << llendl; 618 llinfos << tabs() << "CharacterData " << str << llendl;
@@ -659,7 +660,8 @@ void LLXmlTreeParser::defaultData(const char *s, int len)
659{ 660{
660 if( mDump ) 661 if( mDump )
661 { 662 {
662 LLString str(s, len); 663 std::string str;
664 if (s) str = std::string(s, len);
663 llinfos << tabs() << "defaultData " << str << llendl; 665 llinfos << tabs() << "defaultData " << str << llendl;
664 } 666 }
665} 667}