aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llxml/llcontrol.h
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:59 -0500
committerJacek Antonelli2008-08-15 23:45:59 -0500
commit6e91a9cc3d5a610198cf526a76e2ab642f10ecd7 (patch)
treeb023869f9daa7f61ea3ab27112d37524bdd88de4 /linden/indra/llxml/llcontrol.h
parentSecond Life viewer sources 1.20.12 (diff)
downloadmeta-impy-6e91a9cc3d5a610198cf526a76e2ab642f10ecd7.zip
meta-impy-6e91a9cc3d5a610198cf526a76e2ab642f10ecd7.tar.gz
meta-impy-6e91a9cc3d5a610198cf526a76e2ab642f10ecd7.tar.bz2
meta-impy-6e91a9cc3d5a610198cf526a76e2ab642f10ecd7.tar.xz
Second Life viewer sources 1.20.13
Diffstat (limited to 'linden/indra/llxml/llcontrol.h')
-rw-r--r--linden/indra/llxml/llcontrol.h30
1 files changed, 19 insertions, 11 deletions
diff --git a/linden/indra/llxml/llcontrol.h b/linden/indra/llxml/llcontrol.h
index 91545ce..2500ae0 100644
--- a/linden/indra/llxml/llcontrol.h
+++ b/linden/indra/llxml/llcontrol.h
@@ -83,7 +83,7 @@ typedef enum e_control_type
83 TYPE_COUNT 83 TYPE_COUNT
84} eControlType; 84} eControlType;
85 85
86class LLControlVariable 86class LLControlVariable : public LLRefCount
87{ 87{
88 friend class LLControlGroup; 88 friend class LLControlGroup;
89 typedef boost::signal<void(const LLSD&)> signal_t; 89 typedef boost::signal<void(const LLSD&)> signal_t;
@@ -92,7 +92,7 @@ private:
92 LLString mName; 92 LLString mName;
93 LLString mComment; 93 LLString mComment;
94 eControlType mType; 94 eControlType mType;
95 BOOL mPersist; 95 bool mPersist;
96 std::vector<LLSD> mValues; 96 std::vector<LLSD> mValues;
97 97
98 signal_t mSignal; 98 signal_t mSignal;
@@ -100,7 +100,7 @@ private:
100public: 100public:
101 LLControlVariable(const LLString& name, eControlType type, 101 LLControlVariable(const LLString& name, eControlType type,
102 LLSD initial, const LLString& comment, 102 LLSD initial, const LLString& comment,
103 BOOL persist = TRUE); 103 bool persist = true);
104 104
105 virtual ~LLControlVariable(); 105 virtual ~LLControlVariable();
106 106
@@ -108,33 +108,41 @@ public:
108 const LLString& getComment() const { return mComment; } 108 const LLString& getComment() const { return mComment; }
109 109
110 eControlType type() { return mType; } 110 eControlType type() { return mType; }
111 BOOL isType(eControlType tp) { return tp == mType; } 111 bool isType(eControlType tp) { return tp == mType; }
112 112
113 void resetToDefault(bool fire_signal = TRUE); 113 void resetToDefault(bool fire_signal = false);
114 114
115 signal_t* getSignal() { return &mSignal; } 115 signal_t* getSignal() { return &mSignal; }
116 116
117 bool isDefault() { return (mValues.size() == 1); } 117 bool isDefault() { return (mValues.size() == 1); }
118 bool isSaveValueDefault(); 118 bool isSaveValueDefault();
119 bool isPersisted() { return mPersist; } 119 bool isPersisted() { return mPersist; }
120 void set(const LLSD& val) { setValue(val); }
121 LLSD get() const { return getValue(); } 120 LLSD get() const { return getValue(); }
122 LLSD getDefault() const { return mValues.front(); }
123 LLSD getValue() const { return mValues.back(); } 121 LLSD getValue() const { return mValues.back(); }
122 LLSD getDefault() const { return mValues.front(); }
124 LLSD getSaveValue() const; 123 LLSD getSaveValue() const;
124
125 void set(const LLSD& val) { setValue(val); }
125 void setValue(const LLSD& value, bool saved_value = TRUE); 126 void setValue(const LLSD& value, bool saved_value = TRUE);
127 void setDefaultValue(const LLSD& value);
128 void setPersist(bool state);
129 void setComment(const std::string& comment);
130
126 void firePropertyChanged() 131 void firePropertyChanged()
127 { 132 {
128 mSignal(mValues.back()); 133 mSignal(mValues.back());
129 } 134 }
130 bool llsd_compare(const LLSD& a, const LLSD& b); 135private:
136 LLSD getComparableValue(const LLSD& value);
137 bool llsd_compare(const LLSD& a, const LLSD & b);
138
131}; 139};
132 140
133//const U32 STRING_CACHE_SIZE = 10000; 141//const U32 STRING_CACHE_SIZE = 10000;
134class LLControlGroup 142class LLControlGroup
135{ 143{
136protected: 144protected:
137 typedef std::map<LLString, LLControlVariable* > ctrl_name_table_t; 145 typedef std::map<LLString, LLPointer<LLControlVariable> > ctrl_name_table_t;
138 ctrl_name_table_t mNameTable; 146 ctrl_name_table_t mNameTable;
139 std::set<LLString> mWarnings; 147 std::set<LLString> mWarnings;
140 LLString mTypeString[TYPE_COUNT]; 148 LLString mTypeString[TYPE_COUNT];
@@ -146,7 +154,7 @@ public:
146 ~LLControlGroup(); 154 ~LLControlGroup();
147 void cleanup(); 155 void cleanup();
148 156
149 LLControlVariable* getControl(const LLString& name); 157 LLPointer<LLControlVariable> getControl(const LLString& name);
150 158
151 struct ApplyFunctor 159 struct ApplyFunctor
152 { 160 {
@@ -213,7 +221,7 @@ public:
213 // as the given type. 221 // as the given type.
214 U32 loadFromFileLegacy(const LLString& filename, BOOL require_declaration = TRUE, eControlType declare_as = TYPE_STRING); 222 U32 loadFromFileLegacy(const LLString& filename, BOOL require_declaration = TRUE, eControlType declare_as = TYPE_STRING);
215 U32 saveToFile(const LLString& filename, BOOL nondefault_only); 223 U32 saveToFile(const LLString& filename, BOOL nondefault_only);
216 U32 loadFromFile(const LLString& filename); 224 U32 loadFromFile(const LLString& filename, bool default_values = false);
217 void resetToDefaults(); 225 void resetToDefaults();
218 226
219 227