From 2b31dad40026d8078ea30d0da0656a4078d0f5b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20N=C3=A6sbye=20Christensen?= Date: Fri, 9 Feb 2024 22:26:02 +0100 Subject: miscellaneous: BOOL (int) to real bool --- indra/llxml/llcontrol.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llxml/llcontrol.h') diff --git a/indra/llxml/llcontrol.h b/indra/llxml/llcontrol.h index 0839c02c50..d682b2c7c7 100644 --- a/indra/llxml/llcontrol.h +++ b/indra/llxml/llcontrol.h @@ -214,7 +214,7 @@ public: 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); - LLControlVariable* declareBOOL(const std::string& name, BOOL initial_val, const std::string& comment, LLControlVariable::ePersist persist = LLControlVariable::PERSIST_NONDFT); + LLControlVariable* declareBOOL(const std::string& name, bool initial_val, const std::string& comment, LLControlVariable::ePersist persist = LLControlVariable::PERSIST_NONDFT); LLControlVariable* declareString(const std::string& name, const std::string &initial_val, const std::string& comment, LLControlVariable::ePersist persist = LLControlVariable::PERSIST_NONDFT); LLControlVariable* declareVec3(const std::string& name, const LLVector3 &initial_val,const std::string& comment, LLControlVariable::ePersist persist = LLControlVariable::PERSIST_NONDFT); LLControlVariable* declareVec3d(const std::string& name, const LLVector3d &initial_val, const std::string& comment, LLControlVariable::ePersist persist = LLControlVariable::PERSIST_NONDFT); -- cgit v1.2.3 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.h | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'indra/llxml/llcontrol.h') 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(); -- cgit v1.2.3 From 3ffe63b8a4e8a3ceda3f6d204e4b5bb0c80d0870 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Wed, 21 Feb 2024 16:49:48 +0100 Subject: Convert remaining BOOLs in llxml and introduce std::string_view --- indra/llxml/llcontrol.h | 92 ++++++++++++++++++++++++------------------------- 1 file changed, 46 insertions(+), 46 deletions(-) (limited to 'indra/llxml/llcontrol.h') diff --git a/indra/llxml/llcontrol.h b/indra/llxml/llcontrol.h index 2289dc8841..a8bc584c48 100644 --- a/indra/llxml/llcontrol.h +++ b/indra/llxml/llcontrol.h @@ -144,7 +144,7 @@ public: LLSD getSaveValue() const; void set(const LLSD& val) { setValue(val); } - void setValue(const LLSD& value, bool saved_value = TRUE); + void setValue(const LLSD& value, bool saved_value = true); void setDefaultValue(const LLSD& value); void setPersist(ePersist); void setHiddenFromSettingsEditor(bool hide); @@ -177,7 +177,7 @@ LLSD convert_to_llsd(const T& in) } template -T convert_from_llsd(const LLSD& sd, eControlType type, const std::string& control_name) +T convert_from_llsd(const LLSD& sd, eControlType type, std::string_view control_name) { // needs specialization return T(sd); @@ -201,7 +201,7 @@ public: ~LLControlGroup(); void cleanup(); - LLControlVariablePtr getControl(const std::string& name); + LLControlVariablePtr getControl(std::string_view name); struct ApplyFunctor { @@ -224,28 +224,28 @@ public: LLControlVariable* declareColor3(const std::string& name, const LLColor3 &initial_val, const std::string& comment, LLControlVariable::ePersist persist = LLControlVariable::PERSIST_NONDFT); LLControlVariable* declareLLSD(const std::string& name, const LLSD &initial_val, const std::string& comment, LLControlVariable::ePersist persist = LLControlVariable::PERSIST_NONDFT); - std::string getString(const std::string& name); - std::string getText(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); + std::string getString(std::string_view name); + std::string getText(std::string_view name); + bool getBOOL(std::string_view name); + S32 getS32(std::string_view name); + F32 getF32(std::string_view name); + U32 getU32(std::string_view name); - LLWString getWString(const std::string& name); - LLVector3 getVector3(const std::string& name); - LLVector3d getVector3d(const std::string& name); - LLRect getRect(const std::string& name); - LLSD getLLSD(const std::string& name); - LLQuaternion getQuaternion(const std::string& name); + LLWString getWString(std::string_view name); + LLVector3 getVector3(std::string_view name); + LLVector3d getVector3d(std::string_view name); + LLRect getRect(std::string_view name); + LLSD getLLSD(std::string_view name); + LLQuaternion getQuaternion(std::string_view name); - LLColor4 getColor(const std::string& name); - LLColor4 getColor4(const std::string& name); - LLColor3 getColor3(const std::string& name); + LLColor4 getColor(std::string_view name); + LLColor4 getColor4(std::string_view name); + LLColor3 getColor3(std::string_view name); LLSD asLLSD(bool diffs_only); // generic getter - template T get(const std::string& name) + template T get(std::string_view name) { LL_PROFILE_ZONE_SCOPED_CATEGORY_LLSD; LLControlVariable* control = getControl(name); @@ -265,23 +265,23 @@ public: return convert_from_llsd(value, type, name); } - 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); - void setString(const std::string& name, const std::string& val); - void setVector3(const std::string& name, const LLVector3 &val); - void setVector3d(const std::string& name, const LLVector3d &val); - void setQuaternion(const std::string& name, const LLQuaternion &val); - void setRect(const std::string& name, const LLRect &val); - void setColor4(const std::string& name, const LLColor4 &val); - void setLLSD(const std::string& name, const LLSD& val); + void setBOOL(std::string_view name, bool val); + void setS32(std::string_view name, S32 val); + void setF32(std::string_view name, F32 val); + void setU32(std::string_view name, U32 val); + void setString(std::string_view name, const std::string& val); + void setVector3(std::string_view name, const LLVector3 &val); + void setVector3d(std::string_view name, const LLVector3d &val); + void setQuaternion(std::string_view name, const LLQuaternion &val); + void setRect(std::string_view name, const LLRect &val); + void setColor4(std::string_view name, const LLColor4 &val); + void setLLSD(std::string_view name, const LLSD& val); // type agnostic setter that takes LLSD - void setUntypedValue(const std::string& name, const LLSD& val); + void setUntypedValue(std::string_view name, const LLSD& val); // generic setter - template void set(const std::string& name, const T& val) + template void set(std::string_view name, const T& val) { LLControlVariable* control = getControl(name); @@ -304,7 +304,7 @@ public: 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); + void incrCount(std::string_view name); bool mSettingsProfile; }; @@ -452,19 +452,19 @@ template <> LLSD convert_to_llsd(const LLRect& in); template <> LLSD convert_to_llsd(const LLColor4& in); template <> LLSD convert_to_llsd(const LLColor3& in); -template<> std::string convert_from_llsd(const LLSD& sd, eControlType type, const std::string& control_name); -template<> LLWString convert_from_llsd(const LLSD& sd, eControlType type, const std::string& control_name); -template<> LLVector3 convert_from_llsd(const LLSD& sd, eControlType type, const std::string& control_name); -template<> LLVector3d convert_from_llsd(const LLSD& sd, eControlType type, const std::string& control_name); -template<> LLQuaternion convert_from_llsd(const LLSD& sd, eControlType type, const std::string& control_name); -template<> LLRect convert_from_llsd(const LLSD& sd, eControlType type, const std::string& control_name); -template<> bool convert_from_llsd(const LLSD& sd, eControlType type, const std::string& control_name); -template<> S32 convert_from_llsd(const LLSD& sd, eControlType type, const std::string& control_name); -template<> F32 convert_from_llsd(const LLSD& sd, eControlType type, const std::string& control_name); -template<> U32 convert_from_llsd(const LLSD& sd, eControlType type, const std::string& control_name); -template<> LLColor3 convert_from_llsd(const LLSD& sd, eControlType type, const std::string& control_name); -template<> LLColor4 convert_from_llsd(const LLSD& sd, eControlType type, const std::string& control_name); -template<> LLSD convert_from_llsd(const LLSD& sd, eControlType type, const std::string& control_name); +template<> std::string convert_from_llsd(const LLSD& sd, eControlType type, std::string_view control_name); +template<> LLWString convert_from_llsd(const LLSD& sd, eControlType type, std::string_view control_name); +template<> LLVector3 convert_from_llsd(const LLSD& sd, eControlType type, std::string_view control_name); +template<> LLVector3d convert_from_llsd(const LLSD& sd, eControlType type, std::string_view control_name); +template<> LLQuaternion convert_from_llsd(const LLSD& sd, eControlType type, std::string_view control_name); +template<> LLRect convert_from_llsd(const LLSD& sd, eControlType type, std::string_view control_name); +template<> bool convert_from_llsd(const LLSD& sd, eControlType type, std::string_view control_name); +template<> S32 convert_from_llsd(const LLSD& sd, eControlType type, std::string_view control_name); +template<> F32 convert_from_llsd(const LLSD& sd, eControlType type, std::string_view control_name); +template<> U32 convert_from_llsd(const LLSD& sd, eControlType type, std::string_view control_name); +template<> LLColor3 convert_from_llsd(const LLSD& sd, eControlType type, std::string_view control_name); +template<> LLColor4 convert_from_llsd(const LLSD& sd, eControlType type, std::string_view control_name); +template<> LLSD convert_from_llsd(const LLSD& sd, eControlType type, std::string_view control_name); //#define TEST_CACHED_CONTROL 1 #ifdef TEST_CACHED_CONTROL -- cgit v1.2.3 From a865d423974ea06dffa47798c81e98e7570b02ec Mon Sep 17 00:00:00 2001 From: Alexander Gavriliuk Date: Tue, 5 Mar 2024 17:03:11 +0100 Subject: viewer#819 Avoid reading the same XML file multiple times --- indra/llxml/llcontrol.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llxml/llcontrol.h') diff --git a/indra/llxml/llcontrol.h b/indra/llxml/llcontrol.h index a8bc584c48..e148b74292 100644 --- a/indra/llxml/llcontrol.h +++ b/indra/llxml/llcontrol.h @@ -300,7 +300,7 @@ public: // 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 loadFromFileLegacy(const std::string& filename, const std::string& xml, 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(); -- cgit v1.2.3 From 2008f87f10d51a2f9372aa4a4d72e86ac94e1e81 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Mon, 13 May 2024 18:26:53 +0300 Subject: Revert "viewer#819 Avoid reading the same XML file multiple times" This reverts commit a865d423974ea06dffa47798c81e98e7570b02ec. Reason for revert: viewer#1420, reverting to not hold maint-A (is deepCopy not full?) --- indra/llxml/llcontrol.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llxml/llcontrol.h') diff --git a/indra/llxml/llcontrol.h b/indra/llxml/llcontrol.h index e148b74292..a8bc584c48 100644 --- a/indra/llxml/llcontrol.h +++ b/indra/llxml/llcontrol.h @@ -300,7 +300,7 @@ public: // 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, const std::string& xml, bool require_declaration = true, eControlType declare_as = TYPE_STRING); + 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(); -- cgit v1.2.3 From e2e37cced861b98de8c1a7c9c0d3a50d2d90e433 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Wed, 22 May 2024 21:25:21 +0200 Subject: Fix line endlings --- indra/llxml/llcontrol.h | 948 ++++++++++++++++++++++++------------------------ 1 file changed, 474 insertions(+), 474 deletions(-) (limited to 'indra/llxml/llcontrol.h') diff --git a/indra/llxml/llcontrol.h b/indra/llxml/llcontrol.h index f542745b44..1b04729a82 100644 --- a/indra/llxml/llcontrol.h +++ b/indra/llxml/llcontrol.h @@ -1,474 +1,474 @@ -/** - * @file llcontrol.h - * @brief A mechanism for storing "control state" for a program - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLCONTROL_H -#define LL_LLCONTROL_H - -#include "llboost.h" -#include "llevent.h" -#include "llstring.h" -#include "llrect.h" -#include "llrefcount.h" -#include "llinstancetracker.h" - -#include - -// *NOTE: boost::visit_each<> generates warning 4675 on .net 2003 -// Disable the warning for the boost includes. -#if LL_WINDOWS -# if (_MSC_VER >= 1300 && _MSC_VER < 1400) -# pragma warning(push) -# pragma warning( disable : 4675 ) -# endif -#endif - -#include - -#if LL_WINDOWS - #pragma warning (push) - #pragma warning (disable : 4263) // boost::signals2::expired_slot::what() has const mismatch - #pragma warning (disable : 4264) -#endif -#include -#if LL_WINDOWS - #pragma warning (pop) -#endif - -#if LL_WINDOWS -# if (_MSC_VER >= 1300 && _MSC_VER < 1400) -# pragma warning(pop) -# endif -#endif - -class LLVector3; -class LLVector3d; -class LLQuaternion; -class LLColor4; -class LLColor3; - -// if this is changed, also modify mTypeString in llcontrol.h -typedef enum e_control_type -{ - TYPE_U32 = 0, - TYPE_S32, - TYPE_F32, - TYPE_BOOLEAN, - TYPE_STRING, - TYPE_VEC3, - TYPE_VEC3D, - TYPE_QUAT, - TYPE_RECT, - TYPE_COL4, - TYPE_COL3, - TYPE_LLSD, - TYPE_COUNT -} eControlType; - -class LLControlVariable : public LLRefCount -{ - LOG_CLASS(LLControlVariable); - - friend class LLControlGroup; - -public: - typedef boost::signals2::signal validate_signal_t; - typedef boost::signals2::signal commit_signal_t; - - enum ePersist - { - PERSIST_NO, // don't save this var - PERSIST_NONDFT, // save this var if differs from default - PERSIST_ALWAYS // save this var even if has default value - }; - -private: - std::string mName; - std::string mComment; - eControlType mType; - ePersist mPersist; - bool mHideFromSettingsEditor; - std::vector mValues; - - commit_signal_t mCommitSignal; - validate_signal_t mValidateSignal; - -public: - LLControlVariable(const std::string& name, eControlType type, - LLSD initial, const std::string& comment, - ePersist persist = PERSIST_NONDFT, bool hidefromsettingseditor = false); - - virtual ~LLControlVariable(); - - const std::string& getName() const { return mName; } - const std::string& getComment() const { return mComment; } - - eControlType type() { return mType; } - bool isType(eControlType tp) { return tp == mType; } - - void resetToDefault(bool fire_signal = false); - - commit_signal_t* getSignal() { return &mCommitSignal; } // shorthand for commit signal - commit_signal_t* getCommitSignal() { return &mCommitSignal; } - validate_signal_t* getValidateSignal() { return &mValidateSignal; } - - bool isDefault() { return (mValues.size() == 1); } - bool shouldSave(bool nondefault_only); - bool isPersisted() { return mPersist != PERSIST_NO; } - bool isHiddenFromSettingsEditor() { return mHideFromSettingsEditor; } - LLSD get() const { return getValue(); } - LLSD getValue() const { return mValues.back(); } - LLSD getDefault() const { return mValues.front(); } - LLSD getSaveValue() const; - - void set(const LLSD& val) { setValue(val); } - void setValue(const LLSD& value, bool saved_value = true); - void setDefaultValue(const LLSD& value); - void setPersist(ePersist); - void setHiddenFromSettingsEditor(bool hide); - void setComment(const std::string& comment); - -private: - void firePropertyChanged(const LLSD &pPreviousValue) - { - mCommitSignal(this, mValues.back(), pPreviousValue); - } - LLSD getComparableValue(const LLSD& value); - bool llsd_compare(const LLSD& a, const LLSD & b); -}; - -typedef LLPointer LLControlVariablePtr; - -//! Helper functions for converting between static types and LLControl values -template -eControlType get_control_type() -{ - LL_WARNS() << "Usupported control type: " << typeid(T).name() << "." << LL_ENDL; - return TYPE_COUNT; -} - -template -LLSD convert_to_llsd(const T& in) -{ - // default implementation - return LLSD(in); -} - -template -T convert_from_llsd(const LLSD& sd, eControlType type, std::string_view control_name) -{ - // needs specialization - return T(sd); -} - -//const U32 STRING_CACHE_SIZE = 10000; -class LLControlGroup : public LLInstanceTracker -{ - LOG_CLASS(LLControlGroup); - -protected: - typedef std::map ctrl_name_table_t; - ctrl_name_table_t mNameTable; - static const std::string mTypeString[TYPE_COUNT]; - -public: - static eControlType typeStringToEnum(const std::string& typestr); - static std::string typeEnumToString(eControlType typeenum); - - LLControlGroup(const std::string& name); - ~LLControlGroup(); - void cleanup(); - - LLControlVariablePtr getControl(std::string_view name); - - struct ApplyFunctor - { - virtual ~ApplyFunctor() {}; - virtual void apply(const std::string& name, LLControlVariable* control) = 0; - }; - 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* 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); - LLControlVariable* declareBOOL(const std::string& name, bool initial_val, const std::string& comment, LLControlVariable::ePersist persist = LLControlVariable::PERSIST_NONDFT); - LLControlVariable* declareString(const std::string& name, const std::string &initial_val, const std::string& comment, LLControlVariable::ePersist persist = LLControlVariable::PERSIST_NONDFT); - LLControlVariable* declareVec3(const std::string& name, const LLVector3 &initial_val,const std::string& comment, LLControlVariable::ePersist persist = LLControlVariable::PERSIST_NONDFT); - LLControlVariable* declareVec3d(const std::string& name, const LLVector3d &initial_val, const std::string& comment, LLControlVariable::ePersist persist = LLControlVariable::PERSIST_NONDFT); - LLControlVariable* declareQuat(const std::string& name, const LLQuaternion &initial_val, const std::string& comment, LLControlVariable::ePersist persist = LLControlVariable::PERSIST_NONDFT); - LLControlVariable* declareRect(const std::string& name, const LLRect &initial_val, const std::string& comment, LLControlVariable::ePersist persist = LLControlVariable::PERSIST_NONDFT); - LLControlVariable* declareColor4(const std::string& name, const LLColor4 &initial_val, const std::string& comment, LLControlVariable::ePersist persist = LLControlVariable::PERSIST_NONDFT); - LLControlVariable* declareColor3(const std::string& name, const LLColor3 &initial_val, const std::string& comment, LLControlVariable::ePersist persist = LLControlVariable::PERSIST_NONDFT); - LLControlVariable* declareLLSD(const std::string& name, const LLSD &initial_val, const std::string& comment, LLControlVariable::ePersist persist = LLControlVariable::PERSIST_NONDFT); - - std::string getString(std::string_view name); - std::string getText(std::string_view name); - bool getBOOL(std::string_view name); - S32 getS32(std::string_view name); - F32 getF32(std::string_view name); - U32 getU32(std::string_view name); - - LLWString getWString(std::string_view name); - LLVector3 getVector3(std::string_view name); - LLVector3d getVector3d(std::string_view name); - LLRect getRect(std::string_view name); - LLSD getLLSD(std::string_view name); - LLQuaternion getQuaternion(std::string_view name); - - LLColor4 getColor(std::string_view name); - LLColor4 getColor4(std::string_view name); - LLColor3 getColor3(std::string_view name); - - LLSD asLLSD(bool diffs_only); - - // generic getter - template T get(std::string_view name) - { - LL_PROFILE_ZONE_SCOPED_CATEGORY_LLSD; - LLControlVariable* control = getControl(name); - LLSD value; - eControlType type = TYPE_COUNT; - - if (control) - { - value = control->get(); - type = control->type(); - } - else - { - LL_WARNS() << "Control " << name << " not found." << LL_ENDL; - return T(); - } - return convert_from_llsd(value, type, name); - } - - void setBOOL(std::string_view name, bool val); - void setS32(std::string_view name, S32 val); - void setF32(std::string_view name, F32 val); - void setU32(std::string_view name, U32 val); - void setString(std::string_view name, const std::string& val); - void setVector3(std::string_view name, const LLVector3 &val); - void setVector3d(std::string_view name, const LLVector3d &val); - void setQuaternion(std::string_view name, const LLQuaternion &val); - void setRect(std::string_view name, const LLRect &val); - void setColor4(std::string_view name, const LLColor4 &val); - void setLLSD(std::string_view name, const LLSD& val); - - // type agnostic setter that takes LLSD - void setUntypedValue(std::string_view name, const LLSD& val); - - // generic setter - template void set(std::string_view name, const T& val) - { - LLControlVariable* control = getControl(name); - - if (control && control->isType(get_control_type())) - { - control->set(convert_to_llsd(val)); - } - else - { - LL_WARNS() << "Invalid control " << name << LL_ENDL; - } - } - - 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 loadFromFile(const std::string& filename, bool default_values = false, bool save_values = true); - void resetToDefaults(); - void incrCount(std::string_view name); - - bool mSettingsProfile; -}; - - -//! Publish/Subscribe object to interact with LLControlGroups. - -//! Use an LLCachedControl instance to connect to a LLControlVariable -//! without have to manually create and bind a listener to a local -//! object. -template -class LLControlCache : public LLRefCount, public LLInstanceTracker, std::string> -{ -public: - // This constructor will declare a control if it doesn't exist in the contol group - LLControlCache(LLControlGroup& group, - const std::string& name, - const T& default_value, - const std::string& comment) - : LLInstanceTracker, std::string >(name) - { - if(!group.controlExists(name)) - { - if(!declareTypedControl(group, name, default_value, comment)) - { - LL_ERRS() << "The control could not be created!!!" << LL_ENDL; - } - } - - bindToControl(group, name); - } - - LLControlCache(LLControlGroup& group, - const std::string& name) - : LLInstanceTracker, std::string >(name) - { - if(!group.controlExists(name)) - { - LL_ERRS() << "Control named " << name << "not found." << LL_ENDL; - } - - bindToControl(group, name); - } - - ~LLControlCache() - { - } - - const T& getValue() const { return mCachedValue; } - -private: - void bindToControl(LLControlGroup& group, const std::string& name) - { - LLControlVariablePtr controlp = group.getControl(name); - mType = controlp->type(); - mCachedValue = convert_from_llsd(controlp->get(), mType, name); - - // Add a listener to the controls signal... - // NOTE: All listeners connected to 0 group, for guaranty that variable handlers (gSavedSettings) call last - mConnection = controlp->getSignal()->connect(0, - boost::bind(&LLControlCache::handleValueChange, this, _2) - ); - mType = controlp->type(); - } - bool declareTypedControl(LLControlGroup& group, - const std::string& name, - const T& default_value, - const std::string& comment) - { - LLSD init_value; - eControlType type = get_control_type(); - init_value = convert_to_llsd(default_value); - if(type < TYPE_COUNT) - { - group.declareControl(name, type, init_value, comment, LLControlVariable::PERSIST_NO); - return true; - } - return false; - } - - bool handleValueChange(const LLSD& newvalue) - { - mCachedValue = convert_from_llsd(newvalue, mType, ""); - return true; - } - -private: - T mCachedValue; - eControlType mType; - boost::signals2::scoped_connection mConnection; -}; - -template -class LLCachedControl -{ -public: - LLCachedControl(LLControlGroup& group, - const std::string& name, - const T& default_value, - const std::string& comment = "Declared In Code") - { - mCachedControlPtr = LLControlCache::getInstance(name).get(); - if (! mCachedControlPtr) - { - mCachedControlPtr = new LLControlCache(group, name, default_value, comment); - } - } - - LLCachedControl(LLControlGroup& group, - const std::string& name) - { - mCachedControlPtr = LLControlCache::getInstance(name).get(); - if (! mCachedControlPtr) - { - mCachedControlPtr = new LLControlCache(group, name); - } - } - - operator const T&() const { return mCachedControlPtr->getValue(); } - operator boost::function () const { return boost::function(*this); } - const T& operator()() { return mCachedControlPtr->getValue(); } - -private: - LLPointer > mCachedControlPtr; -}; - -template <> eControlType get_control_type(); -template <> eControlType get_control_type(); -template <> eControlType get_control_type(); -template <> eControlType get_control_type(); -template <> eControlType get_control_type(); -template <> eControlType get_control_type(); -template <> eControlType get_control_type(); -template <> eControlType get_control_type(); -template <> eControlType get_control_type(); -template <> eControlType get_control_type(); -template <> eControlType get_control_type(); -template <> eControlType get_control_type(); - -template <> LLSD convert_to_llsd(const U32& in); -template <> LLSD convert_to_llsd(const LLVector3& in); -template <> LLSD convert_to_llsd(const LLVector3d& in); -template <> LLSD convert_to_llsd(const LLQuaternion& in); -template <> LLSD convert_to_llsd(const LLRect& in); -template <> LLSD convert_to_llsd(const LLColor4& in); -template <> LLSD convert_to_llsd(const LLColor3& in); - -template<> std::string convert_from_llsd(const LLSD& sd, eControlType type, std::string_view control_name); -template<> LLWString convert_from_llsd(const LLSD& sd, eControlType type, std::string_view control_name); -template<> LLVector3 convert_from_llsd(const LLSD& sd, eControlType type, std::string_view control_name); -template<> LLVector3d convert_from_llsd(const LLSD& sd, eControlType type, std::string_view control_name); -template<> LLQuaternion convert_from_llsd(const LLSD& sd, eControlType type, std::string_view control_name); -template<> LLRect convert_from_llsd(const LLSD& sd, eControlType type, std::string_view control_name); -template<> bool convert_from_llsd(const LLSD& sd, eControlType type, std::string_view control_name); -template<> S32 convert_from_llsd(const LLSD& sd, eControlType type, std::string_view control_name); -template<> F32 convert_from_llsd(const LLSD& sd, eControlType type, std::string_view control_name); -template<> U32 convert_from_llsd(const LLSD& sd, eControlType type, std::string_view control_name); -template<> LLColor3 convert_from_llsd(const LLSD& sd, eControlType type, std::string_view control_name); -template<> LLColor4 convert_from_llsd(const LLSD& sd, eControlType type, std::string_view control_name); -template<> LLSD convert_from_llsd(const LLSD& sd, eControlType type, std::string_view control_name); - -//#define TEST_CACHED_CONTROL 1 -#ifdef TEST_CACHED_CONTROL -void test_cached_control(); -#endif // TEST_CACHED_CONTROL - -#endif +/** + * @file llcontrol.h + * @brief A mechanism for storing "control state" for a program + * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLCONTROL_H +#define LL_LLCONTROL_H + +#include "llboost.h" +#include "llevent.h" +#include "llstring.h" +#include "llrect.h" +#include "llrefcount.h" +#include "llinstancetracker.h" + +#include + +// *NOTE: boost::visit_each<> generates warning 4675 on .net 2003 +// Disable the warning for the boost includes. +#if LL_WINDOWS +# if (_MSC_VER >= 1300 && _MSC_VER < 1400) +# pragma warning(push) +# pragma warning( disable : 4675 ) +# endif +#endif + +#include + +#if LL_WINDOWS + #pragma warning (push) + #pragma warning (disable : 4263) // boost::signals2::expired_slot::what() has const mismatch + #pragma warning (disable : 4264) +#endif +#include +#if LL_WINDOWS + #pragma warning (pop) +#endif + +#if LL_WINDOWS +# if (_MSC_VER >= 1300 && _MSC_VER < 1400) +# pragma warning(pop) +# endif +#endif + +class LLVector3; +class LLVector3d; +class LLQuaternion; +class LLColor4; +class LLColor3; + +// if this is changed, also modify mTypeString in llcontrol.h +typedef enum e_control_type +{ + TYPE_U32 = 0, + TYPE_S32, + TYPE_F32, + TYPE_BOOLEAN, + TYPE_STRING, + TYPE_VEC3, + TYPE_VEC3D, + TYPE_QUAT, + TYPE_RECT, + TYPE_COL4, + TYPE_COL3, + TYPE_LLSD, + TYPE_COUNT +} eControlType; + +class LLControlVariable : public LLRefCount +{ + LOG_CLASS(LLControlVariable); + + friend class LLControlGroup; + +public: + typedef boost::signals2::signal validate_signal_t; + typedef boost::signals2::signal commit_signal_t; + + enum ePersist + { + PERSIST_NO, // don't save this var + PERSIST_NONDFT, // save this var if differs from default + PERSIST_ALWAYS // save this var even if has default value + }; + +private: + std::string mName; + std::string mComment; + eControlType mType; + ePersist mPersist; + bool mHideFromSettingsEditor; + std::vector mValues; + + commit_signal_t mCommitSignal; + validate_signal_t mValidateSignal; + +public: + LLControlVariable(const std::string& name, eControlType type, + LLSD initial, const std::string& comment, + ePersist persist = PERSIST_NONDFT, bool hidefromsettingseditor = false); + + virtual ~LLControlVariable(); + + const std::string& getName() const { return mName; } + const std::string& getComment() const { return mComment; } + + eControlType type() { return mType; } + bool isType(eControlType tp) { return tp == mType; } + + void resetToDefault(bool fire_signal = false); + + commit_signal_t* getSignal() { return &mCommitSignal; } // shorthand for commit signal + commit_signal_t* getCommitSignal() { return &mCommitSignal; } + validate_signal_t* getValidateSignal() { return &mValidateSignal; } + + bool isDefault() { return (mValues.size() == 1); } + bool shouldSave(bool nondefault_only); + bool isPersisted() { return mPersist != PERSIST_NO; } + bool isHiddenFromSettingsEditor() { return mHideFromSettingsEditor; } + LLSD get() const { return getValue(); } + LLSD getValue() const { return mValues.back(); } + LLSD getDefault() const { return mValues.front(); } + LLSD getSaveValue() const; + + void set(const LLSD& val) { setValue(val); } + void setValue(const LLSD& value, bool saved_value = true); + void setDefaultValue(const LLSD& value); + void setPersist(ePersist); + void setHiddenFromSettingsEditor(bool hide); + void setComment(const std::string& comment); + +private: + void firePropertyChanged(const LLSD &pPreviousValue) + { + mCommitSignal(this, mValues.back(), pPreviousValue); + } + LLSD getComparableValue(const LLSD& value); + bool llsd_compare(const LLSD& a, const LLSD & b); +}; + +typedef LLPointer LLControlVariablePtr; + +//! Helper functions for converting between static types and LLControl values +template +eControlType get_control_type() +{ + LL_WARNS() << "Usupported control type: " << typeid(T).name() << "." << LL_ENDL; + return TYPE_COUNT; +} + +template +LLSD convert_to_llsd(const T& in) +{ + // default implementation + return LLSD(in); +} + +template +T convert_from_llsd(const LLSD& sd, eControlType type, std::string_view control_name) +{ + // needs specialization + return T(sd); +} + +//const U32 STRING_CACHE_SIZE = 10000; +class LLControlGroup : public LLInstanceTracker +{ + LOG_CLASS(LLControlGroup); + +protected: + typedef std::map ctrl_name_table_t; + ctrl_name_table_t mNameTable; + static const std::string mTypeString[TYPE_COUNT]; + +public: + static eControlType typeStringToEnum(const std::string& typestr); + static std::string typeEnumToString(eControlType typeenum); + + LLControlGroup(const std::string& name); + ~LLControlGroup(); + void cleanup(); + + LLControlVariablePtr getControl(std::string_view name); + + struct ApplyFunctor + { + virtual ~ApplyFunctor() {}; + virtual void apply(const std::string& name, LLControlVariable* control) = 0; + }; + 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* 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); + LLControlVariable* declareBOOL(const std::string& name, bool initial_val, const std::string& comment, LLControlVariable::ePersist persist = LLControlVariable::PERSIST_NONDFT); + LLControlVariable* declareString(const std::string& name, const std::string &initial_val, const std::string& comment, LLControlVariable::ePersist persist = LLControlVariable::PERSIST_NONDFT); + LLControlVariable* declareVec3(const std::string& name, const LLVector3 &initial_val,const std::string& comment, LLControlVariable::ePersist persist = LLControlVariable::PERSIST_NONDFT); + LLControlVariable* declareVec3d(const std::string& name, const LLVector3d &initial_val, const std::string& comment, LLControlVariable::ePersist persist = LLControlVariable::PERSIST_NONDFT); + LLControlVariable* declareQuat(const std::string& name, const LLQuaternion &initial_val, const std::string& comment, LLControlVariable::ePersist persist = LLControlVariable::PERSIST_NONDFT); + LLControlVariable* declareRect(const std::string& name, const LLRect &initial_val, const std::string& comment, LLControlVariable::ePersist persist = LLControlVariable::PERSIST_NONDFT); + LLControlVariable* declareColor4(const std::string& name, const LLColor4 &initial_val, const std::string& comment, LLControlVariable::ePersist persist = LLControlVariable::PERSIST_NONDFT); + LLControlVariable* declareColor3(const std::string& name, const LLColor3 &initial_val, const std::string& comment, LLControlVariable::ePersist persist = LLControlVariable::PERSIST_NONDFT); + LLControlVariable* declareLLSD(const std::string& name, const LLSD &initial_val, const std::string& comment, LLControlVariable::ePersist persist = LLControlVariable::PERSIST_NONDFT); + + std::string getString(std::string_view name); + std::string getText(std::string_view name); + bool getBOOL(std::string_view name); + S32 getS32(std::string_view name); + F32 getF32(std::string_view name); + U32 getU32(std::string_view name); + + LLWString getWString(std::string_view name); + LLVector3 getVector3(std::string_view name); + LLVector3d getVector3d(std::string_view name); + LLRect getRect(std::string_view name); + LLSD getLLSD(std::string_view name); + LLQuaternion getQuaternion(std::string_view name); + + LLColor4 getColor(std::string_view name); + LLColor4 getColor4(std::string_view name); + LLColor3 getColor3(std::string_view name); + + LLSD asLLSD(bool diffs_only); + + // generic getter + template T get(std::string_view name) + { + LL_PROFILE_ZONE_SCOPED_CATEGORY_LLSD; + LLControlVariable* control = getControl(name); + LLSD value; + eControlType type = TYPE_COUNT; + + if (control) + { + value = control->get(); + type = control->type(); + } + else + { + LL_WARNS() << "Control " << name << " not found." << LL_ENDL; + return T(); + } + return convert_from_llsd(value, type, name); + } + + void setBOOL(std::string_view name, bool val); + void setS32(std::string_view name, S32 val); + void setF32(std::string_view name, F32 val); + void setU32(std::string_view name, U32 val); + void setString(std::string_view name, const std::string& val); + void setVector3(std::string_view name, const LLVector3 &val); + void setVector3d(std::string_view name, const LLVector3d &val); + void setQuaternion(std::string_view name, const LLQuaternion &val); + void setRect(std::string_view name, const LLRect &val); + void setColor4(std::string_view name, const LLColor4 &val); + void setLLSD(std::string_view name, const LLSD& val); + + // type agnostic setter that takes LLSD + void setUntypedValue(std::string_view name, const LLSD& val); + + // generic setter + template void set(std::string_view name, const T& val) + { + LLControlVariable* control = getControl(name); + + if (control && control->isType(get_control_type())) + { + control->set(convert_to_llsd(val)); + } + else + { + LL_WARNS() << "Invalid control " << name << LL_ENDL; + } + } + + 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 loadFromFile(const std::string& filename, bool default_values = false, bool save_values = true); + void resetToDefaults(); + void incrCount(std::string_view name); + + bool mSettingsProfile; +}; + + +//! Publish/Subscribe object to interact with LLControlGroups. + +//! Use an LLCachedControl instance to connect to a LLControlVariable +//! without have to manually create and bind a listener to a local +//! object. +template +class LLControlCache : public LLRefCount, public LLInstanceTracker, std::string> +{ +public: + // This constructor will declare a control if it doesn't exist in the contol group + LLControlCache(LLControlGroup& group, + const std::string& name, + const T& default_value, + const std::string& comment) + : LLInstanceTracker, std::string >(name) + { + if(!group.controlExists(name)) + { + if(!declareTypedControl(group, name, default_value, comment)) + { + LL_ERRS() << "The control could not be created!!!" << LL_ENDL; + } + } + + bindToControl(group, name); + } + + LLControlCache(LLControlGroup& group, + const std::string& name) + : LLInstanceTracker, std::string >(name) + { + if(!group.controlExists(name)) + { + LL_ERRS() << "Control named " << name << "not found." << LL_ENDL; + } + + bindToControl(group, name); + } + + ~LLControlCache() + { + } + + const T& getValue() const { return mCachedValue; } + +private: + void bindToControl(LLControlGroup& group, const std::string& name) + { + LLControlVariablePtr controlp = group.getControl(name); + mType = controlp->type(); + mCachedValue = convert_from_llsd(controlp->get(), mType, name); + + // Add a listener to the controls signal... + // NOTE: All listeners connected to 0 group, for guaranty that variable handlers (gSavedSettings) call last + mConnection = controlp->getSignal()->connect(0, + boost::bind(&LLControlCache::handleValueChange, this, _2) + ); + mType = controlp->type(); + } + bool declareTypedControl(LLControlGroup& group, + const std::string& name, + const T& default_value, + const std::string& comment) + { + LLSD init_value; + eControlType type = get_control_type(); + init_value = convert_to_llsd(default_value); + if(type < TYPE_COUNT) + { + group.declareControl(name, type, init_value, comment, LLControlVariable::PERSIST_NO); + return true; + } + return false; + } + + bool handleValueChange(const LLSD& newvalue) + { + mCachedValue = convert_from_llsd(newvalue, mType, ""); + return true; + } + +private: + T mCachedValue; + eControlType mType; + boost::signals2::scoped_connection mConnection; +}; + +template +class LLCachedControl +{ +public: + LLCachedControl(LLControlGroup& group, + const std::string& name, + const T& default_value, + const std::string& comment = "Declared In Code") + { + mCachedControlPtr = LLControlCache::getInstance(name).get(); + if (! mCachedControlPtr) + { + mCachedControlPtr = new LLControlCache(group, name, default_value, comment); + } + } + + LLCachedControl(LLControlGroup& group, + const std::string& name) + { + mCachedControlPtr = LLControlCache::getInstance(name).get(); + if (! mCachedControlPtr) + { + mCachedControlPtr = new LLControlCache(group, name); + } + } + + operator const T&() const { return mCachedControlPtr->getValue(); } + operator boost::function () const { return boost::function(*this); } + const T& operator()() { return mCachedControlPtr->getValue(); } + +private: + LLPointer > mCachedControlPtr; +}; + +template <> eControlType get_control_type(); +template <> eControlType get_control_type(); +template <> eControlType get_control_type(); +template <> eControlType get_control_type(); +template <> eControlType get_control_type(); +template <> eControlType get_control_type(); +template <> eControlType get_control_type(); +template <> eControlType get_control_type(); +template <> eControlType get_control_type(); +template <> eControlType get_control_type(); +template <> eControlType get_control_type(); +template <> eControlType get_control_type(); + +template <> LLSD convert_to_llsd(const U32& in); +template <> LLSD convert_to_llsd(const LLVector3& in); +template <> LLSD convert_to_llsd(const LLVector3d& in); +template <> LLSD convert_to_llsd(const LLQuaternion& in); +template <> LLSD convert_to_llsd(const LLRect& in); +template <> LLSD convert_to_llsd(const LLColor4& in); +template <> LLSD convert_to_llsd(const LLColor3& in); + +template<> std::string convert_from_llsd(const LLSD& sd, eControlType type, std::string_view control_name); +template<> LLWString convert_from_llsd(const LLSD& sd, eControlType type, std::string_view control_name); +template<> LLVector3 convert_from_llsd(const LLSD& sd, eControlType type, std::string_view control_name); +template<> LLVector3d convert_from_llsd(const LLSD& sd, eControlType type, std::string_view control_name); +template<> LLQuaternion convert_from_llsd(const LLSD& sd, eControlType type, std::string_view control_name); +template<> LLRect convert_from_llsd(const LLSD& sd, eControlType type, std::string_view control_name); +template<> bool convert_from_llsd(const LLSD& sd, eControlType type, std::string_view control_name); +template<> S32 convert_from_llsd(const LLSD& sd, eControlType type, std::string_view control_name); +template<> F32 convert_from_llsd(const LLSD& sd, eControlType type, std::string_view control_name); +template<> U32 convert_from_llsd(const LLSD& sd, eControlType type, std::string_view control_name); +template<> LLColor3 convert_from_llsd(const LLSD& sd, eControlType type, std::string_view control_name); +template<> LLColor4 convert_from_llsd(const LLSD& sd, eControlType type, std::string_view control_name); +template<> LLSD convert_from_llsd(const LLSD& sd, eControlType type, std::string_view control_name); + +//#define TEST_CACHED_CONTROL 1 +#ifdef TEST_CACHED_CONTROL +void test_cached_control(); +#endif // TEST_CACHED_CONTROL + +#endif -- cgit v1.2.3