aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/history/Bookmark.hpp
blob: b49cbe90b39544d66144c27ed674f4645a07ef82 (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
#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 fvec2_t PROPERTY(initial_camera_position);

      Bookmark(
         index_t new_index,
         std::string_view new_name,
         std::string_view new_description,
         Date new_date,
         fvec2_t new_initial_camera_position
      );

   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, fvec2_t initial_camera_position
      );
      bool load_bookmark_file(fixed_point_t map_height, ast::NodeCPtr root);

      Date get_last_bookmark_date() const;
   };
}