diff options
author | Richard Linden <none@none> | 2012-11-02 20:03:44 -0700 |
---|---|---|
committer | Richard Linden <none@none> | 2012-11-02 20:03:44 -0700 |
commit | f8eaee753174d0cab4e4edcf795f422706d6f302 (patch) | |
tree | 7f16a502c6a8c4df57dfa74303a04d66eed74fa7 /indra/llui | |
parent | bb6bda9eef48f5b08b56af46321b79fe7f1d49d7 (diff) |
SH-3499 Ensure asset stats output is correct
improvements to predicate API
default rules encapsulated in LLInitParam
removed empty flag from viewer asset stats
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/llfloater.cpp | 5 | ||||
-rw-r--r-- | indra/llui/llpanel.cpp | 4 | ||||
-rw-r--r-- | indra/llui/lluictrlfactory.h | 4 | ||||
-rw-r--r-- | indra/llui/llxuiparser.cpp | 2 | ||||
-rw-r--r-- | indra/llui/llxuiparser.h | 18 |
5 files changed, 23 insertions, 10 deletions
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index c4a5d1f05e..34556b8aeb 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -3085,7 +3085,7 @@ bool LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, const std::str parser.readXUI(node, output_params, LLUICtrlFactory::getInstance()->getCurFileName()); setupParamsForExport(output_params, parent); output_node->setName(node->getName()->mString); - parser.writeXUI(output_node, output_params, LLInitParam::predicate_rule_t(LLInitParam::PROVIDED) && LLInitParam::NON_DEFAULT, &default_params); + parser.writeXUI(output_node, output_params, LLInitParam::default_parse_rules(), &default_params); return TRUE; } @@ -3115,9 +3115,8 @@ bool LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, const std::str { Params output_params(params); setupParamsForExport(output_params, parent); - Params default_params(LLUICtrlFactory::getDefaultParams<LLFloater>()); output_node->setName(node->getName()->mString); - parser.writeXUI(output_node, output_params, LLInitParam::predicate_rule_t(LLInitParam::PROVIDED) && LLInitParam::NON_DEFAULT, &default_params); + parser.writeXUI(output_node, output_params, LLInitParam::default_parse_rules(), &default_params); } // Default floater position to top-left corner of screen diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index f3d6687e40..a5ffcc8ec7 100644 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -520,7 +520,7 @@ BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr outpu Params output_params(params); setupParamsForExport(output_params, parent); output_node->setName(node->getName()->mString); - parser.writeXUI(output_node, output_params, LLInitParam::predicate_rule_t(LLInitParam::PROVIDED) && LLInitParam::NON_DEFAULT, &default_params); + parser.writeXUI(output_node, output_params, LLInitParam::default_parse_rules(), &default_params); return TRUE; } @@ -551,7 +551,7 @@ BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr outpu Params output_params(params); setupParamsForExport(output_params, parent); output_node->setName(node->getName()->mString); - parser.writeXUI(output_node, output_params, LLInitParam::predicate_rule_t(LLInitParam::PROVIDED) && LLInitParam::NON_DEFAULT, &default_params); + parser.writeXUI(output_node, output_params, LLInitParam::default_parse_rules(), &default_params); } params.from_xui = true; diff --git a/indra/llui/lluictrlfactory.h b/indra/llui/lluictrlfactory.h index 6513f97ca0..b53b71f690 100644 --- a/indra/llui/lluictrlfactory.h +++ b/indra/llui/lluictrlfactory.h @@ -270,10 +270,8 @@ private: // We always want to output top-left coordinates typename T::Params output_params(params); T::setupParamsForExport(output_params, parent); - // Export only the differences between this any default params - typename T::Params default_params(getDefaultParams<T>()); copyName(node, output_node); - parser.writeXUI(output_node, output_params, LLInitParam::predicate_rule_t(LLInitParam::PROVIDED) && LLInitParam::NON_DEFAULT, &default_params); + parser.writeXUI(output_node, output_params, LLInitParam::default_parse_rules(), &getDefaultParams<T>()); } // Apply layout transformations, usually munging rect diff --git a/indra/llui/llxuiparser.cpp b/indra/llui/llxuiparser.cpp index 6fc32dbf9c..0c91390bc1 100644 --- a/indra/llui/llxuiparser.cpp +++ b/indra/llui/llxuiparser.cpp @@ -861,7 +861,7 @@ bool LLXUIParser::readAttributes(LLXMLNodePtr nodep, LLInitParam::BaseBlock& blo return any_parsed; } -void LLXUIParser::writeXUI(LLXMLNodePtr node, const LLInitParam::BaseBlock &block, LLInitParam::predicate_rule_t rules, const LLInitParam::BaseBlock* diff_block) +void LLXUIParser::writeXUIImpl(LLXMLNodePtr node, const LLInitParam::BaseBlock &block, const LLInitParam::predicate_rule_t rules, const LLInitParam::BaseBlock* diff_block) { mWriteRootNode = node; name_stack_t name_stack = Parser::name_stack_t(); diff --git a/indra/llui/llxuiparser.h b/indra/llui/llxuiparser.h index 9b6b2a321b..8d0276a8ad 100644 --- a/indra/llui/llxuiparser.h +++ b/indra/llui/llxuiparser.h @@ -109,9 +109,25 @@ public: /*virtual*/ void parserError(const std::string& message); void readXUI(LLXMLNodePtr node, LLInitParam::BaseBlock& block, const std::string& filename = LLStringUtil::null, bool silent=false); - void writeXUI(LLXMLNodePtr node, const LLInitParam::BaseBlock& block, LLInitParam::predicate_rule_t rules = LLInitParam::predicate_rule_t(LLInitParam::PROVIDED) && LLInitParam::NON_DEFAULT, const LLInitParam::BaseBlock* diff_block = NULL); + template<typename BLOCK> + void writeXUI(LLXMLNodePtr node, + const BLOCK& block, + const LLInitParam::predicate_rule_t rules = LLInitParam::default_parse_rules(), + const LLInitParam::BaseBlock* diff_block = NULL) + { + if (!diff_block + && !rules.isAmbivalent(LLInitParam::HAS_DEFAULT_VALUE)) + { + diff_block = &LLInitParam::defaultValue<BLOCK>(); + } + writeXUIImpl(node, block, rules, diff_block); + } private: + void writeXUIImpl(LLXMLNodePtr node, + const LLInitParam::BaseBlock& block, + const LLInitParam::predicate_rule_t rules, + const LLInitParam::BaseBlock* diff_block); bool readXUIImpl(LLXMLNodePtr node, LLInitParam::BaseBlock& block); bool readAttributes(LLXMLNodePtr nodep, LLInitParam::BaseBlock& block); |