-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgen.cpp
More file actions
29 lines (25 loc) · 850 Bytes
/
gen.cpp
File metadata and controls
29 lines (25 loc) · 850 Bytes
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
#include "busybox.hpp"
#include <fstream>
#include <string>
#include <vector>
#include <ctype.h>
int gen_main(int argc,char **argv){
std::string name(argv[1]),uname(argv[1]);
for (auto & c: uname) c = std::toupper(c);
std::fstream header(name+".hpp",std::fstream::out);
std::fstream code(name+".cpp",std::fstream::out);
header << "#ifndef " << uname << "_HEADER" << std::endl;
header << "#define " << uname << "_HEADER" << std::endl;
header << std::endl;
header << "namespace rcl{" << std::endl;
header << std::endl;
header << "}" << std::endl;
header << "#endif" << std::endl;
code << "#include \""<<name << ".hpp"<< "\"" << std::endl;
code << std::endl;
code << "namespace rcl{" << std::endl;
code << std::endl;
code << "}" << std::endl;
return 0;
}
static rcl::reg_app reg("gen_template_tool",gen_main);