Represents a source code location. More...
Public Member Functions | |
CodeLocation () | |
Creates an empty code location. More... | |
CodeLocation (const char *fileName, const char *functionName, int lineNumber) | |
Creates a code location specified by the given fileName, functionName and lineNumber. More... | |
CodeLocation (const CodeLocation &other) | |
Creates a new code location as a copy of other. More... | |
const CodeLocation & | operator= (CodeLocation rhs) |
Sets the code location to a copy of rhs. More... | |
const char * | fileName () const |
Returns the file name. More... | |
const char * | shortFileName () const |
Returns the short version of the file name. More... | |
const char * | functionName () const |
Returns the function name. More... | |
int | lineNumber () const |
Returns the line number. More... | |
void | swap (CodeLocation &other) |
Swaps this code location with other. More... | |
Represents a source code location.
Typically used with logging, asserts etc. Typically initialized using built-in compiler macros such as __FILE__ and __LINE__.
Note that the string parameters for file name and function must be a static strings with a lifetime that's longer than the lifetime of the CodeLocation object
cee::CodeLocation::CodeLocation | ( | ) |
Creates an empty code location.
cee::CodeLocation::CodeLocation | ( | const char * | fileName, |
const char * | functionName, | ||
int | lineNumber | ||
) |
Creates a code location specified by the given fileName, functionName and lineNumber.
cee::CodeLocation::CodeLocation | ( | const CodeLocation & | other | ) |
Creates a new code location as a copy of other.
const char * cee::CodeLocation::fileName | ( | ) | const |
Returns the file name.
const char * cee::CodeLocation::functionName | ( | ) | const |
Returns the function name.
int cee::CodeLocation::lineNumber | ( | ) | const |
Returns the line number.
const CodeLocation & cee::CodeLocation::operator= | ( | CodeLocation | rhs | ) |
Sets the code location to a copy of rhs.
const char * cee::CodeLocation::shortFileName | ( | ) | const |
Returns the short version of the file name.
void cee::CodeLocation::swap | ( | CodeLocation & | other | ) |
Swaps this code location with other.