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 
33  std::string create(const UUID &default_via = UUID());
34 
35  std::string base_path;
36  UUID uuid;
37  std::string name;
38  std::string title;
39  std::map<UUID, ProjectBlock> blocks;
40 
41  UUID pool_uuid;
42  std::string vias_directory;
43  std::string board_filename;
44  std::string pool_cache_directory;
45 
46  json serialize() const;
47 };
48 } // namespace horizon
a class to store JSON values
Definition: json.hpp:161
Definition: project.hpp:10
This class encapsulates a UUID and allows it to be uses as a value type.
Definition: uuid.hpp:16
Definition: block.cpp:7
basic_json<> json
default JSON class
Definition: json_fwd.hpp:61
Definition: project.hpp:22