diff options
author | Richard Nelson <richard@lindenlab.com> | 2011-10-03 18:52:55 -0700 |
---|---|---|
committer | Richard Nelson <richard@lindenlab.com> | 2011-10-03 18:52:55 -0700 |
commit | ca8bac23949c361eea2d33198a8211ed1d8f15c3 (patch) | |
tree | 47dadd0308513c7302c5c5193b66436457d7f7b1 /indra/llxuixml | |
parent | daae211fe3e2d1da3623951b1166473c53ce5808 (diff) | |
parent | edacb7b3363dca6cd28a4ff7ea27154d6a30702f (diff) |
Automated merge with ssh://hg.lindenlab.com/richard/viewer-experience-fui
Diffstat (limited to 'indra/llxuixml')
-rw-r--r-- | indra/llxuixml/llinitparam.h | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/indra/llxuixml/llinitparam.h b/indra/llxuixml/llinitparam.h index f2273ce6c8..0f17fb61da 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 (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,11 +1020,16 @@ 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) + { + std::string calculated_key = typed_param.calcValueName(typed_param.getValue()); + if (!parser.writeValue(calculated_key, name_stack)) { break; } } + } else { if(!parser.writeValue(key, name_stack)) |