Arkanjo 0.2
A tool for find code duplicated functions in codebases
Loading...
Searching...
No Matches
SimilarFunctionFinder Class Reference

Similar function locator and reporter. More...

#include <similar_function_finder.hpp>

+ Inheritance diagram for SimilarFunctionFinder:
+ Collaboration diagram for SimilarFunctionFinder:

Public Member Functions

 SimilarFunctionFinder (Similarity_Table *_similarity_table)
 Constructs finder and initiates search.
 
bool validate (const ParsedOptions &options) override
 Validate the arguments already analyzed.
 
bool run (const ParsedOptions &options) override
 Handles similar function finding command.
 
- Public Member Functions inherited from CommandBase< SimilarFunctionFinder >
virtual void print_help (const std::string command_name, const OptionsCollector *collector) const
 
const CliOptionoptions () const final
 
bool do_run (const std::string command_name, const ParsedOptions &options, const OptionsCollector *collector=nullptr) override
 
- Public Member Functions inherited from ICommand
virtual ~ICommand ()=default
 
virtual std::string_view description () const =0
 

Static Public Attributes

static constexpr CliOption options_ []
 

Detailed Description

Similar function locator and reporter.

Identifies functions similar to a specified reference function pattern and provides detailed reporting about the matches found.

Definition at line 31 of file similar_function_finder.hpp.

Constructor & Destructor Documentation

◆ SimilarFunctionFinder()

SimilarFunctionFinder::SimilarFunctionFinder ( Similarity_Table * _similarity_table)
explicit

Constructs finder and initiates search.

Parameters
_function_patternFunction name pattern to match
_similarity_tableSource of similarity data

Definition at line 74 of file similar_function_finder.cpp.

Member Function Documentation

◆ run()

bool SimilarFunctionFinder::run ( const ParsedOptions & options)
overridevirtual

Handles similar function finding command.

Implements ICommand.

Definition at line 96 of file similar_function_finder.cpp.

◆ validate()

bool SimilarFunctionFinder::validate ( const ParsedOptions & options)
overridevirtual

Validate the arguments already analyzed.

Verify that all required options have been selected and that the values ​​provided are valid.

Parameters
optionsThe ParsedOptions structure will be populated with the arguments.
Returns
True if the arguments are valid, false otherwise.

Implements ICommand.

Definition at line 79 of file similar_function_finder.cpp.

Member Data Documentation

◆ options_

CliOption SimilarFunctionFinder::options_[]
staticconstexpr
Initial value:
= {
{"function_name", 0, PositionalArgument, "The tool will match the parameter with any function that has the `FUNCTION_NAME` as a substring."},
{"open", 'o', NoArgument, "Open the folder where the function is located."},
{"show", 's', NoArgument, "Show detailed information and the full source code of the function."},
{"no-numbers", 0, NoArgument, "Hide line numbers in the displayed source code."},
}
#define OPTION_END
This marks the end of a long array of options.
@ NoArgument
@ PositionalArgument

Definition at line 85 of file similar_function_finder.hpp.


The documentation for this class was generated from the following files: