summaryrefslogtreecommitdiff
path: root/indra/llxuixml/llxuiparser.h
diff options
context:
space:
mode:
authorRichard Nelson <none@none>2010-08-04 19:02:30 -0700
committerRichard Nelson <none@none>2010-08-04 19:02:30 -0700
commitb2028085fdfddfd5a7ac0f52d9f34b84457b3b98 (patch)
treeee23f50874516092fb8a11cfe8079b150222f128 /indra/llxuixml/llxuiparser.h
parentf92a411c023e2178814c27216b4d4c36fcb5d784 (diff)
first pass at faster XUI parsing (no recursion support yet)
also made LLSD->param block parsing faster
Diffstat (limited to 'indra/llxuixml/llxuiparser.h')
-rw-r--r--indra/llxuixml/llxuiparser.h86
1 files changed, 70 insertions, 16 deletions
diff --git a/indra/llxuixml/llxuiparser.h b/indra/llxuixml/llxuiparser.h
index 884f4f7578..4deb083e1c 100644
--- a/indra/llxuixml/llxuiparser.h
+++ b/indra/llxuixml/llxuiparser.h
@@ -120,26 +120,24 @@ public:
void writeXUI(LLXMLNodePtr node, const LLInitParam::BaseBlock& block, const LLInitParam::BaseBlock* diff_block = NULL);
private:
- typedef std::list<std::pair<std::string, bool> > token_list_t;
-
bool readXUIImpl(LLXMLNodePtr node, const std::string& scope, LLInitParam::BaseBlock& block);
bool readAttributes(LLXMLNodePtr nodep, LLInitParam::BaseBlock& block);
//reader helper functions
- bool readBoolValue(void* val_ptr);
- bool readStringValue(void* val_ptr);
- bool readU8Value(void* val_ptr);
- bool readS8Value(void* val_ptr);
- bool readU16Value(void* val_ptr);
- bool readS16Value(void* val_ptr);
- bool readU32Value(void* val_ptr);
- bool readS32Value(void* val_ptr);
- bool readF32Value(void* val_ptr);
- bool readF64Value(void* val_ptr);
- bool readColor4Value(void* val_ptr);
- bool readUIColorValue(void* val_ptr);
- bool readUUIDValue(void* val_ptr);
- bool readSDValue(void* val_ptr);
+ static bool readBoolValue(Parser& parser, void* val_ptr);
+ static bool readStringValue(Parser& parser, void* val_ptr);
+ static bool readU8Value(Parser& parser, void* val_ptr);
+ static bool readS8Value(Parser& parser, void* val_ptr);
+ static bool readU16Value(Parser& parser, void* val_ptr);
+ static bool readS16Value(Parser& parser, void* val_ptr);
+ static bool readU32Value(Parser& parser, void* val_ptr);
+ static bool readS32Value(Parser& parser, void* val_ptr);
+ static bool readF32Value(Parser& parser, void* val_ptr);
+ static bool readF64Value(Parser& parser, void* val_ptr);
+ static bool readColor4Value(Parser& parser, void* val_ptr);
+ static bool readUIColorValue(Parser& parser, void* val_ptr);
+ static bool readUUIDValue(Parser& parser, void* val_ptr);
+ static bool readSDValue(Parser& parser, void* val_ptr);
//writer helper functions
bool writeBoolValue(const void* val_ptr, const name_stack_t&);
@@ -173,5 +171,61 @@ private:
std::string mCurFileName;
};
+class LLFastXUIParser : public LLInitParam::Parser, public LLSingleton<LLFastXUIParser>
+{
+LOG_CLASS(LLFastXUIParser);
+
+protected:
+ LLFastXUIParser();
+ virtual ~LLFastXUIParser();
+ friend class LLSingleton<LLFastXUIParser>;
+public:
+ typedef LLInitParam::Parser::name_stack_t name_stack_t;
+
+ /*virtual*/ std::string getCurrentElementName();
+ /*virtual*/ void parserWarning(const std::string& message);
+ /*virtual*/ void parserError(const std::string& message);
+
+ bool readXUI(const std::string& filename, LLInitParam::BaseBlock& block, bool silent=false);
+
+private:
+ //reader helper functions
+ static bool readBoolValue(Parser&, void* val_ptr);
+ static bool readStringValue(Parser&, void* val_ptr);
+ static bool readU8Value(Parser&, void* val_ptr);
+ static bool readS8Value(Parser&, void* val_ptr);
+ static bool readU16Value(Parser&, void* val_ptr);
+ static bool readS16Value(Parser&, void* val_ptr);
+ static bool readU32Value(Parser&, void* val_ptr);
+ static bool readS32Value(Parser&, void* val_ptr);
+ static bool readF32Value(Parser&, void* val_ptr);
+ static bool readF64Value(Parser&, void* val_ptr);
+ static bool readColor4Value(Parser&, void* val_ptr);
+ static bool readUIColorValue(Parser&, void* val_ptr);
+ static bool readUUIDValue(Parser&, void* val_ptr);
+ static bool readSDValue(Parser&, void* val_ptr);
+
+private:
+ static void startElementHandler(void *userData, const char *name, const char **atts);
+ static void endElementHandler(void *userData, const char *name);
+ static void characterDataHandler(void *userData, const char *s, int len);
+
+ void startElement(const char *name, const char **atts);
+ void endElement(const char *name);
+ void characterData(const char *s, int len);
+ bool readAttributes(const char **atts);
+
+ LLInitParam::BaseBlock* mBlock;
+ Parser::name_stack_t mNameStack;
+ struct XML_ParserStruct* mParser;
+ S32 mLastWriteGeneration;
+ LLXMLNodePtr mLastWrittenChild;
+ S32 mCurReadDepth;
+ std::string mCurFileName;
+ const char* mCurAttributeValueBegin;
+ std::vector<S32> mTokenSizeStack;
+ std::vector<std::string> mScope;
+};
+
#endif //LLXUIPARSER_H