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

Represents a code function with its content and metadata. More...

#include <function.hpp>

Public Member Functions

int number_of_lines () const
 Calculates the total number of lines in the function.
 
 Function (const Path &_path)
 Constructs a Function object.
 
void load ()
 
std::array< int, 3 > get_scope_function_in_file () const
 Gets the function's line number scope.
 
const std::vector< std::string > & get_header () const
 Gets the function's header content.
 
std::vector< std::string > build_all_content ()
 Builds combined content of header and source.
 
void print_basic_info ()
 Prints formatted function information to console.
 
void print_code (bool no_numbers=false)
 

Detailed Description

Represents a code function with its content and metadata.

Provides access to function source, header, line information, and various utility methods for function manipulation and display.

Definition at line 30 of file function.hpp.

Constructor & Destructor Documentation

◆ Function()

Function::Function ( const Path & _path)
explicit

Constructs a Function object.

Parameters
_pathPath object containing function location info

Definition at line 28 of file function.cpp.

Member Function Documentation

◆ build_all_content()

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

Builds combined content of header and source.

Returns
vector<string> Merged content with header and source

Definition at line 47 of file function.cpp.

◆ get_header()

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

Gets the function's header content.

Returns
vector<string> Each element represents a line of header

Definition at line 43 of file function.cpp.

◆ get_scope_function_in_file()

std::array< int, 3 > Function::get_scope_function_in_file ( ) const

Gets the function's line number scope.

Returns
array<int,3> Array containing: [0] - Declaration line [1] - Start line [2] - End line

Definition at line 39 of file function.cpp.

◆ load()

void Function::load ( )

Definition at line 30 of file function.cpp.

◆ number_of_lines()

int Function::number_of_lines ( ) const

Calculates the total number of lines in the function.

Returns
int Number of lines from declaration to end (inclusive)

Definition at line 24 of file function.cpp.

◆ print_basic_info()

void Function::print_basic_info ( )

Prints formatted function information to console.

Definition at line 65 of file function.cpp.

◆ print_code()

void Function::print_code ( bool no_numbers = false)

Definition at line 80 of file function.cpp.


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