From 8c16ec2b53153a10f40181e0e8108d24331451d4 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Tue, 20 Feb 2024 13:57:07 +0100 Subject: Convert BOOL to bool in LLControlGroup and related classes --- indra/llxml/llcontrol.cpp | 30 ++++++++++-------------------- indra/llxml/llcontrol.h | 14 ++++++-------- indra/llxml/llxmlnode.h | 2 +- 3 files changed, 17 insertions(+), 29 deletions(-) (limited to 'indra/llxml') diff --git a/indra/llxml/llcontrol.cpp b/indra/llxml/llcontrol.cpp index 2c04147a5a..e215ff57fb 100644 --- a/indra/llxml/llcontrol.cpp +++ b/indra/llxml/llcontrol.cpp @@ -59,8 +59,6 @@ template <> eControlType get_control_type(); template <> eControlType get_control_type(); template <> eControlType get_control_type(); template <> eControlType get_control_type(); -// Yay BOOL, its really an S32. -//template <> eControlType get_control_type () ; template <> eControlType get_control_type(); template <> eControlType get_control_type(); @@ -465,7 +463,7 @@ std::string LLControlGroup::typeEnumToString(eControlType typeenum) return mTypeString[typeenum]; } -LLControlVariable* LLControlGroup::declareControl(const std::string& name, eControlType type, const LLSD initial_val, const std::string& comment, LLControlVariable::ePersist persist, BOOL hidefromsettingseditor) +LLControlVariable* LLControlGroup::declareControl(const std::string& name, eControlType type, const LLSD initial_val, const std::string& comment, LLControlVariable::ePersist persist, bool hidefromsettingseditor) { LLControlVariable* existing_control = getControl(name); if (existing_control) @@ -562,9 +560,9 @@ void LLControlGroup::incrCount(const std::string& name) getCount[name] = getCount[name].asInteger() + 1; } -BOOL LLControlGroup::getBOOL(const std::string& name) +bool LLControlGroup::getBOOL(const std::string& name) { - return (BOOL)get(name); + return get(name); } S32 LLControlGroup::getS32(const std::string& name) @@ -659,7 +657,7 @@ LLSD LLControlGroup::asLLSD(bool diffs_only) return result; } -BOOL LLControlGroup::controlExists(const std::string& name) +bool LLControlGroup::controlExists(const std::string& name) { ctrl_name_table_t::iterator iter = mNameTable.find(name); return iter != mNameTable.end(); @@ -670,7 +668,7 @@ BOOL LLControlGroup::controlExists(const std::string& name) // Set functions //------------------------------------------------------------------- -void LLControlGroup::setBOOL(const std::string& name, BOOL val) +void LLControlGroup::setBOOL(const std::string& name, bool val) { set(name, val); } @@ -755,7 +753,7 @@ void LLControlGroup::setUntypedValue(const std::string& name, const LLSD& val) //--------------------------------------------------------------- // Returns number of controls loaded, so 0 if failure -U32 LLControlGroup::loadFromFileLegacy(const std::string& filename, BOOL require_declaration, eControlType declare_as) +U32 LLControlGroup::loadFromFileLegacy(const std::string& filename, bool require_declaration, eControlType declare_as) { std::string name; @@ -791,7 +789,7 @@ U32 LLControlGroup::loadFromFileLegacy(const std::string& filename, BOOL require { name = child_nodep->getName(); - BOOL declared = controlExists(name); + bool declared = controlExists(name); if (require_declaration && !declared) { @@ -952,7 +950,7 @@ U32 LLControlGroup::loadFromFileLegacy(const std::string& filename, BOOL require return validitems; } -U32 LLControlGroup::saveToFile(const std::string& filename, BOOL nondefault_only) +U32 LLControlGroup::saveToFile(const std::string& filename, bool nondefault_only) { LLSD settings; int num_saved = 0; @@ -1162,7 +1160,7 @@ void main() bar = new LLControlVariable("gBar", 10, 2, 22); gGlobals.addEntry("gBar", bar); - baz = new LLControlVariable("gBaz", FALSE); + baz = new LLControlVariable("gBaz", false); gGlobals.addEntry("gBaz", baz); // test retrieval @@ -1224,13 +1222,7 @@ template <> eControlType get_control_type () { return TYPE_BOOLEAN; } -/* -// Yay BOOL, its really an S32. -template <> eControlType get_control_type () -{ - return TYPE_BOOLEAN; -} -*/ + template <> eControlType get_control_type() { return TYPE_STRING; @@ -1485,7 +1477,6 @@ DECL_LLCC(U32, (U32)666); DECL_LLCC(S32, (S32)-666); DECL_LLCC(F32, (F32)-666.666); DECL_LLCC(bool, true); -DECL_LLCC(BOOL, FALSE); static LLCachedControl mySetting_string("TestCachedControlstring", "Default String Value"); DECL_LLCC(LLVector3, LLVector3(1.0f, 2.0f, 3.0f)); DECL_LLCC(LLVector3d, LLVector3d(6.0f, 5.0f, 4.0f)); @@ -1506,7 +1497,6 @@ void test_cached_control() TEST_LLCC(S32, (S32)-666); TEST_LLCC(F32, (F32)-666.666); TEST_LLCC(bool, true); - TEST_LLCC(BOOL, FALSE); if((std::string)mySetting_string != "Default String Value") LL_ERRS() << "Fail string" << LL_ENDL; TEST_LLCC(LLVector3, LLVector3(1.0f, 2.0f, 3.0f)); TEST_LLCC(LLVector3d, LLVector3d(6.0f, 5.0f, 4.0f)); diff --git a/indra/llxml/llcontrol.h b/indra/llxml/llcontrol.h index d682b2c7c7..2289dc8841 100644 --- a/indra/llxml/llcontrol.h +++ b/indra/llxml/llcontrol.h @@ -210,7 +210,7 @@ public: }; void applyToAll(ApplyFunctor* func); - LLControlVariable* declareControl(const std::string& name, eControlType type, const LLSD initial_val, const std::string& comment, LLControlVariable::ePersist persist, BOOL hidefromsettingseditor = FALSE); + LLControlVariable* declareControl(const std::string& name, eControlType type, const LLSD initial_val, const std::string& comment, LLControlVariable::ePersist persist, bool hidefromsettingseditor = false); LLControlVariable* declareU32(const std::string& name, U32 initial_val, const std::string& comment, LLControlVariable::ePersist persist = LLControlVariable::PERSIST_NONDFT); LLControlVariable* declareS32(const std::string& name, S32 initial_val, const std::string& comment, LLControlVariable::ePersist persist = LLControlVariable::PERSIST_NONDFT); LLControlVariable* declareF32(const std::string& name, F32 initial_val, const std::string& comment, LLControlVariable::ePersist persist = LLControlVariable::PERSIST_NONDFT); @@ -226,7 +226,7 @@ public: std::string getString(const std::string& name); std::string getText(const std::string& name); - BOOL getBOOL(const std::string& name); + bool getBOOL(const std::string& name); S32 getS32(const std::string& name); F32 getF32(const std::string& name); U32 getU32(const std::string& name); @@ -265,7 +265,7 @@ public: return convert_from_llsd(value, type, name); } - void setBOOL(const std::string& name, BOOL val); + void setBOOL(const std::string& name, bool val); void setS32(const std::string& name, S32 val); void setF32(const std::string& name, F32 val); void setU32(const std::string& name, U32 val); @@ -295,13 +295,13 @@ public: } } - BOOL controlExists(const std::string& name); + bool controlExists(const std::string& name); // Returns number of controls loaded, 0 if failed // If require_declaration is false, will auto-declare controls it finds // as the given type. - U32 loadFromFileLegacy(const std::string& filename, BOOL require_declaration = TRUE, eControlType declare_as = TYPE_STRING); - U32 saveToFile(const std::string& filename, BOOL nondefault_only); + U32 loadFromFileLegacy(const std::string& filename, bool require_declaration = true, eControlType declare_as = TYPE_STRING); + U32 saveToFile(const std::string& filename, bool nondefault_only); U32 loadFromFile(const std::string& filename, bool default_values = false, bool save_values = true); void resetToDefaults(); void incrCount(const std::string& name); @@ -435,8 +435,6 @@ template <> eControlType get_control_type(); template <> eControlType get_control_type(); template <> eControlType get_control_type(); template <> eControlType get_control_type(); -// Yay BOOL, its really an S32. -//template <> eControlType get_control_type () template <> eControlType get_control_type(); template <> eControlType get_control_type(); template <> eControlType get_control_type(); diff --git a/indra/llxml/llxmlnode.h b/indra/llxml/llxmlnode.h index 21a7dee4cc..d5b8b36d86 100644 --- a/indra/llxml/llxmlnode.h +++ b/indra/llxml/llxmlnode.h @@ -296,7 +296,7 @@ public: XML_Parser *mParser; // Temporary pointer while loading - BOOL mIsAttribute; // Flag is only used for output formatting + bool mIsAttribute; // Flag is only used for output formatting U32 mVersionMajor; // Version of this tag to use U32 mVersionMinor; U32 mLength; // If the length is nonzero, then only return arrays of this length -- cgit v1.2.3