diff options
author | Richard Nelson <none@none> | 2010-08-24 11:44:28 -0700 |
---|---|---|
committer | Richard Nelson <none@none> | 2010-08-24 11:44:28 -0700 |
commit | 0daa627db4f1bba2f69ec717426b26593674d14c (patch) | |
tree | 7ebd93c5b5a9de5590cc67af5685fb34b7b78fb1 /indra/llxuixml | |
parent | 77c42fc77ead297be3ea673309699edd15f70441 (diff) |
removed LLLayoutStack::fromXML custom xml parsing
Diffstat (limited to 'indra/llxuixml')
-rw-r--r-- | indra/llxuixml/llinitparam.cpp | 44 | ||||
-rw-r--r-- | indra/llxuixml/llinitparam.h | 6 | ||||
-rw-r--r-- | indra/llxuixml/llxuiparser.cpp | 17 | ||||
-rw-r--r-- | indra/llxuixml/llxuiparser.h | 3 |
4 files changed, 22 insertions, 48 deletions
diff --git a/indra/llxuixml/llinitparam.cpp b/indra/llxuixml/llinitparam.cpp index 99191d2dbe..922a91b609 100644 --- a/indra/llxuixml/llinitparam.cpp +++ b/indra/llxuixml/llinitparam.cpp @@ -74,7 +74,6 @@ namespace LLInitParam void BlockDescriptor::aggregateBlockData(BlockDescriptor& src_block_data) { mNamedParams.insert(src_block_data.mNamedParams.begin(), src_block_data.mNamedParams.end()); - mSynonyms.insert(src_block_data.mSynonyms.begin(), src_block_data.mSynonyms.end()); std::copy(src_block_data.mUnnamedParams.begin(), src_block_data.mUnnamedParams.end(), std::back_inserter(mUnnamedParams)); std::copy(src_block_data.mValidationList.begin(), src_block_data.mValidationList.end(), std::back_inserter(mValidationList)); std::copy(src_block_data.mAllParams.begin(), src_block_data.mAllParams.end(), std::back_inserter(mAllParams)); @@ -277,22 +276,6 @@ namespace LLInitParam } } - for(BlockDescriptor::param_map_t::const_iterator it = block_data.mSynonyms.begin(); - it != block_data.mSynonyms.end(); - ++it) - { - param_handle_t param_handle = it->second->mParamHandle; - const Param* param = getParamFromHandle(param_handle); - ParamDescriptor::inspect_func_t inspect_func = it->second->mInspectFunc; - if (inspect_func) - { - // use existing serial number for param - name_stack.push_back(std::make_pair(it->first, it->second->mGeneration)); - inspect_func(*param, parser, name_stack, it->second->mMinCount, it->second->mMaxCount); - name_stack.pop_back(); - } - } - return true; } @@ -314,22 +297,9 @@ namespace LLInitParam // find pointer to member parameter from offset table paramp = getParamFromHandle(found_it->second->mParamHandle); deserialize_func = found_it->second->mDeserializeFunc; - } - else - { - BlockDescriptor::param_map_t::iterator found_it = block_data.mSynonyms.find(top_name); - if (found_it != block_data.mSynonyms.end()) - { - // find pointer to member parameter from offset table - paramp = getParamFromHandle(found_it->second->mParamHandle); - deserialize_func = found_it->second->mDeserializeFunc; - } - } - Parser::name_stack_range_t new_name_stack(name_stack.first, name_stack.second); - ++new_name_stack.first; - if (deserialize_func) - { + Parser::name_stack_range_t new_name_stack(name_stack.first, name_stack.second); + ++new_name_stack.first; return deserialize_func(*paramp, p, new_name_stack, name_stack.first == name_stack.second ? -1 : name_stack.first->second); } } @@ -404,7 +374,7 @@ namespace LLInitParam } else { - block_data.mSynonyms[synonym] = param_descriptor; + block_data.mNamedParams[synonym] = param_descriptor; } } } @@ -429,14 +399,6 @@ namespace LLInitParam } } - for (BlockDescriptor::param_map_t::const_iterator it = block_data.mSynonyms.begin(); it != block_data.mSynonyms.end(); ++it) - { - if (it->second->mParamHandle == handle) - { - return it->first; - } - } - return LLStringUtil::null; } diff --git a/indra/llxuixml/llinitparam.h b/indra/llxuixml/llinitparam.h index 488e20cf9f..51dbd99fb1 100644 --- a/indra/llxuixml/llinitparam.h +++ b/indra/llxuixml/llinitparam.h @@ -213,7 +213,10 @@ namespace LLInitParam Parser(parser_read_func_map_t& read_map, parser_write_func_map_t& write_map, parser_inspect_func_map_t& inspect_map) : mParseSilently(false), - mParseGeneration(0) + mParseGeneration(0), + mParserReadFuncs(&read_map), + mParserWriteFuncs(&write_map), + mParserInspectFuncs(&inspect_map) {} virtual ~Parser(); @@ -393,7 +396,6 @@ namespace LLInitParam typedef std::vector<std::pair<param_handle_t, ParamDescriptor::validation_func_t> > param_validation_list_t; param_map_t mNamedParams; // parameters with associated names - param_map_t mSynonyms; // parameters with alternate names param_list_t mUnnamedParams; // parameters with_out_ associated names param_validation_list_t mValidationList; // parameters that must be validated all_params_list_t mAllParams; // all parameters, owns descriptors diff --git a/indra/llxuixml/llxuiparser.cpp b/indra/llxuixml/llxuiparser.cpp index 220171fb79..9bda96713e 100644 --- a/indra/llxuixml/llxuiparser.cpp +++ b/indra/llxuixml/llxuiparser.cpp @@ -411,6 +411,7 @@ void LLXUIParser::readXUI(LLXMLNodePtr node, LLInitParam::BaseBlock& block, cons { LLFastTimer timer(FTM_PARSE_XUI); mNameStack.clear(); + mRootNodeName = node->getName()->mString; mCurFileName = filename; mCurReadDepth = 0; setParseSilently(silent); @@ -421,11 +422,11 @@ void LLXUIParser::readXUI(LLXMLNodePtr node, LLInitParam::BaseBlock& block, cons } else { - readXUIImpl(node, std::string(node->getName()->mString), block); + readXUIImpl(node, block); } } -bool LLXUIParser::readXUIImpl(LLXMLNodePtr nodep, const std::string& scope, LLInitParam::BaseBlock& block) +bool LLXUIParser::readXUIImpl(LLXMLNodePtr nodep, LLInitParam::BaseBlock& block) { typedef boost::tokenizer<boost::char_separator<char> > tokenizer; boost::char_separator<char> sep("."); @@ -492,7 +493,15 @@ bool LLXUIParser::readXUIImpl(LLXMLNodePtr nodep, const std::string& scope, LLIn } // check for proper nesting - if(!scope.empty() && *name_token_it != scope) + if (mNameStack.empty()) + { + if (*name_token_it != mRootNodeName) + { + childp = childp->getNextSibling(); + continue; + } + } + else if(mNameStack.back().first != *name_token_it) { childp = childp->getNextSibling(); continue; @@ -510,7 +519,7 @@ bool LLXUIParser::readXUIImpl(LLXMLNodePtr nodep, const std::string& scope, LLIn } // recurse and visit children XML nodes - if(readXUIImpl(childp, mNameStack.empty() ? scope : mNameStack.back().first, block)) + if(readXUIImpl(childp, block)) { // child node successfully parsed, remove from DOM diff --git a/indra/llxuixml/llxuiparser.h b/indra/llxuixml/llxuiparser.h index ee8fcdc369..1a4a7c49d1 100644 --- a/indra/llxuixml/llxuiparser.h +++ b/indra/llxuixml/llxuiparser.h @@ -118,7 +118,7 @@ public: void writeXUI(LLXMLNodePtr node, const LLInitParam::BaseBlock& block, const LLInitParam::BaseBlock* diff_block = NULL); private: - bool readXUIImpl(LLXMLNodePtr node, const std::string& scope, LLInitParam::BaseBlock& block); + bool readXUIImpl(LLXMLNodePtr node, LLInitParam::BaseBlock& block); bool readAttributes(LLXMLNodePtr nodep, LLInitParam::BaseBlock& block); //reader helper functions @@ -167,6 +167,7 @@ private: LLXMLNodePtr mLastWrittenChild; S32 mCurReadDepth; std::string mCurFileName; + std::string mRootNodeName; }; // LLSimpleXUIParser is a streamlined SAX-based XUI parser that does not support localization |