summaryrefslogtreecommitdiff
path: root/project2/xml/xmlScriptParser.h
diff options
context:
space:
mode:
Diffstat (limited to 'project2/xml/xmlScriptParser.h')
-rw-r--r--project2/xml/xmlScriptParser.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/project2/xml/xmlScriptParser.h b/project2/xml/xmlScriptParser.h
new file mode 100644
index 0000000..ad0b1bf
--- /dev/null
+++ b/project2/xml/xmlScriptParser.h
@@ -0,0 +1,48 @@
+#ifndef XMLSCRIPTPARSER_H
+#define XMLSCRIPTPARSER_H
+
+#include <boost/function.hpp>
+#include "exceptions.h"
+#include "xmlObjectLoader.h"
+#include "scripts.h"
+#include <intrusivePtrBase.h>
+#include <boost/filesystem/path.hpp>
+#include <libxml++/document.h>
+#include <libxml++/nodes/element.h>
+#include <libxml++/parsers/domparser.h>
+
+class XmlScriptNode : public ScriptNode {
+ public:
+ XmlScriptNode(const xmlpp::Element * xmlElement, ScriptReaderPtr p);
+
+ const xmlpp::Element * xmlElement() const;
+ bool componentNamespace() const;
+ std::string get_name() const;
+ ScriptNodePtr child(const Glib::ustring&) const;
+ ScriptNodes children() const;
+ ScriptNodes childrenIn(const Glib::ustring&) const;
+ bool valueExists(const Glib::ustring&) const;
+ VariableImpl * variable(const boost::optional<Glib::ustring> & defaultSource) const;
+ VariableImpl * variable(const Glib::ustring&) const;
+ VariableType value(const Glib::ustring&) const;
+ void composeWithCallbacks(const ScriptNode::LiteralCallback&, const ScriptNode::NodeCallback&) const;
+
+ private:
+ const xmlpp::Element * element;
+};
+
+class XmlScriptParser : public xmlpp::DomParser, public ScriptReader {
+ public:
+ SimpleMessageException(ParseError);
+ SimpleMessageExceptionBase(NotReadable, ParseError);
+ SimpleMessageExceptionBase(IncludesError, ParseError);
+
+ XmlScriptParser(const boost::filesystem::path & file);
+ ScriptNodePtr root();
+ private:
+ ScriptNodePtr _root;
+};
+
+
+#endif
+