Horizon
Loading...
Searching...
No Matches
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 planes_filename;
36 std::string pool_directory;
37
38 FileVersion version;
39
40 json serialize() const;
41
42private:
43 std::string title_old;
44 std::string name_old;
45 std::string vias_directory_old;
46
47 UUID pool_uuid_old;
48 std::string pool_cache_directory_old;
49
50 class ProjectBlock {
51 public:
52 ProjectBlock(const UUID &uu, const std::string &b, const std::string &s, bool t = false)
53 : uuid(uu), block_filename(b), schematic_filename(s), is_top(t)
54 {
55 }
56 UUID uuid;
57 std::string block_filename;
58 std::string schematic_filename;
59 bool is_top;
60 };
61 std::map<UUID, ProjectBlock> blocks_old;
62};
63} // 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
Tiny metaprogramming library.
Definition meta.hpp:116
basic_json<> json
default JSON class
Definition json_fwd.hpp:62