aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/history/Bookmark.hpp
blob: d945d41cbe845473fdd2005fea3244e965d8774c (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
47
48
#pragma once

#include <cstdint>

#include <openvic-dataloader/v2script/AbstractSyntaxTree.hpp>

#include "openvic-simulation/types/IdentifierRegistry.hpp"

namespace OpenVic {
   struct BookmarkManager;

   struct Bookmark : HasIdentifier, HasIndex<> {
      friend struct BookmarkManager;

   private:
      std::string PROPERTY(name);
      std::string PROPERTY(description);
      const Date PROPERTY(date);
      const uint32_t PROPERTY(initial_camera_x);
      const uint32_t PROPERTY(initial_camera_y);

      Bookmark(
         index_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> IDENTIFIER_REGISTRY(bookmark);

   public:
      bool add_bookmark(
         std::string_view name, std::string_view description, Date date, uint32_t initial_camera_x,
         uint32_t initial_camera_y
      );
      bool load_bookmark_file(ast::NodeCPtr root);

      Date get_last_bookmark_date() const;
   };
}