0.5.4
C++ to UML diagram generator based on Clang
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
clanguml::common::model::source_location Class Reference

Base class of all diagram elements that have source location. More...

Detailed Description

Base class of all diagram elements that have source location.

Definition at line 30 of file source_location.h.

#include <source_location.h>

Public Member Functions

 source_location ()=default
 
 source_location (std::string f, unsigned int l)
 
const std::string & file () const
 
void set_file (const std::string &file)
 
const std::string & file_relative () const
 
void set_file_relative (const std::string &file)
 
const std::string & translation_unit () const
 
void set_translation_unit (const std::string &translation_unit)
 
unsigned int line () const
 
void set_line (const unsigned line)
 
unsigned int column () const
 
void set_column (const unsigned column)
 
unsigned int location_id () const
 
void set_location_id (unsigned int h)
 

Private Attributes

std::string file_
 
std::string file_relative_
 
std::string translation_unit_
 
unsigned int line_ {0}
 
unsigned int column_ {0}
 
unsigned int hash_ {0}
 

Constructor & Destructor Documentation

◆ source_location() [1/2]

clanguml::common::model::source_location::source_location ( )
default

◆ source_location() [2/2]

clanguml::common::model::source_location::source_location ( std::string  f,
unsigned int  l 
)
inline

Definition at line 34 of file source_location.h.

35 : file_{std::move(f)}
36 , line_{l}
37 {
38 }

Member Function Documentation

◆ column()

unsigned int clanguml::common::model::source_location::column ( ) const
inline

Get the source location column number.

Returns
Column number.

Definition at line 105 of file source_location.h.

105{ return column_; }

◆ file()

const std::string & clanguml::common::model::source_location::file ( ) const
inline

Return absolute source file path.

Returns
Absolute file path.

Definition at line 45 of file source_location.h.

45{ return file_; }

◆ file_relative()

const std::string & clanguml::common::model::source_location::file_relative ( ) const
inline

Return source file path relative to relative_to config option.

Returns
Relative file path.

Definition at line 59 of file source_location.h.

59{ return file_relative_; }

◆ line()

unsigned int clanguml::common::model::source_location::line ( ) const
inline

Get the source location line number.

Returns
Line number.

Definition at line 91 of file source_location.h.

91{ return line_; }

◆ location_id()

unsigned int clanguml::common::model::source_location::location_id ( ) const
inline

Get the source location id.

The location id is equivalent to Clang's SourceLocation::getHashValue()

Returns
Location id.

Definition at line 121 of file source_location.h.

121{ return hash_; }

◆ set_column()

void clanguml::common::model::source_location::set_column ( const unsigned  column)
inline

Set the source location column number.

Parameters
lineColumn number.

Definition at line 112 of file source_location.h.

112{ column_ = column; }

◆ set_file()

void clanguml::common::model::source_location::set_file ( const std::string &  file)
inline

Set absolute file path.

Parameters
fileAbsolute file path.

Definition at line 52 of file source_location.h.

52{ file_ = file; }

◆ set_file_relative()

void clanguml::common::model::source_location::set_file_relative ( const std::string &  file)
inline

Set relative file path.

Parameters
fileRelative file path.

Definition at line 66 of file source_location.h.

◆ set_line()

void clanguml::common::model::source_location::set_line ( const unsigned  line)
inline

Set the source location line number.

Parameters
lineLine number.

Definition at line 98 of file source_location.h.

98{ line_ = line; }

◆ set_location_id()

void clanguml::common::model::source_location::set_location_id ( unsigned int  h)
inline

Set the source location id.

The location id is equivalent to Clang's SourceLocation::getHashValue()

Parameters
hLocation id.

Definition at line 130 of file source_location.h.

130{ hash_ = h; }

◆ set_translation_unit()

void clanguml::common::model::source_location::set_translation_unit ( const std::string &  translation_unit)
inline

Set the path to translation unit, from which this source location was visited.

Parameters
translation_unitPath to the translation unit.

Definition at line 81 of file source_location.h.

◆ translation_unit()

const std::string & clanguml::common::model::source_location::translation_unit ( ) const
inline

Get the translation unit, from which this source location was visited.

Returns
Path to the translation unit.

Definition at line 73 of file source_location.h.

73{ return translation_unit_; }

Member Data Documentation

◆ column_

unsigned int clanguml::common::model::source_location::column_ {0}
private

Definition at line 137 of file source_location.h.

◆ file_

std::string clanguml::common::model::source_location::file_
private

Definition at line 133 of file source_location.h.

◆ file_relative_

std::string clanguml::common::model::source_location::file_relative_
private

Definition at line 134 of file source_location.h.

◆ hash_

unsigned int clanguml::common::model::source_location::hash_ {0}
private

Definition at line 138 of file source_location.h.

◆ line_

unsigned int clanguml::common::model::source_location::line_ {0}
private

Definition at line 136 of file source_location.h.

◆ translation_unit_

std::string clanguml::common::model::source_location::translation_unit_
private

Definition at line 135 of file source_location.h.


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