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
12
13#ifndef SIMILARITY_EXPLORER_HPP
14#define SIMILARITY_EXPLORER_HPP
15
16#include <bits/stdc++.h>
17
18#include "../base/path.hpp"
19#include "../base/function.hpp"
20#include "../base/utils.hpp"
22using namespace std;
23
31 public:
33 string EMPTY_PATTERN = "";
34
35 private:
36 string BETWEEN_RELATIVE_AND_FUNCTION_NAME = "::";
37 string START_LINE_COMPARATION_PRINT = "Functions find: ";
38 string BETWEEN_TWO_FUNCTION = " AND ";
39 string NUMBER_LINES_MESSAGE = " , TOTAL NUMBER LINES IN FUNCTIONS: ";
40 string INITIAL_TEXT_PRINT_1 = "It was found a total of ";
41 string INITIAL_TEXT_PRINT_2 = " pair of duplicate functions in the codebase. Which the first ";
42 string INITIAL_TEXT_PRINT_3 = " can be found below.";
43 int INITIAL_PROCESSED_RESULTS = 0;
44
45 Similarity_Table *similarity_table;
46 int limit_on_results;
47 string pattern_to_match;
48 bool both_path_need_to_match_pattern;
49 int processed_results = INITIAL_PROCESSED_RESULTS;
50
55 Utils::COLOR choose_text_color();
56
62 int find_number_pairs_show(int number_pair_found);
63
69 string format_initial_message(int number_pair_found);
70
77 bool match_pattern(Path path1, Path path2);
78
84 string format_path_message_in_pair(Path path);
85
91 int find_number_lines(Path path1);
92
98 void print_similar_path_pair(Path path1, Path path2);
99
105 void process_similar_path_pair(Path path1, Path path2);
106
112 int find_number_pair_found(vector<pair<Path,Path>> similar_path_pairs);
113
119 vector<pair<Path,Path>> build_similar_path_pairs(bool sorted_by_number_of_duplicated_code);
120
125 void explorer(bool sorted_by_number_of_duplicated_code);
126
127 public:
136 Similarity_Explorer(Similarity_Table *_similarity_table,
137 int _limit_on_results,
138 string _pattern_to_match,
139 bool _both_path_need_to_match,
140 bool sorted_by_number_of_duplicated_code=false);
141};
142
143#endif
Path manipulation class for tool-specific directory structure.
Definition path.hpp:24
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:94
Path abstraction for temporary codebase.
Similarity relationships storage and analysis.
Defines utility functions used across all files.