From 5e561d390dc82b08c20532de0952f428e7b14283 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Tue, 21 Feb 2023 19:34:16 +0000 Subject: Rename ModelFactory to AssetFactory --- assetFactory/assetFactory.cpp | 31 +++++++++++++++++++++++++++++++ assetFactory/assetFactory.h | 19 +++++++++++++++++++ assetFactory/modelFactory.cpp | 31 ------------------------------- assetFactory/modelFactory.h | 19 ------------------- assetFactory/use.cpp | 4 ++-- 5 files changed, 52 insertions(+), 52 deletions(-) create mode 100644 assetFactory/assetFactory.cpp create mode 100644 assetFactory/assetFactory.h delete mode 100644 assetFactory/modelFactory.cpp delete mode 100644 assetFactory/modelFactory.h (limited to 'assetFactory') diff --git a/assetFactory/assetFactory.cpp b/assetFactory/assetFactory.cpp new file mode 100644 index 0000000..0ee1f94 --- /dev/null +++ b/assetFactory/assetFactory.cpp @@ -0,0 +1,31 @@ +#include "assetFactory.h" +#include "cuboid.h" +#include "cylinder.h" +#include "modelFactoryMesh_fwd.h" +#include "object.h" +#include "plane.h" +#include "saxParse-persistence.h" +#include + +AssetFactory::AssetFactory() : + shapes { + {"plane", std::make_shared()}, + {"cuboid", std::make_shared()}, + {"cylinder", std::make_shared()}, + } +{ +} + +std::shared_ptr +AssetFactory::loadXML(const std::filesystem::path & filename) +{ + filesystem::FileStar file {filename.c_str(), "r"}; + return Persistence::SAXParsePersistence {}.loadState>(file); +} + +bool +AssetFactory::persist(Persistence::PersistenceStore & store) +{ + using MapObjects = Persistence::MapByMember; + return STORE_TYPE && STORE_NAME_HELPER("object", shapes, MapObjects); +} diff --git a/assetFactory/assetFactory.h b/assetFactory/assetFactory.h new file mode 100644 index 0000000..5cf90dd --- /dev/null +++ b/assetFactory/assetFactory.h @@ -0,0 +1,19 @@ +#pragma once + +#include "persistence.h" +#include "shape.h" +#include + +class AssetFactory : public Persistence::Persistable { +public: + using Shapes = std::map>; + + AssetFactory(); + [[nodiscard]] static std::shared_ptr loadXML(const std::filesystem::path &); + + Shapes shapes; + +private: + friend Persistence::SelectionPtrBase, true>; + bool persist(Persistence::PersistenceStore & store) override; +}; diff --git a/assetFactory/modelFactory.cpp b/assetFactory/modelFactory.cpp deleted file mode 100644 index 2642900..0000000 --- a/assetFactory/modelFactory.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include "modelFactory.h" -#include "cuboid.h" -#include "cylinder.h" -#include "modelFactoryMesh_fwd.h" -#include "object.h" -#include "plane.h" -#include "saxParse-persistence.h" -#include - -ModelFactory::ModelFactory() : - shapes { - {"plane", std::make_shared()}, - {"cuboid", std::make_shared()}, - {"cylinder", std::make_shared()}, - } -{ -} - -std::shared_ptr -ModelFactory::loadXML(const std::filesystem::path & filename) -{ - filesystem::FileStar file {filename.c_str(), "r"}; - return Persistence::SAXParsePersistence {}.loadState>(file); -} - -bool -ModelFactory::persist(Persistence::PersistenceStore & store) -{ - using MapObjects = Persistence::MapByMember; - return STORE_TYPE && STORE_NAME_HELPER("object", shapes, MapObjects); -} diff --git a/assetFactory/modelFactory.h b/assetFactory/modelFactory.h deleted file mode 100644 index 94db055..0000000 --- a/assetFactory/modelFactory.h +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once - -#include "persistence.h" -#include "shape.h" -#include - -class ModelFactory : public Persistence::Persistable { -public: - using Shapes = std::map>; - - ModelFactory(); - [[nodiscard]] static std::shared_ptr loadXML(const std::filesystem::path &); - - Shapes shapes; - -private: - friend Persistence::SelectionPtrBase, true>; - bool persist(Persistence::PersistenceStore & store) override; -}; diff --git a/assetFactory/use.cpp b/assetFactory/use.cpp index 21e26f3..3b574c3 100644 --- a/assetFactory/use.cpp +++ b/assetFactory/use.cpp @@ -1,5 +1,5 @@ #include "use.h" -#include "modelFactory.h" +#include "assetFactory.h" Shape::CreatedFaces Use::createMesh(ModelFactoryMesh & mesh, const Mutation::Matrix & mutation) const @@ -17,7 +17,7 @@ struct Lookup : public Persistence::SelectionV { void setValue(std::string && str) override { - if (auto mf = std::dynamic_pointer_cast(Persistence::sharedObjects.at("modelFactory"))) { + if (auto mf = std::dynamic_pointer_cast(Persistence::sharedObjects.at("assetFactory"))) { v = mf->shapes.at(str); } } -- cgit v1.2.3