summaryrefslogtreecommitdiff
path: root/indra/llxuixml
diff options
context:
space:
mode:
authorDon Kjer <don@lindenlab.com>2011-05-17 19:21:55 +0000
committerDon Kjer <don@lindenlab.com>2011-05-17 19:21:55 +0000
commitae8ed3fc2d4a7dda92ad8fdb34bc559478eb9177 (patch)
tree64cd5d3328dbb56b03a03cf873a613005d0394dc /indra/llxuixml
parentc62ef53863bd01cb96de55e0250c8a8193b6c72b (diff)
parent113f532ee57eeeca4dc7eb6ca05f923f1f3543d3 (diff)
Merge with viewer-development
Diffstat (limited to 'indra/llxuixml')
-rw-r--r--indra/llxuixml/llinitparam.cpp4
-rw-r--r--indra/llxuixml/llinitparam.h64
-rw-r--r--indra/llxuixml/lltrans.cpp1
-rw-r--r--indra/llxuixml/lltrans.h8
-rw-r--r--indra/llxuixml/llxuiparser.h3
5 files changed, 58 insertions, 22 deletions
diff --git a/indra/llxuixml/llinitparam.cpp b/indra/llxuixml/llinitparam.cpp
index 3c4eb70a5d..b3312798dd 100644
--- a/indra/llxuixml/llinitparam.cpp
+++ b/indra/llxuixml/llinitparam.cpp
@@ -375,7 +375,7 @@ namespace LLInitParam
//static
void BaseBlock::addParam(BlockDescriptor& block_data, const ParamDescriptorPtr in_param, const char* char_name)
{
- // create a copy of the paramdescriptor in allparams
+ // create a copy of the param descriptor in mAllParams
// so other data structures can store a pointer to it
block_data.mAllParams.push_back(in_param);
ParamDescriptorPtr param(block_data.mAllParams.back());
@@ -469,7 +469,7 @@ namespace LLInitParam
// take all provided params from other and apply to self
// NOTE: this requires that "other" is of the same derived type as this
- bool BaseBlock::merge(BlockDescriptor& block_data, const BaseBlock& other, bool overwrite)
+ bool BaseBlock::mergeBlock(BlockDescriptor& block_data, const BaseBlock& other, bool overwrite)
{
bool some_param_changed = false;
BlockDescriptor::all_params_list_t::const_iterator end_it = block_data.mAllParams.end();
diff --git a/indra/llxuixml/llinitparam.h b/indra/llxuixml/llinitparam.h
index 858f8405b4..a853999e94 100644
--- a/indra/llxuixml/llinitparam.h
+++ b/indra/llxuixml/llinitparam.h
@@ -476,8 +476,12 @@ namespace LLInitParam
void init(BlockDescriptor& descriptor, BlockDescriptor& base_descriptor, size_t block_size);
+ bool mergeBlockParam(bool param_provided, BlockDescriptor& block_data, const BaseBlock& other, bool overwrite)
+ {
+ return mergeBlock(block_data, other, overwrite);
+ }
// take all provided params from other and apply to self
- bool merge(BlockDescriptor& block_data, const BaseBlock& other, bool overwrite);
+ bool mergeBlock(BlockDescriptor& block_data, const BaseBlock& other, bool overwrite);
// can be updated in getters
mutable S32 mChangeVersion;
@@ -896,12 +900,14 @@ namespace LLInitParam
const self_t& src_typed_param = static_cast<const self_t&>(src);
self_t& dst_typed_param = static_cast<self_t&>(dst);
- if (src_typed_param.isProvided()
- && (overwrite || !dst_typed_param.isProvided()))
+ if (src_typed_param.anyProvided())
{
- if (dst_typed_param.merge(param_value_t::selfBlockDescriptor(), src_typed_param, overwrite))
+ bool param_provided = src_typed_param.isProvided() && (overwrite || !dst_typed_param.isProvided());
+ if (dst_typed_param.mergeBlockParam(param_provided, param_value_t::selfBlockDescriptor(), src_typed_param, overwrite))
{
dst_typed_param.clearValueName();
+ dst_typed_param.setProvided(true);
+ dst_typed_param.enclosingBlock().paramChanged(dst_typed_param, true);
return true;
}
}
@@ -1082,6 +1088,12 @@ namespace LLInitParam
std::copy(dst_typed_param.begin(), dst_typed_param.end(), std::back_inserter(new_values));
std::swap(dst_typed_param.mValues, new_values);
}
+
+ if (src_typed_param.begin() != src_typed_param.end())
+ {
+ dst_typed_param.setProvided(true);
+ dst_typed_param.enclosingBlock().paramChanged(dst_typed_param, true);
+ }
return true;
}
@@ -1282,6 +1294,13 @@ namespace LLInitParam
std::copy(dst_typed_param.begin(), dst_typed_param.end(), std::back_inserter(new_values));
std::swap(dst_typed_param.mValues, new_values);
}
+
+ if (src_typed_param.begin() != src_typed_param.end())
+ {
+ dst_typed_param.setProvided(true);
+ dst_typed_param.enclosingBlock().paramChanged(dst_typed_param, true);
+ }
+
return true;
}
@@ -1301,27 +1320,31 @@ namespace LLInitParam
// take all provided params from other and apply to self
bool overwriteFrom(const self_t& other)
{
- return merge(selfBlockDescriptor(), other, true);
+ return mergeBlock(selfBlockDescriptor(), other, true);
}
// take all provided params that are not already provided, and apply to self
bool fillFrom(const self_t& other)
{
- return merge(selfBlockDescriptor(), other, false);
+ return mergeBlock(selfBlockDescriptor(), other, false);
}
- // merge with other block
- bool merge(BlockDescriptor& block_data, const self_t& other, bool overwrite)
+ bool mergeBlockParam(bool param_provided, BlockDescriptor& block_data, const self_t& other, bool overwrite)
{
- // only merge a choice if we are overwriting with other's contents
- if (overwrite)
+ if (param_provided)
{
- mCurChoice = other.mCurChoice;
- return BaseBlock::merge(selfBlockDescriptor(), other, overwrite);
+ return mergeBlock(block_data, other, overwrite);
}
return false;
}
+ // merge with other block
+ bool mergeBlock(BlockDescriptor& block_data, const self_t& other, bool overwrite)
+ {
+ mCurChoice = other.mCurChoice;
+ return BaseBlock::mergeBlock(selfBlockDescriptor(), other, overwrite);
+ }
+
// clear out old choice when param has changed
/*virtual*/ void paramChanged(const Param& changed_param, bool user_provided)
{
@@ -1445,13 +1468,13 @@ namespace LLInitParam
// take all provided params from other and apply to self
bool overwriteFrom(const self_t& other)
{
- return static_cast<DERIVED_BLOCK*>(this)->merge(selfBlockDescriptor(), other, true);
+ return static_cast<DERIVED_BLOCK*>(this)->mergeBlock(selfBlockDescriptor(), other, true);
}
// take all provided params that are not already provided, and apply to self
bool fillFrom(const self_t& other)
{
- return static_cast<DERIVED_BLOCK*>(this)->merge(selfBlockDescriptor(), other, false);
+ return static_cast<DERIVED_BLOCK*>(this)->mergeBlock(selfBlockDescriptor(), other, false);
}
virtual const BlockDescriptor& mostDerivedBlockDescriptor() const { return selfBlockDescriptor(); }
@@ -1862,7 +1885,16 @@ namespace LLInitParam
mValue = value;
}
- bool merge(BlockDescriptor& block_data, const BaseBlock& other, bool overwrite)
+ bool mergeBlockParam(bool param_provided, BlockDescriptor& block_data, const BaseBlock& other, bool overwrite)
+ {
+ if (param_provided)
+ {
+ return mergeBlock(block_data, other, overwrite);
+ }
+ return false;
+ }
+
+ bool mergeBlock(BlockDescriptor& block_data, const BaseBlock& other, bool overwrite)
{
const derived_t& src_typed_param = static_cast<const derived_t&>(other);
@@ -1875,7 +1907,7 @@ namespace LLInitParam
else
{
// merge individual parameters into destination
- return block_t::merge(block_t::selfBlockDescriptor(), src_typed_param, overwrite);
+ return block_t::mergeBlock(block_t::selfBlockDescriptor(), src_typed_param, overwrite);
}
}
diff --git a/indra/llxuixml/lltrans.cpp b/indra/llxuixml/lltrans.cpp
index e13d73c640..b403b86048 100644
--- a/indra/llxuixml/lltrans.cpp
+++ b/indra/llxuixml/lltrans.cpp
@@ -30,6 +30,7 @@
#include "llfasttimer.h" // for call count statistics
#include "llxuiparser.h"
+#include "llxmlnode.h"
#include <map>
diff --git a/indra/llxuixml/lltrans.h b/indra/llxuixml/lltrans.h
index 5b127b53cf..b7091f77e8 100644
--- a/indra/llxuixml/lltrans.h
+++ b/indra/llxuixml/lltrans.h
@@ -29,8 +29,10 @@
#include <map>
+#include "llpointer.h"
#include "llstring.h"
-#include "llxmlnode.h"
+
+class LLXMLNode;
/**
* @brief String template loaded from strings.xml
@@ -61,9 +63,9 @@ public:
* @param default_args Set of strings (expected to be in the file) to use as default replacement args, e.g. "SECOND_LIFE"
* @returns true if the file was parsed successfully, true if something went wrong
*/
- static bool parseStrings(LLXMLNodePtr& root, const std::set<std::string>& default_args);
+ static bool parseStrings(LLPointer<LLXMLNode> & root, const std::set<std::string>& default_args);
- static bool parseLanguageStrings(LLXMLNodePtr &root);
+ static bool parseLanguageStrings(LLPointer<LLXMLNode> & root);
/**
* @brief Returns a translated string
diff --git a/indra/llxuixml/llxuiparser.h b/indra/llxuixml/llxuiparser.h
index 7a748d8aea..0c38c4da93 100644
--- a/indra/llxuixml/llxuiparser.h
+++ b/indra/llxuixml/llxuiparser.h
@@ -28,7 +28,6 @@
#define LLXUIPARSER_H
#include "llinitparam.h"
-#include "llfasttimer.h"
#include "llregistry.h"
#include "llpointer.h"
@@ -95,6 +94,7 @@ public:
};
+class LLXUIParserImpl;
class LLXUIParser : public LLInitParam::Parser
{
@@ -176,6 +176,7 @@ private:
// ordering of child elements from base file to localized diff file. Then we can use a pair
// of coroutines to perform matching of xml nodes during parsing. Not sure if the overhead
// of coroutines would offset the gain from SAX parsing
+class LLSimpleXUIParserImpl;
class LLSimpleXUIParser : public LLInitParam::Parser
{