aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llxml/llcontrol.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/llcontrol.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 'linden/indra/llxml/llcontrol.cpp')
-rw-r--r--linden/indra/llxml/llcontrol.cpp158
1 files changed, 77 insertions, 81 deletions
diff --git a/linden/indra/llxml/llcontrol.cpp b/linden/indra/llxml/llcontrol.cpp
index f88ac69..8fa58e8 100644
--- a/linden/indra/llxml/llcontrol.cpp
+++ b/linden/indra/llxml/llcontrol.cpp
@@ -49,7 +49,7 @@
49#include "llxmltree.h" 49#include "llxmltree.h"
50#include "llsdserialize.h" 50#include "llsdserialize.h"
51 51
52#if LL_RELEASE_FOR_DOWNLOAD 52#if LL_RELEASE_WITH_DEBUG_INFO || LL_DEBUG
53#define CONTROL_ERRS LL_WARNS("ControlErrors") 53#define CONTROL_ERRS LL_WARNS("ControlErrors")
54#else 54#else
55#define CONTROL_ERRS LL_ERRS("ControlErrors") 55#define CONTROL_ERRS LL_ERRS("ControlErrors")
@@ -99,8 +99,8 @@ bool LLControlVariable::llsd_compare(const LLSD& a, const LLSD & b)
99 return result; 99 return result;
100} 100}
101 101
102LLControlVariable::LLControlVariable(const LLString& name, eControlType type, 102LLControlVariable::LLControlVariable(const std::string& name, eControlType type,
103 LLSD initial, const LLString& comment, 103 LLSD initial, const std::string& comment,
104 bool persist) 104 bool persist)
105 : mName(name), 105 : mName(name),
106 mComment(comment), 106 mComment(comment),
@@ -129,7 +129,7 @@ LLSD LLControlVariable::getComparableValue(const LLSD& value)
129 if(TYPE_BOOLEAN == type() && value.isString()) 129 if(TYPE_BOOLEAN == type() && value.isString())
130 { 130 {
131 BOOL temp; 131 BOOL temp;
132 if(LLString::convertToBOOL(value.asString(), temp)) 132 if(LLStringUtil::convertToBOOL(value.asString(), temp))
133 { 133 {
134 storable_value = (bool)temp; 134 storable_value = (bool)temp;
135 } 135 }
@@ -246,7 +246,7 @@ LLSD LLControlVariable::getSaveValue() const
246 return mValues[0]; 246 return mValues[0];
247} 247}
248 248
249LLPointer<LLControlVariable> LLControlGroup::getControl(const LLString& name) 249LLPointer<LLControlVariable> LLControlGroup::getControl(const std::string& name)
250{ 250{
251 ctrl_name_table_t::iterator iter = mNameTable.find(name); 251 ctrl_name_table_t::iterator iter = mNameTable.find(name);
252 return iter == mNameTable.end() ? LLPointer<LLControlVariable>() : iter->second; 252 return iter == mNameTable.end() ? LLPointer<LLControlVariable>() : iter->second;
@@ -281,7 +281,7 @@ void LLControlGroup::cleanup()
281 mNameTable.clear(); 281 mNameTable.clear();
282} 282}
283 283
284eControlType LLControlGroup::typeStringToEnum(const LLString& typestr) 284eControlType LLControlGroup::typeStringToEnum(const std::string& typestr)
285{ 285{
286 for(int i = 0; i < (int)TYPE_COUNT; ++i) 286 for(int i = 0; i < (int)TYPE_COUNT; ++i)
287 { 287 {
@@ -290,12 +290,12 @@ eControlType LLControlGroup::typeStringToEnum(const LLString& typestr)
290 return (eControlType)-1; 290 return (eControlType)-1;
291} 291}
292 292
293LLString LLControlGroup::typeEnumToString(eControlType typeenum) 293std::string LLControlGroup::typeEnumToString(eControlType typeenum)
294{ 294{
295 return mTypeString[typeenum]; 295 return mTypeString[typeenum];
296} 296}
297 297
298BOOL LLControlGroup::declareControl(const LLString& name, eControlType type, const LLSD initial_val, const LLString& comment, BOOL persist) 298BOOL LLControlGroup::declareControl(const std::string& name, eControlType type, const LLSD initial_val, const std::string& comment, BOOL persist)
299{ 299{
300 if(mNameTable.find(name) != mNameTable.end()) 300 if(mNameTable.find(name) != mNameTable.end())
301 { 301 {
@@ -310,67 +310,67 @@ BOOL LLControlGroup::declareControl(const LLString& name, eControlType type, con
310 return TRUE; 310 return TRUE;
311} 311}
312 312
313BOOL LLControlGroup::declareU32(const LLString& name, const U32 initial_val, const LLString& comment, BOOL persist) 313BOOL LLControlGroup::declareU32(const std::string& name, const U32 initial_val, const std::string& comment, BOOL persist)
314{ 314{
315 return declareControl(name, TYPE_U32, (LLSD::Integer) initial_val, comment, persist); 315 return declareControl(name, TYPE_U32, (LLSD::Integer) initial_val, comment, persist);
316} 316}
317 317
318BOOL LLControlGroup::declareS32(const LLString& name, const S32 initial_val, const LLString& comment, BOOL persist) 318BOOL LLControlGroup::declareS32(const std::string& name, const S32 initial_val, const std::string& comment, BOOL persist)
319{ 319{
320 return declareControl(name, TYPE_S32, initial_val, comment, persist); 320 return declareControl(name, TYPE_S32, initial_val, comment, persist);
321} 321}
322 322
323BOOL LLControlGroup::declareF32(const LLString& name, const F32 initial_val, const LLString& comment, BOOL persist) 323BOOL LLControlGroup::declareF32(const std::string& name, const F32 initial_val, const std::string& comment, BOOL persist)
324{ 324{
325 return declareControl(name, TYPE_F32, initial_val, comment, persist); 325 return declareControl(name, TYPE_F32, initial_val, comment, persist);
326} 326}
327 327
328BOOL LLControlGroup::declareBOOL(const LLString& name, const BOOL initial_val, const LLString& comment, BOOL persist) 328BOOL LLControlGroup::declareBOOL(const std::string& name, const BOOL initial_val, const std::string& comment, BOOL persist)
329{ 329{
330 return declareControl(name, TYPE_BOOLEAN, initial_val, comment, persist); 330 return declareControl(name, TYPE_BOOLEAN, initial_val, comment, persist);
331} 331}
332 332
333BOOL LLControlGroup::declareString(const LLString& name, const LLString& initial_val, const LLString& comment, BOOL persist) 333BOOL LLControlGroup::declareString(const std::string& name, const std::string& initial_val, const std::string& comment, BOOL persist)
334{ 334{
335 return declareControl(name, TYPE_STRING, initial_val, comment, persist); 335 return declareControl(name, TYPE_STRING, initial_val, comment, persist);
336} 336}
337 337
338BOOL LLControlGroup::declareVec3(const LLString& name, const LLVector3 &initial_val, const LLString& comment, BOOL persist) 338BOOL LLControlGroup::declareVec3(const std::string& name, const LLVector3 &initial_val, const std::string& comment, BOOL persist)
339{ 339{
340 return declareControl(name, TYPE_VEC3, initial_val.getValue(), comment, persist); 340 return declareControl(name, TYPE_VEC3, initial_val.getValue(), comment, persist);
341} 341}
342 342
343BOOL LLControlGroup::declareVec3d(const LLString& name, const LLVector3d &initial_val, const LLString& comment, BOOL persist) 343BOOL LLControlGroup::declareVec3d(const std::string& name, const LLVector3d &initial_val, const std::string& comment, BOOL persist)
344{ 344{
345 return declareControl(name, TYPE_VEC3D, initial_val.getValue(), comment, persist); 345 return declareControl(name, TYPE_VEC3D, initial_val.getValue(), comment, persist);
346} 346}
347 347
348BOOL LLControlGroup::declareRect(const LLString& name, const LLRect &initial_val, const LLString& comment, BOOL persist) 348BOOL LLControlGroup::declareRect(const std::string& name, const LLRect &initial_val, const std::string& comment, BOOL persist)
349{ 349{
350 return declareControl(name, TYPE_RECT, initial_val.getValue(), comment, persist); 350 return declareControl(name, TYPE_RECT, initial_val.getValue(), comment, persist);
351} 351}
352 352
353BOOL LLControlGroup::declareColor4U(const LLString& name, const LLColor4U &initial_val, const LLString& comment, BOOL persist ) 353BOOL LLControlGroup::declareColor4U(const std::string& name, const LLColor4U &initial_val, const std::string& comment, BOOL persist )
354{ 354{
355 return declareControl(name, TYPE_COL4U, initial_val.getValue(), comment, persist); 355 return declareControl(name, TYPE_COL4U, initial_val.getValue(), comment, persist);
356} 356}
357 357
358BOOL LLControlGroup::declareColor4(const LLString& name, const LLColor4 &initial_val, const LLString& comment, BOOL persist ) 358BOOL LLControlGroup::declareColor4(const std::string& name, const LLColor4 &initial_val, const std::string& comment, BOOL persist )
359{ 359{
360 return declareControl(name, TYPE_COL4, initial_val.getValue(), comment, persist); 360 return declareControl(name, TYPE_COL4, initial_val.getValue(), comment, persist);
361} 361}
362 362
363BOOL LLControlGroup::declareColor3(const LLString& name, const LLColor3 &initial_val, const LLString& comment, BOOL persist ) 363BOOL LLControlGroup::declareColor3(const std::string& name, const LLColor3 &initial_val, const std::string& comment, BOOL persist )
364{ 364{
365 return declareControl(name, TYPE_COL3, initial_val.getValue(), comment, persist); 365 return declareControl(name, TYPE_COL3, initial_val.getValue(), comment, persist);
366} 366}
367 367
368BOOL LLControlGroup::declareLLSD(const LLString& name, const LLSD &initial_val, const LLString& comment, BOOL persist ) 368BOOL LLControlGroup::declareLLSD(const std::string& name, const LLSD &initial_val, const std::string& comment, BOOL persist )
369{ 369{
370 return declareControl(name, TYPE_LLSD, initial_val, comment, persist); 370 return declareControl(name, TYPE_LLSD, initial_val, comment, persist);
371} 371}
372 372
373BOOL LLControlGroup::getBOOL(const LLString& name) 373BOOL LLControlGroup::getBOOL(const std::string& name)
374{ 374{
375 LLControlVariable* control = getControl(name); 375 LLControlVariable* control = getControl(name);
376 376
@@ -383,7 +383,7 @@ BOOL LLControlGroup::getBOOL(const LLString& name)
383 } 383 }
384} 384}
385 385
386S32 LLControlGroup::getS32(const LLString& name) 386S32 LLControlGroup::getS32(const std::string& name)
387{ 387{
388 LLControlVariable* control = getControl(name); 388 LLControlVariable* control = getControl(name);
389 389
@@ -396,7 +396,7 @@ S32 LLControlGroup::getS32(const LLString& name)
396 } 396 }
397} 397}
398 398
399U32 LLControlGroup::getU32(const LLString& name) 399U32 LLControlGroup::getU32(const std::string& name)
400{ 400{
401 LLControlVariable* control = getControl(name); 401 LLControlVariable* control = getControl(name);
402 402
@@ -409,7 +409,7 @@ U32 LLControlGroup::getU32(const LLString& name)
409 } 409 }
410} 410}
411 411
412F32 LLControlGroup::getF32(const LLString& name) 412F32 LLControlGroup::getF32(const std::string& name)
413{ 413{
414 LLControlVariable* control = getControl(name); 414 LLControlVariable* control = getControl(name);
415 415
@@ -422,16 +422,16 @@ F32 LLControlGroup::getF32(const LLString& name)
422 } 422 }
423} 423}
424 424
425LLString LLControlGroup::findString(const LLString& name) 425std::string LLControlGroup::findString(const std::string& name)
426{ 426{
427 LLControlVariable* control = getControl(name); 427 LLControlVariable* control = getControl(name);
428 428
429 if (control && control->isType(TYPE_STRING)) 429 if (control && control->isType(TYPE_STRING))
430 return control->get().asString(); 430 return control->get().asString();
431 return LLString::null; 431 return LLStringUtil::null;
432} 432}
433 433
434LLString LLControlGroup::getString(const LLString& name) 434std::string LLControlGroup::getString(const std::string& name)
435{ 435{
436 LLControlVariable* control = getControl(name); 436 LLControlVariable* control = getControl(name);
437 437
@@ -440,24 +440,24 @@ LLString LLControlGroup::getString(const LLString& name)
440 else 440 else
441 { 441 {
442 CONTROL_ERRS << "Invalid string control " << name << llendl; 442 CONTROL_ERRS << "Invalid string control " << name << llendl;
443 return LLString::null; 443 return LLStringUtil::null;
444 } 444 }
445} 445}
446 446
447LLWString LLControlGroup::getWString(const LLString& name) 447LLWString LLControlGroup::getWString(const std::string& name)
448{ 448{
449 return utf8str_to_wstring(getString(name)); 449 return utf8str_to_wstring(getString(name));
450} 450}
451 451
452LLString LLControlGroup::getText(const LLString& name) 452std::string LLControlGroup::getText(const std::string& name)
453{ 453{
454 LLString utf8_string = getString(name); 454 std::string utf8_string = getString(name);
455 LLString::replaceChar(utf8_string, '^', '\n'); 455 LLStringUtil::replaceChar(utf8_string, '^', '\n');
456 LLString::replaceChar(utf8_string, '%', ' '); 456 LLStringUtil::replaceChar(utf8_string, '%', ' ');
457 return (utf8_string); 457 return (utf8_string);
458} 458}
459 459
460LLVector3 LLControlGroup::getVector3(const LLString& name) 460LLVector3 LLControlGroup::getVector3(const std::string& name)
461{ 461{
462 LLControlVariable* control = getControl(name); 462 LLControlVariable* control = getControl(name);
463 463
@@ -470,7 +470,7 @@ LLVector3 LLControlGroup::getVector3(const LLString& name)
470 } 470 }
471} 471}
472 472
473LLVector3d LLControlGroup::getVector3d(const LLString& name) 473LLVector3d LLControlGroup::getVector3d(const std::string& name)
474{ 474{
475 LLControlVariable* control = getControl(name); 475 LLControlVariable* control = getControl(name);
476 476
@@ -483,7 +483,7 @@ LLVector3d LLControlGroup::getVector3d(const LLString& name)
483 } 483 }
484} 484}
485 485
486LLRect LLControlGroup::getRect(const LLString& name) 486LLRect LLControlGroup::getRect(const std::string& name)
487{ 487{
488 LLControlVariable* control = getControl(name); 488 LLControlVariable* control = getControl(name);
489 489
@@ -497,7 +497,7 @@ LLRect LLControlGroup::getRect(const LLString& name)
497} 497}
498 498
499 499
500LLColor4 LLControlGroup::getColor(const LLString& name) 500LLColor4 LLControlGroup::getColor(const std::string& name)
501{ 501{
502 ctrl_name_table_t::const_iterator i = mNameTable.find(name); 502 ctrl_name_table_t::const_iterator i = mNameTable.find(name);
503 503
@@ -529,7 +529,7 @@ LLColor4 LLControlGroup::getColor(const LLString& name)
529 } 529 }
530} 530}
531 531
532LLColor4U LLControlGroup::getColor4U(const LLString& name) 532LLColor4U LLControlGroup::getColor4U(const std::string& name)
533{ 533{
534 LLControlVariable* control = getControl(name); 534 LLControlVariable* control = getControl(name);
535 535
@@ -542,7 +542,7 @@ LLColor4U LLControlGroup::getColor4U(const LLString& name)
542 } 542 }
543} 543}
544 544
545LLColor4 LLControlGroup::getColor4(const LLString& name) 545LLColor4 LLControlGroup::getColor4(const std::string& name)
546{ 546{
547 LLControlVariable* control = getControl(name); 547 LLControlVariable* control = getControl(name);
548 548
@@ -555,7 +555,7 @@ LLColor4 LLControlGroup::getColor4(const LLString& name)
555 } 555 }
556} 556}
557 557
558LLColor3 LLControlGroup::getColor3(const LLString& name) 558LLColor3 LLControlGroup::getColor3(const std::string& name)
559{ 559{
560 LLControlVariable* control = getControl(name); 560 LLControlVariable* control = getControl(name);
561 561
@@ -568,7 +568,7 @@ LLColor3 LLControlGroup::getColor3(const LLString& name)
568 } 568 }
569} 569}
570 570
571LLSD LLControlGroup::getLLSD(const LLString& name) 571LLSD LLControlGroup::getLLSD(const std::string& name)
572{ 572{
573 LLControlVariable* control = getControl(name); 573 LLControlVariable* control = getControl(name);
574 574
@@ -578,7 +578,7 @@ LLSD LLControlGroup::getLLSD(const LLString& name)
578 return LLSD(); 578 return LLSD();
579} 579}
580 580
581BOOL LLControlGroup::controlExists(const LLString& name) 581BOOL LLControlGroup::controlExists(const std::string& name)
582{ 582{
583 ctrl_name_table_t::iterator iter = mNameTable.find(name); 583 ctrl_name_table_t::iterator iter = mNameTable.find(name);
584 return iter != mNameTable.end(); 584 return iter != mNameTable.end();
@@ -588,7 +588,7 @@ BOOL LLControlGroup::controlExists(const LLString& name)
588// Set functions 588// Set functions
589//------------------------------------------------------------------- 589//-------------------------------------------------------------------
590 590
591void LLControlGroup::setBOOL(const LLString& name, BOOL val) 591void LLControlGroup::setBOOL(const std::string& name, BOOL val)
592{ 592{
593 LLControlVariable* control = getControl(name); 593 LLControlVariable* control = getControl(name);
594 594
@@ -603,7 +603,7 @@ void LLControlGroup::setBOOL(const LLString& name, BOOL val)
603} 603}
604 604
605 605
606void LLControlGroup::setS32(const LLString& name, S32 val) 606void LLControlGroup::setS32(const std::string& name, S32 val)
607{ 607{
608 LLControlVariable* control = getControl(name); 608 LLControlVariable* control = getControl(name);
609 609
@@ -618,7 +618,7 @@ void LLControlGroup::setS32(const LLString& name, S32 val)
618} 618}
619 619
620 620
621void LLControlGroup::setF32(const LLString& name, F32 val) 621void LLControlGroup::setF32(const std::string& name, F32 val)
622{ 622{
623 LLControlVariable* control = getControl(name); 623 LLControlVariable* control = getControl(name);
624 624
@@ -633,7 +633,7 @@ void LLControlGroup::setF32(const LLString& name, F32 val)
633} 633}
634 634
635 635
636void LLControlGroup::setU32(const LLString& name, U32 val) 636void LLControlGroup::setU32(const std::string& name, U32 val)
637{ 637{
638 LLControlVariable* control = getControl(name); 638 LLControlVariable* control = getControl(name);
639 639
@@ -648,7 +648,7 @@ void LLControlGroup::setU32(const LLString& name, U32 val)
648} 648}
649 649
650 650
651void LLControlGroup::setString(const LLString& name, const LLString &val) 651void LLControlGroup::setString(const std::string& name, const std::string &val)
652{ 652{
653 LLControlVariable* control = getControl(name); 653 LLControlVariable* control = getControl(name);
654 654
@@ -663,7 +663,7 @@ void LLControlGroup::setString(const LLString& name, const LLString &val)
663} 663}
664 664
665 665
666void LLControlGroup::setVector3(const LLString& name, const LLVector3 &val) 666void LLControlGroup::setVector3(const std::string& name, const LLVector3 &val)
667{ 667{
668 LLControlVariable* control = getControl(name); 668 LLControlVariable* control = getControl(name);
669 669
@@ -677,7 +677,7 @@ void LLControlGroup::setVector3(const LLString& name, const LLVector3 &val)
677 } 677 }
678} 678}
679 679
680void LLControlGroup::setVector3d(const LLString& name, const LLVector3d &val) 680void LLControlGroup::setVector3d(const std::string& name, const LLVector3d &val)
681{ 681{
682 LLControlVariable* control = getControl(name); 682 LLControlVariable* control = getControl(name);
683 683
@@ -691,7 +691,7 @@ void LLControlGroup::setVector3d(const LLString& name, const LLVector3d &val)
691 } 691 }
692} 692}
693 693
694void LLControlGroup::setRect(const LLString& name, const LLRect &val) 694void LLControlGroup::setRect(const std::string& name, const LLRect &val)
695{ 695{
696 LLControlVariable* control = getControl(name); 696 LLControlVariable* control = getControl(name);
697 697
@@ -705,7 +705,7 @@ void LLControlGroup::setRect(const LLString& name, const LLRect &val)
705 } 705 }
706} 706}
707 707
708void LLControlGroup::setColor4U(const LLString& name, const LLColor4U &val) 708void LLControlGroup::setColor4U(const std::string& name, const LLColor4U &val)
709{ 709{
710 LLControlVariable* control = getControl(name); 710 LLControlVariable* control = getControl(name);
711 711
@@ -719,7 +719,7 @@ void LLControlGroup::setColor4U(const LLString& name, const LLColor4U &val)
719 } 719 }
720} 720}
721 721
722void LLControlGroup::setColor4(const LLString& name, const LLColor4 &val) 722void LLControlGroup::setColor4(const std::string& name, const LLColor4 &val)
723{ 723{
724 LLControlVariable* control = getControl(name); 724 LLControlVariable* control = getControl(name);
725 725
@@ -733,7 +733,7 @@ void LLControlGroup::setColor4(const LLString& name, const LLColor4 &val)
733 } 733 }
734} 734}
735 735
736void LLControlGroup::setLLSD(const LLString& name, const LLSD& val) 736void LLControlGroup::setLLSD(const std::string& name, const LLSD& val)
737{ 737{
738 LLControlVariable* control = getControl(name); 738 LLControlVariable* control = getControl(name);
739 739
@@ -747,7 +747,7 @@ void LLControlGroup::setLLSD(const LLString& name, const LLSD& val)
747 } 747 }
748} 748}
749 749
750void LLControlGroup::setValue(const LLString& name, const LLSD& val) 750void LLControlGroup::setValue(const std::string& name, const LLSD& val)
751{ 751{
752 if (name.empty()) 752 if (name.empty())
753 { 753 {
@@ -771,9 +771,9 @@ void LLControlGroup::setValue(const LLString& name, const LLSD& val)
771//--------------------------------------------------------------- 771//---------------------------------------------------------------
772 772
773// Returns number of controls loaded, so 0 if failure 773// Returns number of controls loaded, so 0 if failure
774U32 LLControlGroup::loadFromFileLegacy(const LLString& filename, BOOL require_declaration, eControlType declare_as) 774U32 LLControlGroup::loadFromFileLegacy(const std::string& filename, BOOL require_declaration, eControlType declare_as)
775{ 775{
776 LLString name; 776 std::string name;
777 777
778 LLXmlTree xml_controls; 778 LLXmlTree xml_controls;
779 779
@@ -832,14 +832,14 @@ U32 LLControlGroup::loadFromFileLegacy(const LLString& filename, BOOL require_de
832 switch(declare_as) 832 switch(declare_as)
833 { 833 {
834 case TYPE_COL4: 834 case TYPE_COL4:
835 declareColor4(name, LLColor4::white, "", NO_PERSIST); 835 declareColor4(name, LLColor4::white, LLStringUtil::null, NO_PERSIST);
836 break; 836 break;
837 case TYPE_COL4U: 837 case TYPE_COL4U:
838 declareColor4U(name, LLColor4U::white, "", NO_PERSIST); 838 declareColor4U(name, LLColor4U::white, LLStringUtil::null, NO_PERSIST);
839 break; 839 break;
840 case TYPE_STRING: 840 case TYPE_STRING:
841 default: 841 default:
842 declareString(name, LLString::null, "", NO_PERSIST); 842 declareString(name, LLStringUtil::null, LLStringUtil::null, NO_PERSIST);
843 break; 843 break;
844 } 844 }
845 } 845 }
@@ -891,12 +891,8 @@ U32 LLControlGroup::loadFromFileLegacy(const LLString& filename, BOOL require_de
891 break; 891 break;
892 case TYPE_STRING: 892 case TYPE_STRING:
893 { 893 {
894 LLString string; 894 std::string string;
895 child_nodep->getAttributeString("value", string); 895 child_nodep->getAttributeString("value", string);
896 if (string == LLString::null)
897 {
898 string = "";
899 }
900 control->set(string); 896 control->set(string);
901 validitems++; 897 validitems++;
902 } 898 }
@@ -923,7 +919,7 @@ U32 LLControlGroup::loadFromFileLegacy(const LLString& filename, BOOL require_de
923 case TYPE_RECT: 919 case TYPE_RECT:
924 { 920 {
925 //RN: hack to support reading rectangles from a string 921 //RN: hack to support reading rectangles from a string
926 LLString rect_string; 922 std::string rect_string;
927 923
928 child_nodep->getAttributeString("value", rect_string); 924 child_nodep->getAttributeString("value", rect_string);
929 std::istringstream istream(rect_string); 925 std::istringstream istream(rect_string);
@@ -977,7 +973,7 @@ U32 LLControlGroup::loadFromFileLegacy(const LLString& filename, BOOL require_de
977 return validitems; 973 return validitems;
978} 974}
979 975
980U32 LLControlGroup::saveToFile(const LLString& filename, BOOL nondefault_only) 976U32 LLControlGroup::saveToFile(const std::string& filename, BOOL nondefault_only)
981{ 977{
982 LLSD settings; 978 LLSD settings;
983 int num_saved = 0; 979 int num_saved = 0;
@@ -1007,7 +1003,7 @@ U32 LLControlGroup::saveToFile(const LLString& filename, BOOL nondefault_only)
1007 } 1003 }
1008 } 1004 }
1009 llofstream file; 1005 llofstream file;
1010 file.open(filename.c_str()); 1006 file.open(filename);
1011 if (file.is_open()) 1007 if (file.is_open())
1012 { 1008 {
1013 LLSDSerialize::toPrettyXML(settings, file); 1009 LLSDSerialize::toPrettyXML(settings, file);
@@ -1023,13 +1019,13 @@ U32 LLControlGroup::saveToFile(const LLString& filename, BOOL nondefault_only)
1023 return num_saved; 1019 return num_saved;
1024} 1020}
1025 1021
1026U32 LLControlGroup::loadFromFile(const LLString& filename, bool set_default_values) 1022U32 LLControlGroup::loadFromFile(const std::string& filename, bool set_default_values)
1027{ 1023{
1028 LLString name; 1024 std::string name;
1029 LLSD settings; 1025 LLSD settings;
1030 LLSD control_map; 1026 LLSD control_map;
1031 llifstream infile; 1027 llifstream infile;
1032 infile.open(filename.c_str()); 1028 infile.open(filename);
1033 if(!infile.is_open()) 1029 if(!infile.is_open())
1034 { 1030 {
1035 llwarns << "Cannot find file " << filename << " to load." << llendl; 1031 llwarns << "Cannot find file " << filename << " to load." << llendl;
@@ -1127,10 +1123,10 @@ void LLControlGroup::applyToAll(ApplyFunctor* func)
1127//============================================================================ 1123//============================================================================
1128// First-use 1124// First-use
1129 1125
1130static LLString get_warn_name(const LLString& name) 1126static std::string get_warn_name(const std::string& name)
1131{ 1127{
1132 LLString warnname = "Warn" + name; 1128 std::string warnname = "Warn" + name;
1133 for (LLString::iterator iter = warnname.begin(); iter != warnname.end(); ++iter) 1129 for (std::string::iterator iter = warnname.begin(); iter != warnname.end(); ++iter)
1134 { 1130 {
1135 char c = *iter; 1131 char c = *iter;
1136 if (!isalnum(c)) 1132 if (!isalnum(c))
@@ -1141,32 +1137,32 @@ static LLString get_warn_name(const LLString& name)
1141 return warnname; 1137 return warnname;
1142} 1138}
1143 1139
1144void LLControlGroup::addWarning(const LLString& name) 1140void LLControlGroup::addWarning(const std::string& name)
1145{ 1141{
1146 LLString warnname = get_warn_name(name); 1142 std::string warnname = get_warn_name(name);
1147 if(mNameTable.find(warnname) == mNameTable.end()) 1143 if(mNameTable.find(warnname) == mNameTable.end())
1148 { 1144 {
1149 LLString comment = LLString("Enables ") + name + LLString(" warning dialog"); 1145 std::string comment = std::string("Enables ") + name + std::string(" warning dialog");
1150 declareBOOL(warnname, TRUE, comment); 1146 declareBOOL(warnname, TRUE, comment);
1151 mWarnings.insert(warnname); 1147 mWarnings.insert(warnname);
1152 } 1148 }
1153} 1149}
1154 1150
1155BOOL LLControlGroup::getWarning(const LLString& name) 1151BOOL LLControlGroup::getWarning(const std::string& name)
1156{ 1152{
1157 LLString warnname = get_warn_name(name); 1153 std::string warnname = get_warn_name(name);
1158 return getBOOL(warnname); 1154 return getBOOL(warnname);
1159} 1155}
1160 1156
1161void LLControlGroup::setWarning(const LLString& name, BOOL val) 1157void LLControlGroup::setWarning(const std::string& name, BOOL val)
1162{ 1158{
1163 LLString warnname = get_warn_name(name); 1159 std::string warnname = get_warn_name(name);
1164 setBOOL(warnname, val); 1160 setBOOL(warnname, val);
1165} 1161}
1166 1162
1167void LLControlGroup::resetWarnings() 1163void LLControlGroup::resetWarnings()
1168{ 1164{
1169 for (std::set<LLString>::iterator iter = mWarnings.begin(); 1165 for (std::set<std::string>::iterator iter = mWarnings.begin();
1170 iter != mWarnings.end(); ++iter) 1166 iter != mWarnings.end(); ++iter)
1171 { 1167 {
1172 setBOOL(*iter, TRUE); 1168 setBOOL(*iter, TRUE);