aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/history/Bookmark.hpp
diff options
context:
space:
mode:
author Spartan322 <Megacake1234@gmail.com>2023-10-09 18:02:14 +0200
committer Spartan322 <Megacake1234@gmail.com>2023-10-13 16:43:34 +0200
commita93b0d8f268fbf04c09ee73e5b2923a610667fcf (patch)
tree01e8f55c5327ee3b0796bb1d1e6e616331abee13 /src/openvic-simulation/history/Bookmark.hpp
parent32fdf7c38b2e56339a2fffa71a7a61a854759e2c (diff)
Add Bookmark Loading
Diffstat (limited to 'src/openvic-simulation/history/Bookmark.hpp')
-rw-r--r--src/openvic-simulation/history/Bookmark.hpp53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/openvic-simulation/history/Bookmark.hpp b/src/openvic-simulation/history/Bookmark.hpp
new file mode 100644
index 0000000..ec230ca
--- /dev/null
+++ b/src/openvic-simulation/history/Bookmark.hpp
@@ -0,0 +1,53 @@
+#pragma once
+
+#include <cstdint>
+
+#include <openvic-dataloader/v2script/AbstractSyntaxTree.hpp>
+
+#include "openvic-simulation/types/IdentifierRegistry.hpp"
+
+namespace OpenVic {
+ struct BookmarkManager;
+
+ struct Bookmark : HasIdentifier {
+ friend struct BookmarkManager;
+
+ private:
+ const std::string name;
+ const std::string description;
+ const Date date;
+ const uint32_t initial_camera_x;
+ const uint32_t initial_camera_y;
+
+ Bookmark(
+ std::string_view new_identifier,
+ std::string_view new_name,
+ std::string_view new_description,
+ Date new_date,
+ uint32_t new_initial_camera_x,
+ uint32_t new_initial_camera_y
+ );
+
+ public:
+ Bookmark(Bookmark&&) = default;
+
+ std::string_view get_name() const;
+ std::string_view get_description() const;
+ Date const& get_date() const;
+ uint32_t get_initial_camera_x() const;
+ uint32_t get_initial_camera_y() const;
+ };
+
+ struct BookmarkManager {
+ private:
+ IdentifierRegistry<Bookmark> bookmarks;
+
+ public:
+ BookmarkManager();
+
+ bool add_bookmark(std::string_view identifier, std::string_view name, std::string_view description, Date date, uint32_t initial_camera_x, uint32_t initial_camera_y);
+ IDENTIFIER_REGISTRY_ACCESSORS(bookmark);
+
+ bool load_bookmark_file(ast::NodeCPtr root);
+ };
+} \ No newline at end of file