diff options
Diffstat (limited to 'assetFactory/modelFactory.cpp')
-rw-r--r-- | assetFactory/modelFactory.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/assetFactory/modelFactory.cpp b/assetFactory/modelFactory.cpp index 4c25e48..2642900 100644 --- a/assetFactory/modelFactory.cpp +++ b/assetFactory/modelFactory.cpp @@ -2,7 +2,10 @@ #include "cuboid.h" #include "cylinder.h" #include "modelFactoryMesh_fwd.h" +#include "object.h" #include "plane.h" +#include "saxParse-persistence.h" +#include <filesystem.h> ModelFactory::ModelFactory() : shapes { @@ -12,3 +15,17 @@ ModelFactory::ModelFactory() : } { } + +std::shared_ptr<ModelFactory> +ModelFactory::loadXML(const std::filesystem::path & filename) +{ + filesystem::FileStar file {filename.c_str(), "r"}; + return Persistence::SAXParsePersistence {}.loadState<std::shared_ptr<ModelFactory>>(file); +} + +bool +ModelFactory::persist(Persistence::PersistenceStore & store) +{ + using MapObjects = Persistence::MapByMember<Shapes, Object>; + return STORE_TYPE && STORE_NAME_HELPER("object", shapes, MapObjects); +} |