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
8namespace horizon {
9using json = nlohmann::json;
10
11class Project {
12private:
13 Project(const UUID &uu, const json &, const std::string &base);
14 std::string get_filename_rel(const std::string &p) const;
15
16public:
17 static Project new_from_file(const std::string &filename);
18 static unsigned int get_app_version();
19 Project(const UUID &uu);
20 std::string peek_title() const;
21
22 std::string create(const std::map<std::string, std::string> &meta, const class PoolInfo &pool);
23
24 static bool gitignore_needs_fixing(const std::string &filename);
25 static void fix_gitignore(const std::string &filename);
26
27 void create_blocks();
28
29 std::string base_path;
30 UUID uuid;
31
32 std::string blocks_filename;
33 std::string pictures_directory;
34 std::string board_filename;
35 std::string pool_directory;
36
37 FileVersion version;
38
39 json serialize() const;
40
41private:
42 std::string title_old;
43 std::string name_old;
44 std::string vias_directory_old;
45
46 UUID pool_uuid_old;
47 std::string pool_cache_directory_old;
48
49 class ProjectBlock {
50 public:
51 ProjectBlock(const UUID &uu, const std::string &b, const std::string &s, bool t = false)
52 : uuid(uu), block_filename(b), schematic_filename(s), is_top(t)
53 {
54 }
55 UUID uuid;
56 std::string block_filename;
57 std::string schematic_filename;
58 bool is_top;
59 };
60 std::map<UUID, ProjectBlock> blocks_old;
61};
62} // namespace horizon
Definition: file_version.hpp:9
Definition: pool_info.hpp:11
Definition: project.hpp:11
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:177
basic_json<> json
default JSON class
Definition: json_fwd.hpp:62