diff options
author | Steven Bennetts <steve@lindenlab.com> | 2007-03-02 21:25:50 +0000 |
---|---|---|
committer | Steven Bennetts <steve@lindenlab.com> | 2007-03-02 21:25:50 +0000 |
commit | 4dabd9c0472deb49573fdafef2fa413e59703f19 (patch) | |
tree | 06c680d6a2047e03838d6548bccd26c7baf9d652 /indra/llxml | |
parent | d4462963c6ba5db2088723bbedc7b60f1184c594 (diff) |
merge release@58699 beta-1-14-0@58707 -> release
Diffstat (limited to 'indra/llxml')
-rw-r--r-- | indra/llxml/llcontrol.cpp | 65 | ||||
-rw-r--r-- | indra/llxml/llxmlnode.h | 1 |
2 files changed, 34 insertions, 32 deletions
diff --git a/indra/llxml/llcontrol.cpp b/indra/llxml/llcontrol.cpp index da6302b27c..2af28f7d2c 100644 --- a/indra/llxml/llcontrol.cpp +++ b/indra/llxml/llcontrol.cpp @@ -113,7 +113,8 @@ void LLControlGroup::cleanup() LLControlBase* LLControlGroup::getControl(const LLString& name) { - return mNameTable[name]; + ctrl_name_table_t::iterator iter = mNameTable.find(name); + return iter == mNameTable.end() ? NULL : (LLControlBase*)iter->second; } BOOL LLControlGroup::declareControl(const LLString& name, eControlType type, const LLSD initial_val, const LLString& comment, BOOL persist) @@ -124,9 +125,11 @@ BOOL LLControlGroup::declareControl(const LLString& name, eControlType type, con LLControl* control = new LLControl(name, type, initial_val, comment, persist); mNameTable[name] = control; return TRUE; - } else + } + else { llwarns << "LLControlGroup::declareControl: Control named " << name << " already exists." << llendl; + mNameTable.erase(name); return FALSE; } } @@ -188,7 +191,7 @@ BOOL LLControlGroup::declareColor3(const LLString& name, const LLColor3 &initial LLSD LLControlGroup::registerListener(const LLString& name, LLSimpleListenerObservable *listener) { - LLControlBase *control = mNameTable[name]; + LLControlBase *control = getControl(name); if (control) { return control->registerListener(listener); @@ -198,7 +201,7 @@ LLSD LLControlGroup::registerListener(const LLString& name, LLSimpleListenerObse BOOL LLControlGroup::getBOOL(const LLString& name) { - LLControlBase* control = mNameTable[name]; + LLControlBase* control = getControl(name); if (control && control->isType(TYPE_BOOLEAN)) return control->get().asBoolean(); @@ -211,7 +214,7 @@ BOOL LLControlGroup::getBOOL(const LLString& name) S32 LLControlGroup::getS32(const LLString& name) { - LLControlBase* control = mNameTable[name]; + LLControlBase* control = getControl(name); if (control && control->isType(TYPE_S32)) return control->get().asInteger(); @@ -224,7 +227,7 @@ S32 LLControlGroup::getS32(const LLString& name) U32 LLControlGroup::getU32(const LLString& name) { - LLControlBase* control = mNameTable[name]; + LLControlBase* control = getControl(name); if (control && control->isType(TYPE_U32)) return control->get().asInteger(); @@ -237,7 +240,7 @@ U32 LLControlGroup::getU32(const LLString& name) F32 LLControlGroup::getF32(const LLString& name) { - LLControlBase* control = mNameTable[name]; + LLControlBase* control = getControl(name); if (control && control->isType(TYPE_F32)) return (F32) control->get().asReal(); @@ -250,7 +253,7 @@ F32 LLControlGroup::getF32(const LLString& name) LLString LLControlGroup::findString(const LLString& name) { - LLControlBase* control = mNameTable[name]; + LLControlBase* control = getControl(name); if (control && control->isType(TYPE_STRING)) return control->get().asString(); @@ -259,7 +262,7 @@ LLString LLControlGroup::findString(const LLString& name) LLString LLControlGroup::getString(const LLString& name) { - LLControlBase* control = mNameTable[name]; + LLControlBase* control = getControl(name); if (control && control->isType(TYPE_STRING)) return control->get().asString(); @@ -285,7 +288,7 @@ LLString LLControlGroup::getText(const LLString& name) LLVector3 LLControlGroup::getVector3(const LLString& name) { - LLControlBase* control = mNameTable[name]; + LLControlBase* control = getControl(name); if (control && control->isType(TYPE_VEC3)) return control->get(); @@ -298,7 +301,7 @@ LLVector3 LLControlGroup::getVector3(const LLString& name) LLVector3d LLControlGroup::getVector3d(const LLString& name) { - LLControlBase* control = mNameTable[name]; + LLControlBase* control = getControl(name); if (control && control->isType(TYPE_VEC3D)) return control->get(); @@ -311,7 +314,7 @@ LLVector3d LLControlGroup::getVector3d(const LLString& name) LLRect LLControlGroup::getRect(const LLString& name) { - LLControlBase* control = mNameTable[name]; + LLControlBase* control = getControl(name); if (control && control->isType(TYPE_RECT)) return control->get(); @@ -357,7 +360,7 @@ LLColor4 LLControlGroup::getColor(const LLString& name) LLColor4U LLControlGroup::getColor4U(const LLString& name) { - LLControlBase* control = mNameTable[name]; + LLControlBase* control = getControl(name); if (control && control->isType(TYPE_COL4U)) return control->get(); @@ -370,7 +373,7 @@ LLColor4U LLControlGroup::getColor4U(const LLString& name) LLColor4 LLControlGroup::getColor4(const LLString& name) { - LLControlBase* control = mNameTable[name]; + LLControlBase* control = getControl(name); if (control && control->isType(TYPE_COL4)) return control->get(); @@ -383,7 +386,7 @@ LLColor4 LLControlGroup::getColor4(const LLString& name) LLColor3 LLControlGroup::getColor3(const LLString& name) { - LLControlBase* control = mNameTable[name]; + LLControlBase* control = getControl(name); if (control && control->isType(TYPE_COL3)) return control->get(); @@ -396,9 +399,8 @@ LLColor3 LLControlGroup::getColor3(const LLString& name) BOOL LLControlGroup::controlExists(const LLString& name) { - void *control = mNameTable[name]; - - return (control != 0); + ctrl_name_table_t::iterator iter = mNameTable.find(name); + return iter != mNameTable.end(); } //------------------------------------------------------------------- @@ -407,7 +409,7 @@ BOOL LLControlGroup::controlExists(const LLString& name) void LLControlGroup::setBOOL(const LLString& name, BOOL val) { - LLControlBase* control = mNameTable[name]; + LLControlBase* control = getControl(name); if (control && control->isType(TYPE_BOOLEAN)) { @@ -422,7 +424,7 @@ void LLControlGroup::setBOOL(const LLString& name, BOOL val) void LLControlGroup::setS32(const LLString& name, S32 val) { - LLControlBase* control = mNameTable[name]; + LLControlBase* control = getControl(name); if (control && control->isType(TYPE_S32)) { @@ -437,7 +439,7 @@ void LLControlGroup::setS32(const LLString& name, S32 val) void LLControlGroup::setF32(const LLString& name, F32 val) { - LLControlBase* control = mNameTable[name]; + LLControlBase* control = getControl(name); if (control && control->isType(TYPE_F32)) { @@ -452,7 +454,7 @@ void LLControlGroup::setF32(const LLString& name, F32 val) void LLControlGroup::setU32(const LLString& name, U32 val) { - LLControlBase* control = mNameTable[name]; + LLControlBase* control = getControl(name); if (control && control->isType(TYPE_U32)) { @@ -467,7 +469,7 @@ void LLControlGroup::setU32(const LLString& name, U32 val) void LLControlGroup::setString(const LLString& name, const LLString &val) { - LLControlBase* control = mNameTable[name]; + LLControlBase* control = getControl(name); if (control && control->isType(TYPE_STRING)) { @@ -482,7 +484,7 @@ void LLControlGroup::setString(const LLString& name, const LLString &val) void LLControlGroup::setVector3(const LLString& name, const LLVector3 &val) { - LLControlBase* control = mNameTable[name]; + LLControlBase* control = getControl(name); if (control && control->isType(TYPE_VEC3)) { @@ -496,7 +498,7 @@ void LLControlGroup::setVector3(const LLString& name, const LLVector3 &val) void LLControlGroup::setVector3d(const LLString& name, const LLVector3d &val) { - LLControlBase* control = mNameTable[name]; + LLControlBase* control = getControl(name); if (control && control->isType(TYPE_VEC3D)) { @@ -510,7 +512,7 @@ void LLControlGroup::setVector3d(const LLString& name, const LLVector3d &val) void LLControlGroup::setRect(const LLString& name, const LLRect &val) { - LLControlBase* control = mNameTable[name]; + LLControlBase* control = getControl(name); if (control && control->isType(TYPE_RECT)) { @@ -524,7 +526,7 @@ void LLControlGroup::setRect(const LLString& name, const LLRect &val) void LLControlGroup::setColor4U(const LLString& name, const LLColor4U &val) { - LLControlBase* control = mNameTable[name]; + LLControlBase* control = getControl(name); if (control && control->isType(TYPE_COL4U)) { @@ -538,7 +540,7 @@ void LLControlGroup::setColor4U(const LLString& name, const LLColor4U &val) void LLControlGroup::setColor4(const LLString& name, const LLColor4 &val) { - LLControlBase* control = mNameTable[name]; + LLControlBase* control = getControl(name); if (control && control->isType(TYPE_COL4)) { @@ -557,7 +559,7 @@ void LLControlGroup::setValue(const LLString& name, const LLSD& val) return; } - LLControlBase* control = mNameTable[name]; + LLControlBase* control = getControl(name); if (control) { @@ -839,7 +841,7 @@ U32 LLControlGroup::loadFromFile(const LLString& filename, BOOL require_declarat { name = child_nodep->getName(); - BOOL declared = (mNameTable[name].notNull()); + BOOL declared = controlExists(name); if (require_declaration && !declared) { @@ -1026,8 +1028,7 @@ U32 LLControlGroup::saveToFile(const LLString& filename, BOOL nondefault_only) break; } - LLControlBase* control = (LLControlBase *)mNameTable[name]; - + LLControlBase* control = (LLControlBase *)iter->second; if (!control) { llwarns << "Tried to save invalid control: " << name << llendl; diff --git a/indra/llxml/llxmlnode.h b/indra/llxml/llxmlnode.h index ca8c1d176f..ae16a9d800 100644 --- a/indra/llxml/llxmlnode.h +++ b/indra/llxml/llxmlnode.h @@ -15,6 +15,7 @@ #include "indra_constants.h" #include "llmemory.h" +#include "llthread.h" #include "llstring.h" #include "llstringtable.h" |