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