summaryrefslogtreecommitdiff
path: root/indra/llxuixml/llinitparam.h
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2011-10-05 11:49:12 -0700
committerMerov Linden <merov@lindenlab.com>2011-10-05 11:49:12 -0700
commitfb7af4d0010f9d14cb5464bed83d9e022dbe0d1a (patch)
tree06ad01cfdcb57366bcee48cdb0811f6982417d11 /indra/llxuixml/llinitparam.h
parent3b3a13707309eb4b7d6ed5d309081c99e5f28eca (diff)
parent5d08d1e3bd2de3e0e66ef836ada714fce98733b4 (diff)
EXP-1202 : pull from richard/viewer-experience-fui
Diffstat (limited to 'indra/llxuixml/llinitparam.h')
-rw-r--r--indra/llxuixml/llinitparam.h37
1 files changed, 30 insertions, 7 deletions
diff --git a/indra/llxuixml/llinitparam.h b/indra/llxuixml/llinitparam.h
index f2273ce6c8..1a131d15a3 100644
--- a/indra/llxuixml/llinitparam.h
+++ b/indra/llxuixml/llinitparam.h
@@ -87,6 +87,7 @@ namespace LLInitParam
void setValueName(const std::string& key) {}
std::string getValueName() const { return ""; }
+ std::string calcValueName(const T& value) const { return ""; }
void clearValueName() const {}
static bool getValueFromName(const std::string& name, T& value)
@@ -124,6 +125,22 @@ namespace LLInitParam
return mValueName;
}
+ std::string calcValueName(const T& value) const
+ {
+ value_name_map_t* map = getValueNames();
+ for (typename value_name_map_t::iterator it = map->begin(), end_it = map->end();
+ it != end_it;
+ ++it)
+ {
+ if (ParamCompare<T>::equals(it->second, value))
+ {
+ return it->first;
+ }
+ }
+
+ return "";
+ }
+
void clearValueName() const
{
mValueName.clear();
@@ -709,10 +726,7 @@ namespace LLInitParam
{
if (!diff_param || !ParamCompare<std::string>::equals(static_cast<const self_t*>(diff_param)->getValueName(), key))
{
- if (!parser.writeValue(key, name_stack))
- {
- return;
- }
+ parser.writeValue(key, name_stack);
}
}
// then try to serialize value directly
@@ -720,7 +734,11 @@ namespace LLInitParam
{
if (!parser.writeValue(typed_param.getValue(), name_stack))
{
- return;
+ std::string calculated_key = typed_param.calcValueName(typed_param.getValue());
+ if (!diff_param || !ParamCompare<std::string>::equals(static_cast<const self_t*>(diff_param)->getValueName(), calculated_key))
+ {
+ parser.writeValue(calculated_key, name_stack);
+ }
}
}
}
@@ -1002,9 +1020,14 @@ namespace LLInitParam
if(key.empty())
// not parsed via name values, write out value directly
{
- if (!parser.writeValue(*it, name_stack))
+ bool value_written = parser.writeValue(*it, name_stack);
+ if (!value_written)
{
- break;
+ std::string calculated_key = typed_param.calcValueName(typed_param.getValue());
+ if (!parser.writeValue(calculated_key, name_stack))
+ {
+ break;
+ }
}
}
else