aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/history/Bookmark.hpp
blob: 18375fbe6dc7fc4d3d6ebb3728639d55fae5260d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#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 PROPERTY(name);
      const std::string PROPERTY(description);
      const Date PROPERTY(date);
      const uint32_t PROPERTY(initial_camera_x);
      const uint32_t PROPERTY(initial_camera_y);

      Bookmark(
         size_t new_index, 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;
   };

   struct BookmarkManager {
   private:
      IdentifierRegistry<Bookmark> bookmarks;

   public:
      BookmarkManager();

      bool add_bookmark(
         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);
   };
}