diff options
author | Oz Linden <oz@lindenlab.com> | 2013-03-22 18:08:49 -0400 |
---|---|---|
committer | Oz Linden <oz@lindenlab.com> | 2013-03-22 18:08:49 -0400 |
commit | 1057caffaf24790be26376b2794059e7635dde7b (patch) | |
tree | 6f207f916bcf9430ffd0e863600dca642ec799c7 /indra/llui/llxuiparser.cpp | |
parent | 7632861fc40ffd05b6a1704f629a38250600c294 (diff) | |
parent | e15b7bafbb7168a721ffd286c1d1f4e6299abb44 (diff) |
merge changes for latest snowstorm project viewer
Diffstat (limited to 'indra/llui/llxuiparser.cpp')
-rw-r--r-- | indra/llui/llxuiparser.cpp | 92 |
1 files changed, 61 insertions, 31 deletions
diff --git a/indra/llui/llxuiparser.cpp b/indra/llui/llxuiparser.cpp index afc76024d1..3ad5ad7d42 100644 --- a/indra/llui/llxuiparser.cpp +++ b/indra/llui/llxuiparser.cpp @@ -42,7 +42,7 @@ #include <boost/spirit/include/classic_core.hpp> #include "lluicolor.h" - +#include "v3math.h" using namespace BOOST_SPIRIT_CLASSIC_NS; const S32 MAX_STRING_ATTRIBUTE_SIZE = 40; @@ -79,7 +79,6 @@ struct Occurs : public LLInitParam::Block<Occurs> {} }; - typedef enum { USE_REQUIRED, @@ -101,14 +100,23 @@ namespace LLInitParam struct Element; struct Group; -struct Choice; struct Sequence; -struct Any; + +struct All : public LLInitParam::Block<All, Occurs> +{ + Multiple< Lazy<Element, IS_A_BLOCK> > elements; + + All() + : elements("element") + { + maxOccurs = 1; + } +}; struct Attribute : public LLInitParam::Block<Attribute> { - Mandatory<std::string> name; - Mandatory<std::string> type; + Mandatory<std::string> name, + type; Mandatory<EUse> use; Attribute() @@ -127,24 +135,13 @@ struct Any : public LLInitParam::Block<Any, Occurs> {} }; -struct All : public LLInitParam::Block<All, Occurs> -{ - Multiple< Lazy<Element> > elements; - - All() - : elements("element") - { - maxOccurs = 1; - } -}; - struct Choice : public LLInitParam::ChoiceBlock<Choice, Occurs> { - Alternative< Lazy<Element> > element; - Alternative< Lazy<Group> > group; - Alternative< Lazy<Choice> > choice; - Alternative< Lazy<Sequence> > sequence; - Alternative< Lazy<Any> > any; + Alternative< Lazy<Element, IS_A_BLOCK> > element; + Alternative< Lazy<Group, IS_A_BLOCK> > group; + Alternative< Lazy<Choice, IS_A_BLOCK> > choice; + Alternative< Lazy<Sequence, IS_A_BLOCK> > sequence; + Alternative< Lazy<Any> > any; Choice() : element("element"), @@ -158,11 +155,11 @@ struct Choice : public LLInitParam::ChoiceBlock<Choice, Occurs> struct Sequence : public LLInitParam::ChoiceBlock<Sequence, Occurs> { - Alternative< Lazy<Element> > element; - Alternative< Lazy<Group> > group; - Alternative< Lazy<Choice> > choice; - Alternative< Lazy<Sequence> > sequence; - Alternative< Lazy<Any> > any; + Alternative< Lazy<Element, IS_A_BLOCK> > element; + Alternative< Lazy<Group, IS_A_BLOCK> > group; + Alternative< Lazy<Choice> > choice; + Alternative< Lazy<Sequence, IS_A_BLOCK> > sequence; + Alternative< Lazy<Any> > any; }; struct GroupContents : public LLInitParam::ChoiceBlock<GroupContents, Occurs> @@ -247,7 +244,7 @@ struct ComplexType : public LLInitParam::Block<ComplexType, ComplexTypeContents> Optional<bool> mixed; Multiple<Attribute> attribute; - Multiple< Lazy<Element> > elements; + Multiple< Lazy<Element, IS_A_BLOCK > > elements; ComplexType() : name("name"), @@ -313,7 +310,6 @@ public: setNameSpace(ns); }; } - }; // @@ -625,7 +621,7 @@ void LLXUIXSDWriter::writeXSD(const std::string& type_name, const std::string& p nodep->createChild("schemaLocation", true)->setStringValue(widget_name + ".xsd"); // add to front of schema - mSchemaNode->addChild(nodep, mSchemaNode); + mSchemaNode->addChild(nodep); } for (widget_registry_t::Registrar::registry_map_t::const_iterator it = widget_registryp->currentRegistrar().beginItems(); @@ -670,6 +666,7 @@ LLXUIParser::LLXUIParser() registerParserFuncs<S32>(readS32Value, writeS32Value); registerParserFuncs<F32>(readF32Value, writeF32Value); registerParserFuncs<F64>(readF64Value, writeF64Value); + registerParserFuncs<LLVector3>(readVector3Value, writeVector3Value); registerParserFuncs<LLColor4>(readColor4Value, writeColor4Value); registerParserFuncs<LLUIColor>(readUIColorValue, writeUIColorValue); registerParserFuncs<LLUUID>(readUUIDValue, writeUUIDValue); @@ -880,16 +877,24 @@ LLXMLNodePtr LLXUIParser::getNode(name_stack_t& stack) it = next_it) { ++next_it; + bool force_new_node = false; + if (it->first.empty()) { it->second = false; continue; } + if (next_it != stack.end() && next_it->first.empty() && next_it->second) + { + force_new_node = true; + } + + out_nodes_t::iterator found_it = mOutNodes.find(it->first); // node with this name not yet written - if (found_it == mOutNodes.end() || it->second) + if (found_it == mOutNodes.end() || it->second || force_new_node) { // make an attribute if we are the last element on the name stack bool is_attribute = next_it == stack.end(); @@ -1144,6 +1149,31 @@ bool LLXUIParser::writeF64Value(Parser& parser, const void* val_ptr, name_stack_ return false; } +bool LLXUIParser::readVector3Value(Parser& parser, void* val_ptr) +{ + LLXUIParser& self = static_cast<LLXUIParser&>(parser); + LLVector3* vecp = (LLVector3*)val_ptr; + if(self.mCurReadNode->getFloatValue(3, vecp->mV) >= 3) + { + return true; + } + + return false; +} + +bool LLXUIParser::writeVector3Value(Parser& parser, const void* val_ptr, name_stack_t& stack) +{ + LLXUIParser& self = static_cast<LLXUIParser&>(parser); + LLXMLNodePtr node = self.getNode(stack); + if (node.notNull()) + { + LLVector3 vector = *((LLVector3*)val_ptr); + node->setFloatValue(3, vector.mV); + return true; + } + return false; +} + bool LLXUIParser::readColor4Value(Parser& parser, void* val_ptr) { LLXUIParser& self = static_cast<LLXUIParser&>(parser); |