Arkanjo 0.1
A tool for find code duplicated functions in codebases
Loading...
Searching...
No Matches
similarity_explorer.hpp
Go to the documentation of this file.
1
13#ifndef SIMILARITY_EXPLORER_HPP
14#define SIMILARITY_EXPLORER_HPP
15
16#include <string>
17#include <vector>
18#include <utility>
19
20#include "../base/path.hpp"
21#include "../base/function.hpp"
22#include "../base/utils.hpp"
24using namespace std;
25
33 public:
35 string EMPTY_PATTERN = "";
36
37 private:
38 string BETWEEN_RELATIVE_AND_FUNCTION_NAME = "::";
39 string START_LINE_COMPARATION_PRINT = "Functions find: ";
40 string BETWEEN_TWO_FUNCTION = " AND ";
41 string NUMBER_LINES_MESSAGE = " , TOTAL NUMBER LINES IN FUNCTIONS: ";
42 string INITIAL_TEXT_PRINT_1 = "It was found a total of ";
43 string INITIAL_TEXT_PRINT_2 = " pair of duplicate functions in the codebase. Which the first ";
44 string INITIAL_TEXT_PRINT_3 = " can be found below.";
45 int INITIAL_PROCESSED_RESULTS = 0;
46
47 Similarity_Table *similarity_table;
48 int limit_on_results;
49 string pattern_to_match;
50 bool both_path_need_to_match_pattern;
51 int processed_results = INITIAL_PROCESSED_RESULTS;
52
57 Utils::COLOR choose_text_color();
58
64 int find_number_pairs_show(int number_pair_found);
65
71 string format_initial_message(int number_pair_found);
72
79 bool match_pattern(Path path1, Path path2);
80
86 string format_path_message_in_pair(Path path);
87
93 int find_number_lines(Path path1);
94
100 void print_similar_path_pair(Path path1, Path path2);
101
107 void process_similar_path_pair(Path path1, Path path2);
108
114 int find_number_pair_found(vector<pair<Path,Path>> similar_path_pairs);
115
121 vector<pair<Path,Path>> build_similar_path_pairs(bool sorted_by_number_of_duplicated_code);
122
127 void explorer(bool sorted_by_number_of_duplicated_code);
128
129 public:
138 Similarity_Explorer(Similarity_Table *_similarity_table,
139 int _limit_on_results,
140 string _pattern_to_match,
141 bool _both_path_need_to_match,
142 bool sorted_by_number_of_duplicated_code=false);
143};
144
145#endif
Path manipulation class for tool-specific directory structure.
Definition path.hpp:27
Duplicate function explorer and analyzer.
string EMPTY_PATTERN
Constant for empty search pattern.
Similarity_Explorer(Similarity_Table *_similarity_table, int _limit_on_results, string _pattern_to_match, bool _both_path_need_to_match, bool sorted_by_number_of_duplicated_code=false)
Constructs explorer with configuration.
int UNLIMITED_RESULTS
Constant for unlimited results display.
Manages and analyzes function similarity relationships.
Function abstraction for temporary codebase.
COLOR
Enumeration of available colors for formatted messages.
Definition utils.hpp:103
Definition json.hpp:5678
Path abstraction for temporary codebase.
Similarity relationships storage and analysis.
Defines utility functions used across all files.