diff options
Diffstat (limited to 'src/Instance.cpp')
-rw-r--r-- | src/Instance.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/Instance.cpp b/src/Instance.cpp index fe4b761..f602bbf 100644 --- a/src/Instance.cpp +++ b/src/Instance.cpp @@ -19,6 +19,7 @@ #include <iostream> #include <libxml++/validators/dtdvalidator.h> +#include <libxml/tree.h> #include "Instance.h" #include "Gui/Window.h" #include "Data/Level.h" @@ -91,6 +92,8 @@ void Instance::createLevel() { levelXml = new xmlpp::DomParser; xmlpp::Document *doc = levelXml->get_document(); + xmlSetDocCompressMode(doc->cobj(), 9); + xmlpp::Element *root = doc->create_root_node("level"); xmlpp::Element *info = root->add_child("info"); @@ -131,6 +134,14 @@ bool Instance::loadLevel(const Glib::ustring &file) { return (level != NULL); } +bool Instance::saveLevel(const Glib::ustring &file) { + if(!level | !levelXml->get_document()) + return false; + + levelXml->get_document()->write_to_file(file); + return true; +} + bool Instance::create(const Glib::ustring &file) { Instance *instance = new Instance(file); |