summaryrefslogtreecommitdiff
path: root/indra/llxuixml
diff options
context:
space:
mode:
authorRichard Linden <none@none>2010-09-22 14:48:18 -0700
committerRichard Linden <none@none>2010-09-22 14:48:18 -0700
commit0edb695ea86d7997ae3952e155ed5b4922c799f8 (patch)
tree795467705b5289f973ed937efa014900486f66b1 /indra/llxuixml
parent325f16d0b4c8fc9de694121d770a4931a7b98529 (diff)
instead of exposing mutable container in LLInitParam::Multiple, just expose access functions, begin(), end(), etc.
this allows mutation of param block contents, without being able to change number of elements
Diffstat (limited to 'indra/llxuixml')
-rw-r--r--indra/llxuixml/llinitparam.h36
-rw-r--r--indra/llxuixml/lltrans.cpp8
2 files changed, 27 insertions, 17 deletions
diff --git a/indra/llxuixml/llinitparam.h b/indra/llxuixml/llinitparam.h
index 24ce891880..83b27f5396 100644
--- a/indra/llxuixml/llinitparam.h
+++ b/indra/llxuixml/llinitparam.h
@@ -958,7 +958,7 @@ namespace LLInitParam
const self_t& typed_param = static_cast<const self_t&>(param);
if (!typed_param.isProvided() || name_stack.empty()) return;
- typename container_t::const_iterator it = typed_param.mValues.begin();
+ typename const_iterator it = typed_param.mValues.begin();
for (typename std::vector<key_cache_t>::const_iterator key_it = typed_param.mCachedKeys.begin();
it != typed_param.mValues.end();
++key_it, ++it)
@@ -1025,9 +1025,15 @@ namespace LLInitParam
// implicit conversion
operator value_assignment_t() const { return self_t::get(); }
- // explicit conversion
- value_assignment_t operator()() const { return get(); }
- container_t& operator()() { return mValues; }
+
+ typedef typename container_t::iterator iterator;
+ typedef typename container_t::const_iterator const_iterator;
+ iterator begin() { return mValues.begin(); }
+ iterator end() { return mValues.end(); }
+ const_iterator begin() const { return mValues.begin(); }
+ const_iterator end() const { return mValues.end(); }
+ bool empty() const { return mValues.empty(); }
+ size_t size() const { return mValues.size(); }
U32 numValidElements() const
{
@@ -1160,7 +1166,7 @@ namespace LLInitParam
const self_t& typed_param = static_cast<const self_t&>(param);
if (!typed_param.isProvided() || name_stack.empty()) return;
- typename container_t::const_iterator it = typed_param.mValues.begin();
+ const_iterator it = typed_param.mValues.begin();
for (typename std::vector<Data>::const_iterator key_it = typed_param.mCachedKeys.begin();
it != typed_param.mValues.end();
++key_it, ++it)
@@ -1224,14 +1230,20 @@ namespace LLInitParam
// implicit conversion
operator value_assignment_t() const { return self_t::get(); }
- // explicit conversion
- value_assignment_t operator()() const { return get(); }
- container_t& operator()() { return mValues; }
+
+ typedef typename container_t::iterator iterator;
+ typedef typename container_t::const_iterator const_iterator;
+ iterator begin() { return mValues.begin(); }
+ iterator end() { return mValues.end(); }
+ const_iterator begin() const { return mValues.begin(); }
+ const_iterator end() const { return mValues.end(); }
+ bool empty() const { return mValues.empty(); }
+ size_t size() const { return mValues.size(); }
U32 numValidElements() const
{
U32 count = 0;
- for (typename container_t::const_iterator it = mValues.begin();
+ for (const_iterator it = mValues.begin();
it != mValues.end();
++it)
{
@@ -1518,15 +1530,13 @@ namespace LLInitParam
typedef Multiple<T, RANGE, NAME_VALUE_LOOKUP> self_t;
typedef typename super_t::container_t container_t;
typedef typename super_t::value_assignment_t value_assignment_t;
- typedef typename container_t::iterator iterator;
- typedef typename container_t::const_iterator const_iterator;
+ typedef typename super_t::iterator iterator;
+ typedef typename super_t::const_iterator const_iterator;
explicit Multiple(const char* name = "", value_assignment_t val = DefaultInitializer<container_t>::get())
: super_t(DERIVED_BLOCK::selfBlockDescriptor(), name, val, &validate, RANGE::minCount(), RANGE::maxCount())
{}
- using super_t::operator();
-
Multiple& operator=(value_assignment_t val)
{
set(val);
diff --git a/indra/llxuixml/lltrans.cpp b/indra/llxuixml/lltrans.cpp
index bf56461bac..11127a53f5 100644
--- a/indra/llxuixml/lltrans.cpp
+++ b/indra/llxuixml/lltrans.cpp
@@ -78,8 +78,8 @@ bool LLTrans::parseStrings(LLXMLNodePtr &root, const std::set<std::string>& defa
sStringTemplates.clear();
sDefaultArgs.clear();
- for(LLInitParam::ParamIterator<StringDef>::const_iterator it = string_table.strings().begin();
- it != string_table.strings().end();
+ for(LLInitParam::ParamIterator<StringDef>::const_iterator it = string_table.strings.begin();
+ it != string_table.strings.end();
++it)
{
LLTransTemplate xml_template(it->name, it->value);
@@ -119,8 +119,8 @@ bool LLTrans::parseLanguageStrings(LLXMLNodePtr &root)
return false;
}
- for(LLInitParam::ParamIterator<StringDef>::const_iterator it = string_table.strings().begin();
- it != string_table.strings().end();
+ for(LLInitParam::ParamIterator<StringDef>::const_iterator it = string_table.strings.begin();
+ it != string_table.strings.end();
++it)
{
// share the same map with parseStrings() so we can search the strings using the same getString() function.- angela