-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcxxplug_gen_proxy.cpp
More file actions
63 lines (51 loc) · 1.58 KB
/
cxxplug_gen_proxy.cpp
File metadata and controls
63 lines (51 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include <fstream>
#include <optional>
#include "common/parse_config.hpp"
#include "cxxplug_gen_proxy/args.hpp"
#include "cxxplug_gen_proxy/gen_proxy.hpp"
using namespace std;
int main (int argc, char **argv) {
bool is_verbose = false;
const char *output_dir_name = "./";
const char *interface_file_path_arg = nullptr;
if (
Args::is_argv_wrong(
argc, argv, &output_dir_name, &interface_file_path_arg, &is_verbose
)
) {
cout << Args::get_help();
return -1;
};
Args args(argv + is_verbose, output_dir_name, is_verbose);
if (args.verbose) {
args.print();
}
try {
Parsed config_file_data = Parsed::get_parsed_config(
args.config_file_path
);
if (args.verbose) {
config_file_data.print();
}
string interface_file_path_default;
string_view interface_file_path;
if (interface_file_path_arg) {
interface_file_path = interface_file_path_arg;
}
else {
interface_file_path_default
= string(config_file_data.interface_name)
+ "_interface.hpp";
interface_file_path = interface_file_path_default;
}
ProxyGenerationResult result = generateProxyFiles(
args, config_file_data, interface_file_path
);
cout << result.header << "\n" << result.source;
}
catch (const ifstream::failure &e) {
cerr << "Could not parse config file\n";
return -1;
}
return 0;
}