The reflection.h
File Reference
C++ header file with declarations for the µTest++ reflection utilities. More...
Included Headers
#include <string_view>
Namespaces Index
namespace | micro_os_plus |
The primary namespace for the µOS++ framework. More... | |
namespace | micro_os_plus::micro_test_plus |
Primary namespace for the µTest++ testing framework. More... | |
namespace | micro_os_plus::micro_test_plus::reflection |
Reflection utilities for the µTest++ testing framework. More... | |
Classes Index
class | source_location |
Local implementation of source location information for diagnostics. More... | |
Functions Index
const char * | short_name (const char *name) |
Extract a short type or function name from a fully qualified name. More... | |
template <class T> | |
constexpr std::string_view | type_name (void) |
Extract the type name from the | |
Description
C++ header file with declarations for the µTest++ reflection utilities.
This header provides the declarations for the reflection utilities used within the µTest++ framework. It defines interfaces for obtaining source location information and extracting type names at compile time, supporting advanced diagnostics and reporting capabilities.
The reflection utilities include a local implementation of source_location
for environments lacking C++20 standard support, as well as functions for extracting concise type names using compiler-specific macros such as __PRETTY_FUNCTION__
. These facilities enable precise identification of code locations and types in test reports, enhancing the clarity and professionalism of diagnostic output.
All definitions reside within the micro_os_plus::micro_test_plus::reflection
namespace, ensuring clear separation from user code and minimising the risk of naming conflicts.
The header files are organised within the include/micro-os-plus/micro-test-plus
folder to maintain a structured and modular codebase.
This file is intended solely for internal use within the framework and should not be included directly by user code.
Functions
short_name()
|
Extract a short type or function name from a fully qualified name.
- Parameters
name The fully qualified name as a C-string.
- Returns
A pointer to the short name within the input string.
This function extracts the short name from a given file path by locating the final folder separator ('/'). If a separator is found, it returns a pointer to the character immediately following it, effectively providing the file or folder name. If no separator is present, the original input string is returned. This utility is useful for reporting concise file or folder names in test output.
Definition at line 128 of file micro-test-plus.cpp.
type_name()
| nodiscardconstexpr |
Extract the type name from the __PRETTY_FUNCTION__
macro.
This function template parses the compiler-specific __PRETTY_FUNCTION__
macro to extract a concise type name for the template parameter T
.
The implementation is compiler-dependent and may require adjustment for different toolchains. It is primarily intended for internal use within the µTest++ framework to support improved diagnostics and reporting.
- Template Parameters
T The type whose name is to be extracted.
- Parameters
None.
- Returns
A
std::string_view
containing the extracted type name.
Definition at line 133 of file reflection-inlines.h.
File Listing
The file content with the documentation metadata removed is:
Generated via docusaurus-plugin-doxygen by Doxygen 1.14.0.