MCPcopy Create free account
hub / github.com/BoomingTech/Piccolo / parseProject

Method parseProject

engine/source/meta_parser/parser/parser/parser.cpp:83–138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81}
82
83bool MetaParser::parseProject()
84{
85 bool result = true;
86 std::cout << "Parsing project file: " << m_project_input_file << std::endl;
87
88 std::fstream include_txt_file(m_project_input_file, std::ios::in);
89
90 if (include_txt_file.fail())
91 {
92 std::cout << "Could not load file: " << m_project_input_file << std::endl;
93 return false;
94 }
95
96 std::stringstream buffer;
97 buffer << include_txt_file.rdbuf();
98
99 std::string context = buffer.str();
100
101 auto inlcude_files = Utils::split(context, ";");
102 std::fstream include_file;
103
104 include_file.open(m_source_include_file_name, std::ios::out);
105 if (!include_file.is_open())
106 {
107 std::cout << "Could not open the Source Include file: " << m_source_include_file_name << std::endl;
108 return false;
109 }
110
111 std::cout << "Generating the Source Include file: " << m_source_include_file_name << std::endl;
112
113 std::string output_filename = Utils::getFileName(m_source_include_file_name);
114
115 if (output_filename.empty())
116 {
117 output_filename = "META_INPUT_HEADER_H";
118 }
119 else
120 {
121 Utils::replace(output_filename, ".", "_");
122 Utils::replace(output_filename, " ", "_");
123 Utils::toUpper(output_filename);
124 }
125 include_file << "#ifndef __" << output_filename << "__" << std::endl;
126 include_file << "#define __" << output_filename << "__" << std::endl;
127
128 for (auto include_item : inlcude_files)
129 {
130 std::string temp_string(include_item);
131 Utils::replace(temp_string, '\\', '/');
132 include_file << "#include \"" << temp_string << "\"" << std::endl;
133 }
134
135 include_file << "#endif" << std::endl;
136 include_file.close();
137 return result;
138}
139
140int MetaParser::parse(void)

Callers

nothing calls this directly

Calls 9

getFileNameFunction · 0.85
replaceFunction · 0.85
toUpperFunction · 0.85
splitFunction · 0.50
failMethod · 0.45
strMethod · 0.45
openMethod · 0.45
emptyMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected