The source_location
Class Reference
Local implementation of source location information for diagnostics. More...
Declaration
class micro_os_plus::micro_test_plus::reflection::source_location
Included Headers
#include <micro-os-plus/micro-test-plus.h>
Public Member Functions Index
constexpr auto | file_name (void) const noexcept |
Retrieve the file name associated with this source location. More... | |
constexpr auto | line (void) const noexcept |
Retrieve the line number associated with this source location. More... | |
Private Member Attributes Index
const char * | file_ { "unknown" } |
The file name where the source location was captured. More... | |
unsigned int | line_ {} |
The line number where the source location was captured. More... | |
Public Static Functions Index
constexpr auto | current (const char *file="unknown", unsigned int line={}) noexcept |
Obtain the current source location. More... | |
Description
Local implementation of source location information for diagnostics.
This class provides a lightweight, constexpr-compatible alternative to std::source_location
for environments lacking C++20 standard support.
It enables retrieval of the file name and line number at the point of invocation, supporting enhanced diagnostics and reporting within the µTest++ framework.
The static current()
method captures the current source location, using compiler built-ins where available, or defaulting to "unknown"
and zero otherwise.
- Since
3.0.0
Definition at line 136 of file reflection.h.
Public Member Functions
file_name()
| nodiscardconstexprnoexcept |
Retrieve the file name associated with this source location.
- Parameters
None.
- Returns
The file name as a constant character pointer.
...
Declaration at line 164 of file reflection.h, definition at line 104 of file reflection-inlines.h.
line()
| nodiscardconstexprnoexcept |
Retrieve the line number associated with this source location.
- Parameters
None.
- Returns
The line number as an unsigned integer.
...
Declaration at line 174 of file reflection.h, definition at line 114 of file reflection-inlines.h.
Private Member Attributes
file_
|
The file name where the source location was captured.
Definition at line 180 of file reflection.h.
line_
|
The line number where the source location was captured.
Definition at line 185 of file reflection.h.
Public Static Functions
current()
| nodiscardconstexprnoexceptstatic |
Obtain the current source location.
- Parameters
file The file name (automatically provided by the compiler). line The line number (automatically provided by the compiler).
- Returns
A
source_location
instance with the captured information.
Returns a source_location
instance representing the file name and line number at the point of invocation.
If supported by the compiler, uses built-in macros to capture this information; otherwise, defaults to "unknown"
and zero.
Declaration at line 147 of file reflection.h, definition at line 91 of file reflection-inlines.h.
The documentation for this class was generated from the following files:
Generated via docusaurus-plugin-doxygen by Doxygen 1.14.0.