aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/history/Bookmark.hpp
blob: d4de34c99c4159a55088a4671b0b59e3693edb8b (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
49
50
51
52
53
54
#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(
         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;

      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 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);
   };
}