From b766466b3013e39831bcfcaef5d1089c07202afb Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Mon, 26 Feb 2018 09:27:14 -0800 Subject: Added settings inventory object with subtype --- indra/llinventory/llsettingsbase.h | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) (limited to 'indra/llinventory/llsettingsbase.h') diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index 420bcb9943..c7ed9e9e21 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -42,6 +42,8 @@ #include "v4color.h" #include "v3color.h" +#include "llinventorysettings.h" + class LLSettingsBase : public std::enable_shared_from_this, private boost::noncopyable @@ -49,6 +51,8 @@ class LLSettingsBase : friend class LLEnvironment; friend class LLSettingsDay; + friend std::ostream &operator <<(std::ostream& os, LLSettingsBase &settings); + public: static const std::string SETTING_ID; static const std::string SETTING_NAME; @@ -64,6 +68,8 @@ public: //--------------------------------------------------------------------- virtual std::string getSettingType() const = 0; + virtual LLSettingsType getSettingTypeValue() const = 0; + //--------------------------------------------------------------------- // Settings status inline bool hasSetting(const std::string ¶m) const { return mSettings.has(param); } @@ -143,27 +149,28 @@ public: // Note this method is marked const but may modify the settings object. // (note the internal const cast). This is so that it may be called without // special consideration from getters. - inline void update() const + inline void update() const { if (!mDirty) return; (const_cast(this))->updateSettings(); } - virtual void blend(const ptr_t &end, F64 blendf) = 0; + virtual void blend(const ptr_t &end, F64 blendf) = 0; - virtual bool validate(); + virtual bool validate(); class Validator { public: typedef boost::function verify_pr; - Validator(std::string name, bool required, LLSD::Type type, verify_pr verify = verify_pr()) : + Validator(std::string name, bool required, LLSD::Type type, verify_pr verify = verify_pr(), LLSD defval = LLSD()) : mName(name), mRequired(required), mType(type), - mVerify(verify) + mVerify(verify), + mDefault(defval) { } std::string getName() const { return mName; } @@ -187,6 +194,7 @@ public: bool mRequired; LLSD::Type mType; verify_pr mVerify; + LLSD mDefault; }; typedef std::vector validation_list_t; @@ -223,15 +231,16 @@ protected: virtual parammapping_t getParameterMap() const { return parammapping_t(); } - LLSD mSettings; - bool mIsValid; + LLSD mSettings; + bool mIsValid; + LLAssetID mAssetID; - LLSD cloneSettings() const; + LLSD cloneSettings() const; private: - bool mDirty; + bool mDirty; - LLSD combineSDMaps(const LLSD &first, const LLSD &other) const; + LLSD combineSDMaps(const LLSD &first, const LLSD &other) const; }; -- cgit v1.2.3