diff options
Diffstat (limited to 'indra/llxml')
-rw-r--r-- | indra/llxml/CMakeLists.txt | 36 | ||||
-rw-r--r-- | indra/llxml/llcontrol.cpp | 11 | ||||
-rw-r--r-- | indra/llxml/llcontrol.h | 2 | ||||
-rw-r--r-- | indra/llxml/llxmlnode.cpp | 24 | ||||
-rw-r--r-- | indra/llxml/llxmlnode.h | 3 |
5 files changed, 34 insertions, 42 deletions
diff --git a/indra/llxml/CMakeLists.txt b/indra/llxml/CMakeLists.txt index eb5166ee71..21cdf5f926 100644 --- a/indra/llxml/CMakeLists.txt +++ b/indra/llxml/CMakeLists.txt @@ -45,27 +45,25 @@ target_link_libraries( llxml ${EXPAT_LIBRARIES} ) +# tests -if(LL_TESTS) - # tests +if (LL_TESTS) + # unit tests - # unit tests + SET(llxml_TEST_SOURCE_FILES + # none yet! + ) + LL_ADD_PROJECT_UNIT_TESTS(llxml "${llxml_TEST_SOURCE_FILES}") - SET(llxml_TEST_SOURCE_FILES - # none yet! - ) - LL_ADD_PROJECT_UNIT_TESTS(llxml "${llxml_TEST_SOURCE_FILES}") + # integration tests - # integration tests + # set(TEST_DEBUG on) + set(test_libs + ${LLXML_LIBRARIES} + ${WINDOWS_LIBRARIES} + ${LLMATH_LIBRARIES} + ${LLCOMMON_LIBRARIES} + ) - # set(TEST_DEBUG on) - set(test_libs - ${LLXML_LIBRARIES} - ${WINDOWS_LIBRARIES} - ${LLMATH_LIBRARIES} - ${LLCOMMON_LIBRARIES} - ) - - LL_ADD_INTEGRATION_TEST(llcontrol "" "${test_libs}") - -endif(LL_TESTS) + LL_ADD_INTEGRATION_TEST(llcontrol "" "${test_libs}") +endif (LL_TESTS) diff --git a/indra/llxml/llcontrol.cpp b/indra/llxml/llcontrol.cpp index 6c72609122..0809d95628 100644 --- a/indra/llxml/llcontrol.cpp +++ b/indra/llxml/llcontrol.cpp @@ -835,11 +835,9 @@ U32 LLControlGroup::saveToFile(const std::string& filename, BOOL nondefault_only return num_saved; } -U32 LLControlGroup::loadFromFile(const std::string& filename, bool set_default_values) +U32 LLControlGroup::loadFromFile(const std::string& filename, bool set_default_values, bool save_values) { - std::string name; LLSD settings; - LLSD control_map; llifstream infile; infile.open(filename); if(!infile.is_open()) @@ -863,8 +861,8 @@ U32 LLControlGroup::loadFromFile(const std::string& filename, bool set_default_v for(LLSD::map_const_iterator itr = settings.beginMap(); itr != settings.endMap(); ++itr) { bool persist = true; - name = (*itr).first; - control_map = (*itr).second; + std::string const & name = itr->first; + LLSD const & control_map = itr->second; if(control_map.has("Persist")) { @@ -908,8 +906,7 @@ U32 LLControlGroup::loadFromFile(const std::string& filename, bool set_default_v } else if(existing_control->isPersisted()) { - - existing_control->setValue(control_map["Value"]); + existing_control->setValue(control_map["Value"], save_values); } // *NOTE: If not persisted and not setting defaults, // the value should not get loaded. diff --git a/indra/llxml/llcontrol.h b/indra/llxml/llcontrol.h index 70749b8ee9..050d4b729f 100644 --- a/indra/llxml/llcontrol.h +++ b/indra/llxml/llcontrol.h @@ -289,7 +289,7 @@ public: // as the given type. U32 loadFromFileLegacy(const std::string& filename, BOOL require_declaration = TRUE, eControlType declare_as = TYPE_STRING); U32 saveToFile(const std::string& filename, BOOL nondefault_only); - U32 loadFromFile(const std::string& filename, bool default_values = false); + U32 loadFromFile(const std::string& filename, bool default_values = false, bool save_values = true); void resetToDefaults(); }; diff --git a/indra/llxml/llxmlnode.cpp b/indra/llxml/llxmlnode.cpp index 8168f968cd..9f1e249ddd 100644 --- a/indra/llxml/llxmlnode.cpp +++ b/indra/llxml/llxmlnode.cpp @@ -859,23 +859,21 @@ BOOL LLXMLNode::isFullyDefault() } // static -bool LLXMLNode::getLayeredXMLNode(const std::string &xui_filename, LLXMLNodePtr& root, +bool LLXMLNode::getLayeredXMLNode(LLXMLNodePtr& root, const std::vector<std::string>& paths) { - std::string full_filename = gDirUtilp->findSkinnedFilename(paths.front(), xui_filename); - if (full_filename.empty()) + if (paths.empty()) return false; + + std::string filename = paths.front(); + if (filename.empty()) { return false; } - - if (!LLXMLNode::parseFile(full_filename, root, NULL)) + + if (!LLXMLNode::parseFile(filename, root, NULL)) { - // try filename as passed in since sometimes we load an xml file from a user-supplied path - if (!LLXMLNode::parseFile(xui_filename, root, NULL)) - { - llwarns << "Problem reading UI description file: " << xui_filename << llendl; - return false; - } + llwarns << "Problem reading UI description file: " << filename << llendl; + return false; } LLXMLNodePtr updateRoot; @@ -887,7 +885,7 @@ bool LLXMLNode::getLayeredXMLNode(const std::string &xui_filename, LLXMLNodePtr& std::string nodeName; std::string updateName; - std::string layer_filename = gDirUtilp->findSkinnedFilename((*itor), xui_filename); + std::string layer_filename = *itor; if(layer_filename.empty()) { // no localized version of this file, that's ok, keep looking @@ -896,7 +894,7 @@ bool LLXMLNode::getLayeredXMLNode(const std::string &xui_filename, LLXMLNodePtr& if (!LLXMLNode::parseFile(layer_filename, updateRoot, NULL)) { - llwarns << "Problem reading localized UI description file: " << (*itor) + gDirUtilp->getDirDelimiter() + xui_filename << llendl; + llwarns << "Problem reading localized UI description file: " << layer_filename << llendl; return false; } diff --git a/indra/llxml/llxmlnode.h b/indra/llxml/llxmlnode.h index 9df37ccb6f..e3da7169e7 100644 --- a/indra/llxml/llxmlnode.h +++ b/indra/llxml/llxmlnode.h @@ -149,8 +149,7 @@ public: LLXMLNodePtr& update_node); static LLXMLNodePtr replaceNode(LLXMLNodePtr node, LLXMLNodePtr replacement_node); - static bool getLayeredXMLNode(const std::string &xui_filename, LLXMLNodePtr& root, - const std::vector<std::string>& paths); + static bool getLayeredXMLNode(LLXMLNodePtr& root, const std::vector<std::string>& paths); // Write standard XML file header: |