summaryrefslogtreecommitdiff
path: root/lib/saxParse.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-03-05 01:59:16 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2023-03-05 01:59:16 +0000
commitd4c073a18adaed73973f34c6c39fc15664d9211d (patch)
tree44536af3af0284ab75eae79ef81a5e4452019269 /lib/saxParse.cpp
parentAdd helper operator to perform vec3*mat4 and perspective divide (diff)
parentRemove old hard coded asset factory test, run entirely from XML load and rend... (diff)
downloadilt-d4c073a18adaed73973f34c6c39fc15664d9211d.tar.bz2
ilt-d4c073a18adaed73973f34c6c39fc15664d9211d.tar.xz
ilt-d4c073a18adaed73973f34c6c39fc15664d9211d.zip
Merge branch 'model-factory'
Diffstat (limited to 'lib/saxParse.cpp')
-rw-r--r--lib/saxParse.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/lib/saxParse.cpp b/lib/saxParse.cpp
new file mode 100644
index 0000000..5c597aa
--- /dev/null
+++ b/lib/saxParse.cpp
@@ -0,0 +1,41 @@
+#include "saxParse.h"
+#include "mxml.h"
+
+namespace Persistence {
+ void
+ SAXParse::comment(mxml_node_t *)
+ {
+ // Default to just ignore comments
+ }
+
+ void
+ SAXParse::parseFile(FILE * file)
+ {
+ mxmlRelease(mxmlSAXLoadFile(
+ nullptr, file, MXML_TEXT_CALLBACK,
+ [](mxml_node_t * n, mxml_sax_event_t e, void * data) {
+ SAXParse * self = static_cast<SAXParse *>(data);
+ switch (e) {
+ case MXML_SAX_ELEMENT_OPEN:
+ return self->elementOpen(n);
+ break;
+ case MXML_SAX_ELEMENT_CLOSE:
+ return self->elementClose(n);
+ break;
+ case MXML_SAX_COMMENT:
+ return self->comment(n);
+ break;
+ case MXML_SAX_DATA:
+ return self->data(n);
+ break;
+ case MXML_SAX_DIRECTIVE:
+ return self->directive(n);
+ break;
+ case MXML_SAX_CDATA:;
+ return self->cdata(n);
+ break;
+ }
+ },
+ this));
+ }
+}