class CodeLocation

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

Public Functions


Creates an empty code location.

CodeLocation(const char *fileName, const char *functionName, int lineNumber)

Creates a code location specified by the given fileName, functionName and lineNumber.

CodeLocation(const CodeLocation &other)

Creates a new code location as a copy of other.

const CodeLocation &operator=(CodeLocation rhs)

Sets the code location to a copy of rhs.

const char *fileName() const

Returns the file name.

const char *shortFileName() const

Returns the short version of the file name.

const char *functionName() const

Returns the function name.

int lineNumber() const

Returns the line number.

void swap(CodeLocation &other)

Swaps this code location with other.