6 for(
size_t i = 0; i < s.size(); i++){
17 string extension =
"";
18 int pos_last_dot = -1;
19 for(
size_t i = 0; i < file_path.size(); i++){
20 if(file_path[i] ==
'.'){
24 if(pos_last_dot == -1){
27 for(
size_t i = pos_last_dot+1; i < file_path.size(); i++){
28 extension += file_path[i];
38 final_path += function_name +
"." + extension;
47 final_path += function_name +
"." + extension;
55 final_path +=
INFO_PATH + relative_path +
"/";
56 final_path += function_name +
".json";
60void create_source_file(
int start_number_line,
int end_number_line,
string relative_path,
string function_name,
const vector<string> &function_content){
65void create_header_file(
string relative_path,
string function_name,
const vector<string> &header_content){
71void create_info_file(
int line_declaration,
int start_number_line,
int end_number_line,
string relative_path,
string function_name){
72 vector<string> content;
73 content.push_back(
"{\n");
74 content.push_back(
"\"file_name\":\"" + relative_path +
"\",\n");
75 content.push_back(
"\"function_name\":\"" + function_name +
"\",\n");
76 content.push_back(
"\"line_declaration\":" +
to_string(line_declaration) +
",\n");
77 content.push_back(
"\"start_number_line\":" +
to_string(start_number_line) +
",\n");
78 content.push_back(
"\"end_number_line\":" +
to_string(end_number_line) +
"\n");
79 content.push_back(
"}\n");
Singleton configuration manager class.
static Config * config()
Gets the singleton configuration instance.
string getBasePath()
Gets the current base path.
void create_info_file(int line_declaration, int start_number_line, int end_number_line, string relative_path, string function_name)
Creates JSON metadata file for a function.
string build_info_path(string relative_path, string function_name)
Builds info file path for a function.
string build_source_path(string relative_path, string function_name)
Builds source file path for a function.
void create_header_file(string relative_path, string function_name, const vector< string > &header_content)
Creates header file for a function.
string extract_extension(string file_path)
Extracts file extension from path.
string build_header_path(string relative_path, string function_name)
Builds header file path for a function.
void create_source_file(int start_number_line, int end_number_line, string relative_path, string function_name, const vector< string > &function_content)
Creates source file for a function.
Function breaker utilities and constants.
const string SOURCE_PATH
Directory name for source files.
const string HEADER_PATH
Directory name for header files.
const string INFO_PATH
Directory name for metadata files.
NLOHMANN_BASIC_JSON_TPL_DECLARATION std::string to_string(const NLOHMANN_BASIC_JSON_TPL &j)
user-defined to_string function for JSON values
void write_file_generic(string file_path, vector< string > content)
Writes content to a file at specified path.
int find_position_first_open_bracket(string s)