summaryrefslogtreecommitdiff
path: root/indra/newview/llenvmanager.h
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2017-11-29 14:47:09 -0500
committerNat Goodspeed <nat@lindenlab.com>2017-11-29 14:47:09 -0500
commite3a2c5e3217ae74a0277f2e6d4e1e708fe398a1c (patch)
treef912ed486a465f5cc0aee5c73c9cb70c195e8c4d /indra/newview/llenvmanager.h
parent1693ccba58eef676df1f91e50627545ac35bb819 (diff)
parentbf98e092e53ed228b3cb50fe816058c5a7817329 (diff)
DRTVWR-418: Merge from latest viewer-release
Diffstat (limited to 'indra/newview/llenvmanager.h')
-rw-r--r--indra/newview/llenvmanager.h81
1 files changed, 81 insertions, 0 deletions
diff --git a/indra/newview/llenvmanager.h b/indra/newview/llenvmanager.h
index 6a0a267f4e..54bbf85e86 100644
--- a/indra/newview/llenvmanager.h
+++ b/indra/newview/llenvmanager.h
@@ -48,6 +48,87 @@ public:
} EScope;
};
+struct LLWLParamKey : LLEnvKey
+{
+public:
+ // scope and source of a param set (WL sky preset)
+ std::string name;
+ EScope scope;
+
+ // for conversion from LLSD
+ static const int NAME_IDX = 0;
+ static const int SCOPE_IDX = 1;
+
+ inline LLWLParamKey(const std::string& n, EScope s)
+ : name(n), scope(s)
+ {
+ }
+
+ inline LLWLParamKey(LLSD llsd)
+ : name(llsd[NAME_IDX].asString()), scope(EScope(llsd[SCOPE_IDX].asInteger()))
+ {
+ }
+
+ inline LLWLParamKey() // NOT really valid, just so std::maps can return a default of some sort
+ : name(""), scope(SCOPE_LOCAL)
+ {
+ }
+
+ inline LLWLParamKey(std::string& stringVal)
+ {
+ size_t len = stringVal.length();
+ if (len > 0)
+ {
+ name = stringVal.substr(0, len - 1);
+ scope = (EScope) atoi(stringVal.substr(len - 1, len).c_str());
+ }
+ }
+
+ inline std::string toStringVal() const
+ {
+ std::stringstream str;
+ str << name << scope;
+ return str.str();
+ }
+
+ inline LLSD toLLSD() const
+ {
+ LLSD llsd = LLSD::emptyArray();
+ llsd.append(LLSD(name));
+ llsd.append(LLSD(scope));
+ return llsd;
+ }
+
+ inline void fromLLSD(const LLSD& llsd)
+ {
+ name = llsd[NAME_IDX].asString();
+ scope = EScope(llsd[SCOPE_IDX].asInteger());
+ }
+
+ inline bool operator <(const LLWLParamKey other) const
+ {
+ if (name < other.name)
+ {
+ return true;
+ }
+ else if (name > other.name)
+ {
+ return false;
+ }
+ else
+ {
+ return scope < other.scope;
+ }
+ }
+
+ inline bool operator ==(const LLWLParamKey other) const
+ {
+ return (name == other.name) && (scope == other.scope);
+ }
+
+ std::string toString() const;
+};
+
class LLEnvironmentSettings
{
public: