From 7af9992ca81c699bc1cf05eb691e284bf424f050 Mon Sep 17 00:00:00 2001 From: rtk0c Date: Mon, 18 Apr 2022 17:54:29 -0700 Subject: Changeset: 9 Implement IresSpritesheet --- source/Ires.hpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'source/Ires.hpp') diff --git a/source/Ires.hpp b/source/Ires.hpp index 66a931e..9b055af 100644 --- a/source/Ires.hpp +++ b/source/Ires.hpp @@ -11,7 +11,7 @@ #include // Forward declarations -class IresObject; +class EditorInstance; class IresManager; class IresObject : public RefCounted { @@ -43,12 +43,16 @@ public: IresManager* GetAssociatedManager() const { return mMan; } bool IsAnnoymous() const; const std::string& GetName() const { return mName; } + void SetName(std::string name); + + virtual void ShowEditor(EditorInstance& editor); EditorAttachment* GetEditorAttachment() const { return mEditorAttachment.get(); } void SetEditorAttachment(EditorAttachment* attachment) { mEditorAttachment.reset(attachment); } - static rapidjson::Value WriteFull(const IresObject& ires, rapidjson::Document& root); + static void WriteFull(IresObject* ires, rapidjson::Value& value, rapidjson::Document& root); static std::unique_ptr ReadFull(const rapidjson::Value& value); + static bool ReadPartial(IresObject* ires, const rapidjson::Value& value); virtual void Write(rapidjson::Value& value, rapidjson::Document& root) const = 0; virtual void Read(const rapidjson::Value& value) = 0; }; @@ -58,7 +62,7 @@ public: static inline IresManager* instance = nullptr; private: - robin_hood::unordered_map, StringHash, StringEqual> mObjects; + robin_hood::unordered_map> mObjects; public: void DiscoverFilesDesignatedLocation(); @@ -68,6 +72,11 @@ public: void Delete(IresObject* ires); bool Rename(IresObject* ires, std::string newName); + IresObject* Load(const std::filesystem::path& path); + void Reload(IresObject* ires); + void Save(IresObject* ires); + void Save(IresObject* ires, const std::filesystem::path& filePath); + const auto& GetObjects() const { return mObjects; } IresObject* FindIres(std::string_view path); }; -- cgit v1.2.3-70-g09d2