Unravel Engine C++ Reference
Loading...
Searching...
No Matches
deploy.cpp
Go to the documentation of this file.
1#include "deploy.hpp"
2
5
7
8namespace unravel
9{
11{
12 entt::meta_factory<deploy_settings>{}
13 .type("deploy_settings"_hs)
15 entt::attribute{"name", "deploy_settings"},
16 entt::attribute{"category", "EDITOR"},
17 entt::attribute{"pretty_name", "Deploy Options"},
18 })
19 .data<&deploy_settings::deploy_location>("deploy_location"_hs)
21 entt::attribute{"name", "deploy_location"},
22 entt::attribute{"pretty_name", "Deploy Location"},
23 entt::attribute{"tooltip", "Choose the deploy location."},
24 })
25 .data<&deploy_settings::deploy_dependencies>("deploy_dependencies"_hs)
27 entt::attribute{"name", "deploy_dependencies"},
28 entt::attribute{"pretty_name", "Deploy Dependencies"},
29 entt::attribute{"tooltip", "This takes some time and if already done should't be necessary."},
30 })
31 .data<&deploy_settings::deploy_and_run>("deploy_and_run"_hs)
33 entt::attribute{"name", "deploy_and_run"},
34 entt::attribute{"pretty_name", "Deploy & Run"},
35 entt::attribute{"tooltip", "Run the application after the deploy."},
36 });
37}
38
40{
41 try_save(ar, ser20::make_nvp("deploy_location", obj.deploy_location.generic_string()));
42 try_save(ar, ser20::make_nvp("deploy_dependencies", obj.deploy_dependencies));
43 try_save(ar, ser20::make_nvp("deploy_and_run", obj.deploy_and_run));
44}
47
49{
50 std::string deploy_location;
51 if(try_load(ar, ser20::make_nvp("deploy_location", deploy_location)))
52 {
53 obj.deploy_location = deploy_location;
54 }
55
56 try_load(ar, ser20::make_nvp("deploy_dependencies", obj.deploy_dependencies));
57 try_load(ar, ser20::make_nvp("deploy_and_run", obj.deploy_and_run));
58}
61
62
63void save_to_file(const std::string& absolute_path, const deploy_settings& obj)
64{
65 std::ofstream stream(absolute_path);
66 if(stream.good())
67 {
68 auto ar = ser20::create_oarchive_associative(stream);
69 try_save(ar, ser20::make_nvp("settings", obj));
70 }
71}
72
73void save_to_file_bin(const std::string& absolute_path, const deploy_settings& obj)
74{
75 std::ofstream stream(absolute_path, std::ios::binary);
76 if(stream.good())
77 {
78 ser20::oarchive_binary_t ar(stream);
79 try_save(ar, ser20::make_nvp("settings", obj));
80 }
81}
82
83auto load_from_file(const std::string& absolute_path, deploy_settings& obj) -> bool
84{
85 std::ifstream stream(absolute_path);
86 if(stream.good())
87 {
88 auto ar = ser20::create_iarchive_associative(stream);
89 return try_load(ar, ser20::make_nvp("settings", obj));
90 }
91
92 return false;
93}
94
95auto load_from_file_bin(const std::string& absolute_path, deploy_settings& obj) -> bool
96{
97 std::ifstream stream(absolute_path, std::ios::binary);
98 if(stream.good())
99 {
100 ser20::iarchive_binary_t ar(stream);
101 return try_load(ar, ser20::make_nvp("settings", obj));
102 }
103
104 return false;
105}
106} // namespace unravel
attributes::value_type attribute
Definition reflection.h:19
std::map< std::string, meta_any > attributes
Definition reflection.h:18
auto create_oarchive_associative(std::ostream &stream)
BinaryInputArchive iarchive_binary_t
auto create_iarchive_associative(std::istream &stream)
simd::JSONOutputArchive oarchive_associative_t
BinaryOutputArchive oarchive_binary_t
simd::JSONInputArchive iarchive_associative_t
void save_to_file_bin(const std::string &absolute_path, const animation_clip &obj)
void load_from_file(const std::string &absolute_path, animation_clip &obj)
void save_to_file(const std::string &absolute_path, const animation_clip &obj)
void load_from_file_bin(const std::string &absolute_path, animation_clip &obj)
#define REFLECT(cls)
Definition reflection.h:133
#define SAVE_INSTANTIATE(cls, Archive)
#define LOAD(cls)
auto try_save(Archive &ar, ser20::NameValuePair< T > &&t, const hpp::source_location &loc=hpp::source_location::current()) -> bool
#define LOAD_INSTANTIATE(cls, Archive)
#define SAVE(cls)
auto try_load(Archive &ar, ser20::NameValuePair< T > &&t, const hpp::source_location &loc=hpp::source_location::current()) -> bool