ArKanjo 0.5.1
A tool for find code duplicated functions in codebases
Function Class Reference

Represents a function extracted from a codebase. More...

#include <function.hpp>

Public Member Functions

 Function ()=default
 
 Function (const Path &_path)
 Constructs a Function object. More...
 
const Path & path () const
 Gets the function path information. More...
 
const std::string & name () const
 Gets the function name. More...
 
const FunctionLocation & scope_location () const
 Gets the function location inside the source file. More...
 
const std::vector< std::string > & header () const
 Gets the function's header content. More...
 
std::vector< std::string > build_all_content () const
 Builds combined content of header and source. More...
 
bool contains_given_pattern (const std::string &pattern) const
 Checks whether the function contains a pattern. More...
 

Friends

class FunctionLoader
 

Detailed Description

Represents a function extracted from a codebase.

Provides access to function source content, header content, file location, and metadata.

Definition at line 45 of file function.hpp.

Constructor & Destructor Documentation

◆ Function() [1/2]

Function::Function ( )
default

◆ Function() [2/2]

Function::Function ( const Path &  _path)
explicit

Constructs a Function object.

Parameters
_pathPath object containing function location info

Definition at line 13 of file function.cpp.

Member Function Documentation

◆ build_all_content()

std::vector< std::string > Function::build_all_content ( ) const

Builds combined content of header and source.

Returns
Vector containing the merged header and source lines.

Definition at line 25 of file function.cpp.

◆ contains_given_pattern()

bool Function::contains_given_pattern ( const std::string &  pattern) const

Checks whether the function contains a pattern.

Parameters
Textpattern to search.
Returns
if the pattern is found.

Definition at line 41 of file function.cpp.

◆ header()

const std::vector< std::string > & Function::header ( ) const

Gets the function's header content.

Returns
Reference to the header lines.

Definition at line 21 of file function.cpp.

◆ name()

const std::string & Function::name ( ) const

Gets the function name.

Returns
Function name identifier

Definition at line 9 of file function.cpp.

◆ path()

const Path & Function::path ( ) const

Gets the function path information.

Returns
Path associated with this function.

Definition at line 5 of file function.cpp.

◆ scope_location()

const FunctionLocation & Function::scope_location ( ) const

Gets the function location inside the source file.

Contains declaration, begin, and end line numbers.

Definition at line 17 of file function.cpp.

Friends And Related Function Documentation

◆ FunctionLoader

friend class FunctionLoader
friend

Definition at line 46 of file function.hpp.


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