Horizon
project.hpp
1 #pragma once
2 #include "util/uuid.hpp"
3 #include "nlohmann/json_fwd.hpp"
4 #include <map>
5 #include <deque>
6 #include "util/file_version.hpp"
7 
8 namespace horizon {
9 using json = nlohmann::json;
10 
11 class ProjectBlock {
12 public:
13  ProjectBlock(const UUID &uu, const std::string &b, const std::string &s, bool t = false)
14  : uuid(uu), block_filename(b), schematic_filename(s), is_top(t)
15  {
16  }
17  UUID uuid;
18  std::string block_filename;
19  std::string schematic_filename;
20  bool is_top;
21 };
22 
23 class Project {
24 private:
25  Project(const UUID &uu, const json &, const std::string &base);
26  std::string get_filename_rel(const std::string &p) const;
27 
28 public:
29  static Project new_from_file(const std::string &filename);
30  static unsigned int get_app_version();
31  Project(const UUID &uu);
32  ProjectBlock &get_top_block();
33  const ProjectBlock &get_top_block() const;
34 
35  std::string create(const std::map<std::string, std::string> &meta, const UUID &default_via);
36 
37  std::string base_path;
38  UUID uuid;
39  std::map<UUID, ProjectBlock> blocks;
40 
41  UUID pool_uuid;
42  std::string vias_directory;
43  std::string pictures_directory;
44  std::string board_filename;
45  std::string pool_cache_directory;
46 
47  FileVersion version;
48 
49  json serialize() const;
50 
51 private:
52  std::string title_old;
53  std::string name_old;
54 };
55 } // namespace horizon
Definition: file_version.hpp:8
Definition: project.hpp:11
Definition: project.hpp:23
This class encapsulates a UUID and allows it to be uses as a value type.
Definition: uuid.hpp:16
a class to store JSON values
Definition: json.hpp:166
basic_json<> json
default JSON class
Definition: json_fwd.hpp:61