diff options
author | Richard Linden <none@none> | 2012-04-26 14:39:52 -0700 |
---|---|---|
committer | Richard Linden <none@none> | 2012-04-26 14:39:52 -0700 |
commit | a0bb55adc6ff26595f20bed12cb6f1565011e246 (patch) | |
tree | cbd25e29777ad9921b2fee2bd0b4d349caa4da61 /indra/llxuixml/llxuiparser.cpp | |
parent | d6569db3520f7e0ce2d93febb6f4e26b48c08a3d (diff) | |
parent | db316f830df45e1b0229ebcbdb5feedc5eb23913 (diff) |
merge with viewer-release
Diffstat (limited to 'indra/llxuixml/llxuiparser.cpp')
-rw-r--r-- | indra/llxuixml/llxuiparser.cpp | 80 |
1 files changed, 51 insertions, 29 deletions
diff --git a/indra/llxuixml/llxuiparser.cpp b/indra/llxuixml/llxuiparser.cpp index afc76024d1..9cd88a1620 100644 --- a/indra/llxuixml/llxuiparser.cpp +++ b/indra/llxuixml/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); }; } - }; // @@ -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); @@ -1144,6 +1141,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); |