7void Function::read_content() {
12void Function::read_header() {
16void Function::read_info() {
19 line_declaration = info.value(LINE_DECLARATION_JSON, -1);
20 start_number_line = info.value(START_NUMBER_LINE_JSON, -1);
21 end_number_line = info.value(END_NUMBER_LINE_JSON, -1);
25 return end_number_line - line_declaration + 1;
28Function::Function(
const Path& _path) : path(_path), start_number_line(-1), line_declaration(-1), end_number_line(-1) {}
40 return {line_declaration, start_number_line, end_number_line};
49 std::vector<std::string> ret;
51 for (
const auto& line : header) {
54 for (
size_t i = 0; i < content.size(); i++) {
55 auto line = content[i];
70 std::string relative_message = RELATIVE_PATH_PRINT + relative_path;
71 std::string start_message = LINE_DECLARATION_PRINT + std::to_string(line_declaration + 1) +
"-" + std::to_string(end_number_line + 1);
72 std::string number_message = NUMBER_LINE_PRINT + std::to_string(
number_of_lines());
74 std::cout << YELLOW(function_message) <<
'\n';
75 std::cout << GREEN(relative_message) <<
'\n';
76 std::cout << WHITE(start_message) <<
'\n';
77 std::cout << WHITE(number_message) <<
'\n';
83 int line_number = line_declaration + 1;
85 for (
const auto& line : lines) {
87 std::ostringstream oss;
88 oss << std::setw(4) << line_number++;
90 std::cout << CYAN(oss.str()) <<
" | " << line <<
'\n';
92 std::cout << line <<
'\n';
const std::vector< std::string > & get_header() const
Gets the function's header content.
std::array< int, 3 > get_scope_function_in_file() const
Gets the function's line number scope.
Function(const Path &_path)
Constructs a Function object.
std::vector< std::string > build_all_content()
Builds combined content of header and source.
void print_code(bool no_numbers=false)
int number_of_lines() const
Calculates the total number of lines in the function.
void print_basic_info()
Prints formatted function information to console.
Path manipulation class for tool-specific directory structure.
std::string build_relative_path() const
Builds relative path portion.
std::string build_info_path() const
Builds metadata file path.
std::string build_function_name() const
Extracts function name from path.
std::string build_header_path() const
Builds header file path.
std::string build_source_path() const
Builds source file path.
bool is_empty() const
Checks if path is empty.
static std::vector< std::string > read_current_run_params()
read preprocessing parameters runs
Function abstraction for temporary codebase.
json read_json(const fs::path &string_path)
Reads and parses a JSON file, uses nlohmann json library.
std::vector< std::string > read_file_generic(const fs::path &string_path)
Reads a file line by line into a vector of strings.