Arkanjo 0.2
A tool for find code duplicated functions in codebases
Loading...
Searching...
No Matches
function_breaker_c.hpp
Go to the documentation of this file.
1
11#pragma once
12
15#include <array>
16#include <cassert>
17#include <set>
18#include <string>
19#include <tuple>
20#include <vector>
21#include <filesystem>
22namespace fs = std::filesystem;
23
32 const int NUMBER_OF_LINES_BEFORE_FOR_FUNCTION_NAME = 7;
33 const int C_RELEVANT_DEPTH = 0;
34 const bool IGNORE_EMPTY_FUNCTIONS = true;
35 const bool ALLOW_STRUCTS = false;
36
37 vector<string> file_content;
38 vector<vector<bool>> mask_valid;
39
46 bool is_define(size_t line, size_t pos);
47
53 void filter_mask_commentaries_and_defines(vector<vector<bool>>& mask);
54
59 vector<vector<bool>> build_mask_valid_code();
60
65 set<array<int, 5>> find_start_end_and_depth_of_brackets();
66
71 set<array<int, 4>> find_start_end_of_brackets_of_given_depth();
72
81 vector<string> build_function_content(int start_number_line, int start_column, int end_number_line, int end_column);
82
89 bool move_pointer_until_character_outside_parenteses(int& line, int& column);
90
97 tuple<string, int, vector<string>> extract_header_related_information(int start_line, int start_column);
98
107 bool is_body_function_empty(int start_number_line, int start_column, int end_number_line, int end_column);
108
117 void process_function(int start_number_line, int start_column, int end_number_line, int end_column, const fs::path& relative_path);
118
125 fs::path file_path_from_folder_path(const fs::path& file_path, const fs::path& folder_path);
126
132 void file_breaker_c(const fs::path& file_path, const fs::path& folder_path);
133
134 public:
140 FunctionBreakerC(const fs::path& file_path, const fs::path& folder_path);
141};
C/C++ function parser and extractor.
FunctionBreakerC(const fs::path &file_path, const fs::path &folder_path)
Constructs function breaker and processes file.
Function breaker utilities and constants.
Defines utility functions used across all files.