summaryrefslogtreecommitdiff
path: root/lib/saxParse-persistence.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-persistence.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-persistence.cpp')
-rw-r--r--lib/saxParse-persistence.cpp50
1 files changed, 50 insertions, 0 deletions
diff --git a/lib/saxParse-persistence.cpp b/lib/saxParse-persistence.cpp
new file mode 100644
index 0000000..a6a0d23
--- /dev/null
+++ b/lib/saxParse-persistence.cpp
@@ -0,0 +1,50 @@
+#include "saxParse-persistence.h"
+
+namespace Persistence {
+
+ void
+ SAXParsePersistence::loadStateInternal(FILE * in)
+ {
+ stk.top()->beforeValue(stk);
+ stk.top()->beginObject(stk);
+ parseFile(in);
+ stk.pop();
+ stk.pop();
+ }
+
+ void
+ SAXParsePersistence::elementOpen(mxml_node_t * n)
+ {
+ stk.push(stk.top()->select(mxmlGetElement(n)));
+ stk.top()->beforeValue(stk);
+ stk.top()->beginObject(stk);
+ for (int attrCount = mxmlElementGetAttrCount(n), attrIdx {0}; attrIdx < attrCount; ++attrIdx) {
+ const char *name, *value = mxmlElementGetAttrByIndex(n, attrIdx, &name);
+ auto sel = stk.top()->select(name);
+ sel->beforeValue(stk);
+ sel->setValue(std::string {value});
+ }
+ }
+
+ void
+ SAXParsePersistence::elementClose(mxml_node_t *)
+ {
+ stk.top()->endObject(stk);
+ stk.top()->endObject(stk);
+ }
+
+ void
+ SAXParsePersistence::data(mxml_node_t *)
+ {
+ }
+
+ void
+ SAXParsePersistence::directive(mxml_node_t *)
+ {
+ }
+
+ void
+ SAXParsePersistence::cdata(mxml_node_t *)
+ {
+ }
+}