expression_formatter Class
Formats values and expressions into an owned string buffer. More...
Declaration
Included Headers
Public Constructors Index
| expression_formatter (colours &colours) noexcept | |
|
Constructor with colour configuration. More... | |
| expression_formatter (const expression_formatter &)=delete | |
|
Deleted copy constructor to prevent copying. More... | |
| expression_formatter (expression_formatter &&)=delete | |
|
Deleted move constructor to prevent moving. More... | |
Public Destructor Index
| ~expression_formatter ()=default | |
|
Default destructor. More... | |
Public Operators Index
| expression_formatter & | operator<< (bool v) |
|
Appends the string representation of a boolean value. More... | |
| expression_formatter & | operator<< (char c) |
|
Appends a single character to the buffer. More... | |
| expression_formatter & | operator<< (const char *s) |
|
Appends a null-terminated C string to the buffer. More... | |
template <class Lhs_T, class Rhs_T> | |
| expression_formatter & | operator<< (const detail::and_< Lhs_T, Rhs_T > &op) |
|
Formats a logical AND as (lhs and rhs). More... | |
template <class Lhs_T, class Rhs_T> | |
| expression_formatter & | operator<< (const detail::eq_< Lhs_T, Rhs_T > &op) |
|
Formats an equality comparison as lhs == rhs. More... | |
template <class Lhs_T, class Rhs_T> | |
| expression_formatter & | operator<< (const detail::ge_< Lhs_T, Rhs_T > &op) |
|
Formats a greater-than-or-equal comparison as lhs >= rhs. More... | |
template <class Lhs_T, class Rhs_T> | |
| expression_formatter & | operator<< (const detail::gt_< Lhs_T, Rhs_T > &op) |
|
Formats a greater-than comparison as lhs > rhs. More... | |
template <class Lhs_T, class Rhs_T> | |
| expression_formatter & | operator<< (const detail::le_< Rhs_T, Lhs_T > &op) |
|
Formats a less-than-or-equal comparison as lhs <= rhs. More... | |
template <class Lhs_T, class Rhs_T> | |
| expression_formatter & | operator<< (const detail::lt_< Rhs_T, Lhs_T > &op) |
|
Formats a less-than comparison as lhs < rhs. More... | |
template <class Lhs_T, class Rhs_T> | |
| expression_formatter & | operator<< (const detail::ne_< Lhs_T, Rhs_T > &op) |
|
Formats an inequality comparison as lhs != rhs. More... | |
template <class T> | |
| expression_formatter & | operator<< (const detail::not_< T > &op) |
|
Formats a logical NOT as not operand. More... | |
template <class Callable_T> | |
| expression_formatter & | operator<< (const detail::nothrow_< Callable_T > &op) |
template <class Lhs_T, class Rhs_T> | |
| expression_formatter & | operator<< (const detail::or_< Lhs_T, Rhs_T > &op) |
|
Formats a logical OR as (lhs or rhs). More... | |
template <class Callable_T, class Exception_T> | |
| expression_formatter & | operator<< (const detail::throws_< Callable_T, Exception_T > &op) |
|
Formats a typed throws expression as throws<TypeName>. More... | |
template <class Callable_T> | |
| expression_formatter & | operator<< (const detail::throws_< Callable_T, void > &op) |
template <class T> | |
| expression_formatter & | operator<< (const T &t) |
|
Appends a container's elements enclosed in braces. More... | |
template <class T> | |
| expression_formatter & | operator<< (const T &t) |
|
Appends the value of an op expression via detail::get. More... | |
template <class T> | |
| expression_formatter & | operator<< (const type_traits::genuine_integral_value< T > &v) |
|
Appends a genuine integral value without a type suffix. More... | |
| expression_formatter & | operator<< (double v) |
|
Appends a double value (no suffix). More... | |
| expression_formatter & | operator<< (float v) |
|
Appends a float value with type suffix "f". More... | |
| expression_formatter & | operator<< (long double v) |
|
Appends a long double value with type suffix "l". More... | |
| expression_formatter & | operator<< (signed char c) |
|
Appends a signed char value with type suffix "c". More... | |
| expression_formatter & | operator<< (signed int v) |
|
Appends a signed int value (no suffix). More... | |
| expression_formatter & | operator<< (signed long long v) |
|
Appends a signed long long value with type suffix "ll". More... | |
| expression_formatter & | operator<< (signed long v) |
|
Appends a signed long value with type suffix "l". More... | |
| expression_formatter & | operator<< (signed short v) |
|
Appends a signed short value with type suffix "s". More... | |
| expression_formatter & | operator<< (std::nullptr_t) |
|
Appends the string "nullptr". More... | |
| expression_formatter & | operator<< (std::string_view sv) |
|
Appends a string view to the buffer. More... | |
template <typename T> | |
| expression_formatter & | operator<< (T *v) |
|
Appends the hexadecimal address of a pointer. More... | |
| expression_formatter & | operator<< (unsigned char c) |
|
Appends an unsigned char value with type suffix "uc". More... | |
| expression_formatter & | operator<< (unsigned int v) |
|
Appends an unsigned int value with type suffix "u". More... | |
| expression_formatter & | operator<< (unsigned long long v) |
|
Appends an unsigned long long value with type suffix "ull". More... | |
| expression_formatter & | operator<< (unsigned long v) |
|
Appends an unsigned long value with type suffix "ul". More... | |
| expression_formatter & | operator<< (unsigned short v) |
|
Appends an unsigned short value with type suffix "us". More... | |
| expression_formatter & | operator= (const expression_formatter &)=delete |
|
Deleted copy assignment operator to prevent copying. More... | |
| expression_formatter & | operator= (expression_formatter &&)=delete |
|
Deleted move assignment operator to prevent moving. More... | |
Public Member Functions Index
| void | append (size_t count, char ch) |
|
Appends a sequence of identical characters to the buffer. More... | |
| const char * | c_str () const noexcept |
|
Returns a pointer to the null-terminated buffer contents. More... | |
| void | clear () noexcept |
|
Clears the internal buffer. More... | |
| bool | empty () const noexcept |
|
Returns whether the internal buffer is empty. More... | |
| void | reserve (size_t capacity) |
|
Reserves storage in the internal buffer. More... | |
| const std::string & | str () const noexcept |
|
Returns a const reference to the internal buffer. More... | |
Protected Member Functions Index
| auto | colour_ (const bool cond) const |
|
Selects the appropriate colour code based on a condition. More... | |
Protected Member Attributes Index
| std::string | buffer_ {} |
|
The internal output buffer. More... | |
| colours & | colours_ |
|
ANSI colour codes for output formatting. More... | |
Description
Formats values and expressions into an owned string buffer.
expression_formatter owns a std::string buffer and provides operator<< overloads for all standard arithmetic types, character types, strings, pointers, containers, and framework expression types derived from detail::op.
The numeric overloads append a type suffix (e.g., 42u, 3l, 1.0f) matching the conventions used in the existing reporter output, so that the formatted text is identical whether produced by the reporter directly or pre-formatted by a deferred reporter.
The class is non-copyable and non-movable to avoid accidental copying of the internal buffer.
Definition at line 150 of file expression-formatter.h.
Public Constructors
expression_formatter()
| inline noexcept |
Constructor with colour configuration.
- Parameters
-
colours Reference to a colours instance for output formatting.
Initializes the colours_ reference with the provided colours instance. The internal buffer is default-initialized to an empty string.
Declaration at line 159 of file expression-formatter.h, definition at line 79 of file expression-formatter-inlines.h.
Reference colours_.
Referenced by expression_formatter, expression_formatter, ~expression_formatter, operator<<, operator<<, operator<<, operator<<, operator<<, operator<<, operator<<, operator<<, operator<<, operator<<, operator<<, operator<<, operator<<, operator<<, operator<<, operator<<, operator<<, operator<<, operator<<, operator<<, operator<<, operator<<, operator<<, operator<<, operator<<, operator<<, operator<<, operator<<, operator<<, operator<<, operator<<, operator<<, operator<<, operator= and operator=.
expression_formatter()
| delete |
Deleted copy constructor to prevent copying.
Definition at line 164 of file expression-formatter.h.
Reference expression_formatter.
expression_formatter()
| delete |
Deleted move constructor to prevent moving.
Definition at line 169 of file expression-formatter.h.
Reference expression_formatter.
Public Destructor
~expression_formatter()
| default |
Default destructor.
Definition at line 188 of file expression-formatter.h.
Reference expression_formatter.
Public Operators
operator<<()
|
Appends the string representation of a boolean value.
- Parameters
-
v The boolean value.
- Returns
Reference to this instance.
Appends the string "true" or "false" to the internal buffer based on the value of v.
Declaration at line 226 of file expression-formatter.h, definition at line 102 of file expression-formatter.cpp.
References expression_formatter and buffer_.
operator<<()
|
Appends a single character to the buffer.
- Parameters
-
c The character to append.
- Returns
Reference to this instance.
Appends the single character c to the internal buffer using buffer_.append(1, c).
Declaration at line 208 of file expression-formatter.h, definition at line 78 of file expression-formatter.cpp.
References expression_formatter and buffer_.
operator<<()
|
Appends a null-terminated C string to the buffer.
- Parameters
-
s The C string to append.
- Returns
Reference to this instance.
Appends the null-terminated C string s to the internal buffer using buffer_.append(s).
Declaration at line 217 of file expression-formatter.h, definition at line 90 of file expression-formatter.cpp.
References expression_formatter and buffer_.
operator<<()
|
Formats a logical AND as (lhs and rhs).
- Template Parameters
-
Lhs_T Left-hand operand type.
Rhs_T Right-hand operand type.
- Parameters
-
op The logical AND expression.
- Returns
Reference to this instance.
This operator overload enables the reporter to output logical conjunction (AND) expressions in a clear and structured format.
The left-hand side and right-hand side expressions are enclosed in parentheses and separated by the word "and", with appropriate colour highlighting applied for improved readability in test reports and diagnostics. This presentation assists in quickly identifying the components of logical assertions and facilitates efficient debugging of test failures involving compound conditions.
Declaration at line 496 of file expression-formatter.h, definition at line 395 of file expression-formatter-inlines.h.
References expression_formatter, colour_, colours_, micro_os_plus::micro_test_plus::detail::binary_op_< Lhs_T, Rhs_T >::lhs and micro_os_plus::micro_test_plus::detail::binary_op_< Lhs_T, Rhs_T >::rhs.
operator<<()
|
Formats an equality comparison as lhs == rhs.
- Template Parameters
-
Lhs_T Left-hand operand type.
Rhs_T Right-hand operand type.
- Parameters
-
op The equality expression.
- Returns
Reference to this instance.
This operator overload enables the reporter to output equality comparison expressions in a clear and expressive format.
The left-hand side and right-hand side values are formatted and separated by the equality operator (==), with appropriate colour highlighting applied for improved readability in test reports and diagnostics. This structured output assists in quickly identifying the values involved in equality assertions and facilitates efficient debugging of test failures.
Declaration at line 424 of file expression-formatter.h, definition at line 274 of file expression-formatter-inlines.h.
References expression_formatter, colour_, colours_, micro_os_plus::micro_test_plus::detail::binary_op_< Lhs_T, Rhs_T >::lhs and micro_os_plus::micro_test_plus::detail::binary_op_< Lhs_T, Rhs_T >::rhs.
operator<<()
|
Formats a greater-than-or-equal comparison as lhs >= rhs.
- Template Parameters
-
Lhs_T Left-hand operand type.
Rhs_T Right-hand operand type.
- Parameters
-
op The greater-than-or-equal expression.
- Returns
Reference to this instance.
This operator overload enables the reporter to output greater-than-or-equal-to comparison expressions in a clear and expressive format.
The left-hand side and right-hand side values are formatted and separated by the greater-than-or-equal-to operator (>=), with appropriate colour highlighting applied for improved readability in test reports and diagnostics. This structured output assists in quickly identifying the values involved in greater-than-or-equal-to assertions and facilitates efficient debugging of test failures.
Declaration at line 460 of file expression-formatter.h, definition at line 335 of file expression-formatter-inlines.h.
References expression_formatter, colour_, colours_, micro_os_plus::micro_test_plus::detail::binary_op_< Lhs_T, Rhs_T >::lhs and micro_os_plus::micro_test_plus::detail::binary_op_< Lhs_T, Rhs_T >::rhs.
operator<<()
|
Formats a greater-than comparison as lhs > rhs.
- Template Parameters
-
Lhs_T Left-hand operand type.
Rhs_T Right-hand operand type.
- Parameters
-
op The greater-than expression.
- Returns
Reference to this instance.
This operator overload enables the reporter to output greater-than comparison expressions in a clear and expressive format.
The left-hand side and right-hand side values are formatted and separated by the greater-than operator (>), with appropriate colour highlighting applied for improved readability in test reports and diagnostics. This structured output assists in quickly identifying the values involved in greater-than assertions and facilitates efficient debugging of test failures.
Declaration at line 448 of file expression-formatter.h, definition at line 314 of file expression-formatter-inlines.h.
References expression_formatter, colour_, colours_, micro_os_plus::micro_test_plus::detail::binary_op_< Lhs_T, Rhs_T >::lhs and micro_os_plus::micro_test_plus::detail::binary_op_< Lhs_T, Rhs_T >::rhs.
operator<<()
|
Formats a less-than-or-equal comparison as lhs <= rhs.
- Template Parameters
-
Lhs_T Left-hand operand type.
Rhs_T Right-hand operand type.
- Parameters
-
op The less-than-or-equal expression.
- Returns
Reference to this instance.
This operator overload enables the reporter to output less-than-or-equal-to comparison expressions in a clear and expressive format.
The left-hand side and right-hand side values are formatted and separated by the less-than-or-equal-to operator (<=), with appropriate colour highlighting applied for improved readability in test reports and diagnostics. This structured output assists in quickly identifying the values involved in less-than-or-equal-to assertions and facilitates efficient debugging of test failures.
Declaration at line 484 of file expression-formatter.h, definition at line 375 of file expression-formatter-inlines.h.
References expression_formatter, colour_, colours_, micro_os_plus::micro_test_plus::detail::binary_op_< Lhs_T, Rhs_T >::lhs and micro_os_plus::micro_test_plus::detail::binary_op_< Lhs_T, Rhs_T >::rhs.
operator<<()
|
Formats a less-than comparison as lhs < rhs.
- Template Parameters
-
Lhs_T Left-hand operand type.
Rhs_T Right-hand operand type.
- Parameters
-
op The less-than expression.
- Returns
Reference to this instance.
This operator overload enables the reporter to output less-than comparison expressions in a clear and expressive format.
The left-hand side and right-hand side values are formatted and separated by the less-than operator (<), with appropriate colour highlighting applied for improved readability in test reports and diagnostics. This structured output assists in quickly identifying the values involved in less-than assertions and facilitates efficient debugging of test failures.
Declaration at line 472 of file expression-formatter.h, definition at line 354 of file expression-formatter-inlines.h.
References expression_formatter, colour_, colours_, micro_os_plus::micro_test_plus::detail::binary_op_< Lhs_T, Rhs_T >::lhs and micro_os_plus::micro_test_plus::detail::binary_op_< Lhs_T, Rhs_T >::rhs.
operator<<()
|
Formats an inequality comparison as lhs != rhs.
- Template Parameters
-
Lhs_T Left-hand operand type.
Rhs_T Right-hand operand type.
- Parameters
-
op The inequality expression.
- Returns
Reference to this instance.
This operator overload enables the reporter to output inequality comparison expressions in a clear and expressive format.
The left-hand side and right-hand side values are formatted and separated by the inequality operator (!=), with appropriate colour highlighting applied for improved readability in test reports and diagnostics. This structured output assists in quickly identifying the values involved in inequality assertions and facilitates efficient debugging of test failures.
Declaration at line 436 of file expression-formatter.h, definition at line 294 of file expression-formatter-inlines.h.
References expression_formatter, colour_, colours_, micro_os_plus::micro_test_plus::detail::binary_op_< Lhs_T, Rhs_T >::lhs and micro_os_plus::micro_test_plus::detail::binary_op_< Lhs_T, Rhs_T >::rhs.
operator<<()
|
Formats a logical NOT as not operand.
- Template Parameters
-
T The operand type.
- Parameters
-
op The logical NOT expression.
- Returns
Reference to this instance.
This operator overload enhances readability and clarity by formatting the output when handling negated expressions. It applies colour styling for improved distinction and appends the negated value accordingly, ensuring that logical negations are clearly represented in test reports and diagnostics.
Declaration at line 519 of file expression-formatter.h, definition at line 431 of file expression-formatter-inlines.h.
References expression_formatter, colour_, colours_ and micro_os_plus::micro_test_plus::detail::unary_op_< T >::operand.
operator<<()
|
Formats a nothrow expression as nothrow.
- Template Parameters
-
Callable_T The callable type.
- Parameters
-
op The nothrow expression.
- Returns
Reference to this instance.
This operator overload formats output for expressions that do not throw exceptions. It applies colour styling for clarity and ensures a structured and concise representation of exception safety within test reports.
The output highlights the nothrow qualifier, making it immediately apparent when an expression is guaranteed not to throw, thereby improving the readability and professionalism of the test output.
Declaration at line 555 of file expression-formatter.h, definition at line 489 of file expression-formatter-inlines.h.
References expression_formatter, colour_ and colours_.
operator<<()
|
Formats a logical OR as (lhs or rhs).
- Template Parameters
-
Lhs_T Left-hand operand type.
Rhs_T Right-hand operand type.
- Parameters
-
op The logical OR expression.
- Returns
Reference to this instance.
This operator overload enables the reporter to output logical disjunction (OR) expressions in a clear and structured format.
The left-hand side and right-hand side expressions are enclosed in parentheses and separated by the word "or", with appropriate colour highlighting applied for improved readability in test reports and diagnostics. This presentation assists in quickly identifying the components of logical assertions and facilitates efficient debugging of test failures involving compound conditions.
Declaration at line 508 of file expression-formatter.h, definition at line 415 of file expression-formatter-inlines.h.
References expression_formatter, colour_, colours_, micro_os_plus::micro_test_plus::detail::binary_op_< Lhs_T, Rhs_T >::lhs and micro_os_plus::micro_test_plus::detail::binary_op_< Lhs_T, Rhs_T >::rhs.
operator<<()
|
Formats a typed throws expression as throws<TypeName>.
- Template Parameters
-
Callable_T The callable type.
Exception_T The expected exception type.
- Parameters
-
op The throws expression.
- Returns
Reference to this instance.
This operator overload provides structured output for expressions that may throw exceptions. It applies colour styling for clarity and includes the exception type name for precise identification.
When invoked, the output highlights the throws qualifier along with the specific exception type, making it immediately apparent which exception is expected. This enhances the readability and professionalism of test reports, and assists in the precise identification and debugging of exception-related test cases.
Declaration at line 533 of file expression-formatter.h, definition at line 451 of file expression-formatter-inlines.h.
References expression_formatter, colour_, colours_ and micro_os_plus::micro_test_plus::reflection::type_name.
operator<<()
|
Formats an untyped throws expression as throws.
- Template Parameters
-
Callable_T The callable type.
- Parameters
-
op The throws expression.
- Returns
Reference to this instance.
This operator overload formats output for expressions that may throw exceptions. It applies colour styling for clarity and ensures a structured representation of the exception handling mechanism.
When invoked, the output highlights the throws qualifier, making it immediately apparent when an expression is expected to throw, thereby improving the readability and professionalism of the test output.
Declaration at line 544 of file expression-formatter.h, definition at line 471 of file expression-formatter-inlines.h.
References expression_formatter, colour_ and colours_.
operator<<()
|
Appends a container's elements enclosed in braces.
Elements are formatted as { e1, e2, … } by iterating the container and recursing through operator<< for each element.
- Template Parameters
-
T A container type satisfying type_traits::container_like that does not have npos.
- Parameters
-
t The container.
- Returns
Reference to this instance.
Definition at line 409 of file expression-formatter.h.
References expression_formatter, append, c_str, clear, colour_, empty and reserve.
operator<<()
|
Appends the value of an op expression via detail::get.
- Template Parameters
-
T An expression type satisfying type_traits::is_op<T>.
- Parameters
-
t The expression object.
- Returns
Reference to this instance.
Delegates to detail::get(t) to obtain the displayable value of an op expression, then streams it through operator<< to format it into the buffer.
Iterates the container and formats each element separated by ", ", surrounded by { and }. Each element is streamed through operator<<, which recurses as needed for nested types.
Declaration at line 380 of file expression-formatter.h, definition at line 216 of file expression-formatter-inlines.h.
References expression_formatter and micro_os_plus::micro_test_plus::detail::get.
operator<<()
|
Appends a genuine integral value without a type suffix.
- Template Parameters
-
T The underlying integral type.
- Parameters
-
v The strongly-typed integral value.
- Returns
Reference to this instance.
Casts the underlying integral value to long long and formats it without a type suffix, appending the result to the buffer.
Declaration at line 391 of file expression-formatter.h, definition at line 229 of file expression-formatter-inlines.h.
References expression_formatter, micro_os_plus::micro_test_plus::detail::append_number_, buffer_ and micro_os_plus::micro_test_plus::type_traits::value_base_< T >::get.
operator<<()
|
Appends a double value (no suffix).
- Parameters
-
v The double value.
- Returns
Reference to this instance.
Converts v to its string representation via append_number_() without a type suffix.
Declaration at line 341 of file expression-formatter.h, definition at line 267 of file expression-formatter.cpp.
References expression_formatter, micro_os_plus::micro_test_plus::detail::append_number_ and buffer_.
operator<<()
|
Appends a float value with type suffix "f".
- Parameters
-
v The float value.
- Returns
Reference to this instance.
Converts v to its string representation via append_number_() and appends the type suffix "f".
Declaration at line 332 of file expression-formatter.h, definition at line 254 of file expression-formatter.cpp.
References expression_formatter, micro_os_plus::micro_test_plus::detail::append_number_ and buffer_.
operator<<()
|
Appends a long double value with type suffix "l".
- Parameters
-
v The long double value.
- Returns
Reference to this instance.
Converts v to its string representation via append_number_() and appends the type suffix "l".
Declaration at line 350 of file expression-formatter.h, definition at line 279 of file expression-formatter.cpp.
References expression_formatter, micro_os_plus::micro_test_plus::detail::append_number_ and buffer_.
operator<<()
|
Appends a signed char value with type suffix "c".
- Parameters
-
c The signed char value.
- Returns
Reference to this instance.
Converts c to its decimal string representation via append_number_() and appends the type suffix "c".
Declaration at line 242 of file expression-formatter.h, definition at line 125 of file expression-formatter.cpp.
References expression_formatter, micro_os_plus::micro_test_plus::detail::append_number_ and buffer_.
operator<<()
|
Appends a signed int value (no suffix).
- Parameters
-
v The signed int value.
- Returns
Reference to this instance.
Converts v to its decimal string representation via append_number_() without a type suffix.
Declaration at line 278 of file expression-formatter.h, definition at line 177 of file expression-formatter.cpp.
References expression_formatter, micro_os_plus::micro_test_plus::detail::append_number_ and buffer_.
operator<<()
|
Appends a signed long long value with type suffix "ll".
- Parameters
-
v The signed long long value.
- Returns
Reference to this instance.
Converts v to its decimal string representation via append_number_() and appends the type suffix "ll".
Declaration at line 314 of file expression-formatter.h, definition at line 228 of file expression-formatter.cpp.
References expression_formatter, micro_os_plus::micro_test_plus::detail::append_number_ and buffer_.
operator<<()
|
Appends a signed long value with type suffix "l".
- Parameters
-
v The signed long value.
- Returns
Reference to this instance.
Converts v to its decimal string representation via append_number_() and appends the type suffix "l".
Declaration at line 296 of file expression-formatter.h, definition at line 202 of file expression-formatter.cpp.
References expression_formatter, micro_os_plus::micro_test_plus::detail::append_number_ and buffer_.
operator<<()
|
Appends a signed short value with type suffix "s".
- Parameters
-
v The signed short value.
- Returns
Reference to this instance.
Converts v to its decimal string representation via append_number_() and appends the type suffix "s".
Declaration at line 260 of file expression-formatter.h, definition at line 151 of file expression-formatter.cpp.
References expression_formatter, micro_os_plus::micro_test_plus::detail::append_number_ and buffer_.
operator<<()
|
Appends the string "nullptr".
- Returns
Reference to this instance.
Appends the string "nullptr" to the internal buffer.
Declaration at line 234 of file expression-formatter.h, definition at line 113 of file expression-formatter.cpp.
References expression_formatter and buffer_.
operator<<()
|
Appends a string view to the buffer.
- Parameters
-
sv The string view to append.
- Returns
Reference to this instance.
Appends the contents of the std::string_view directly to the internal buffer using buffer_.append(sv).
Declaration at line 199 of file expression-formatter.h, definition at line 66 of file expression-formatter.cpp.
References expression_formatter and buffer_.
operator<<()
|
Appends the hexadecimal address of a pointer.
Null pointers are rendered as "0x0". Non-null pointers are formatted with snprintf using the p specifier.
- Template Parameters
-
T The type pointed to.
- Parameters
-
v The pointer value.
- Returns
Reference to this instance.
Null pointers are rendered as "0x0" to avoid platform-specific representations such as "(nil)" on Linux/glibc. Non-null pointers are formatted as a hexadecimal address using snprintf with the p specifier.
Declaration at line 368 of file expression-formatter.h, definition at line 185 of file expression-formatter-inlines.h.
References expression_formatter and buffer_.
operator<<()
|
Appends an unsigned char value with type suffix "uc".
- Parameters
-
c The unsigned char value.
- Returns
Reference to this instance.
Converts c to its decimal string representation via append_number_() and appends the type suffix "uc".
Declaration at line 251 of file expression-formatter.h, definition at line 138 of file expression-formatter.cpp.
References expression_formatter, micro_os_plus::micro_test_plus::detail::append_number_ and buffer_.
operator<<()
|
Appends an unsigned int value with type suffix "u".
- Parameters
-
v The unsigned int value.
- Returns
Reference to this instance.
Converts v to its decimal string representation via append_number_() and appends the type suffix "u".
Declaration at line 287 of file expression-formatter.h, definition at line 189 of file expression-formatter.cpp.
References expression_formatter, micro_os_plus::micro_test_plus::detail::append_number_ and buffer_.
operator<<()
|
Appends an unsigned long long value with type suffix "ull".
- Parameters
-
v The unsigned long long value.
- Returns
Reference to this instance.
Converts v to its decimal string representation via append_number_() and appends the type suffix "ull".
Declaration at line 323 of file expression-formatter.h, definition at line 241 of file expression-formatter.cpp.
References expression_formatter, micro_os_plus::micro_test_plus::detail::append_number_ and buffer_.
operator<<()
|
Appends an unsigned long value with type suffix "ul".
- Parameters
-
v The unsigned long value.
- Returns
Reference to this instance.
Converts v to its decimal string representation via append_number_() and appends the type suffix "ul".
Declaration at line 305 of file expression-formatter.h, definition at line 215 of file expression-formatter.cpp.
References expression_formatter, micro_os_plus::micro_test_plus::detail::append_number_ and buffer_.
operator<<()
|
Appends an unsigned short value with type suffix "us".
- Parameters
-
v The unsigned short value.
- Returns
Reference to this instance.
Converts v to its decimal string representation via append_number_() and appends the type suffix "us".
Declaration at line 269 of file expression-formatter.h, definition at line 164 of file expression-formatter.cpp.
References expression_formatter, micro_os_plus::micro_test_plus::detail::append_number_ and buffer_.
operator=()
| delete |
Deleted copy assignment operator to prevent copying.
Definition at line 175 of file expression-formatter.h.
Reference expression_formatter.
operator=()
| delete |
Deleted move assignment operator to prevent moving.
Definition at line 182 of file expression-formatter.h.
Reference expression_formatter.
Public Member Functions
append()
| inline |
Appends a sequence of identical characters to the buffer.
- Parameters
-
count The number of characters to append.
ch The character to repeat.
- Returns
Nothing.
Appends count repetitions of ch to the internal buffer by delegating to buffer_.append(count, ch).
Declaration at line 613 of file expression-formatter.h, definition at line 148 of file expression-formatter-inlines.h.
Reference buffer_.
Referenced by operator<<.
c_str()
| inline nodiscard noexcept |
Returns a pointer to the null-terminated buffer contents.
- Parameters
None.
- Returns
Pointer to the null-terminated character array.
Returns buffer_.c_str(), providing a pointer to the null-terminated contents of the internal buffer.
Declaration at line 580 of file expression-formatter.h, definition at line 115 of file expression-formatter-inlines.h.
Reference buffer_.
Referenced by operator<<.
clear()
| inline noexcept |
Clears the internal buffer.
- Parameters
None.
- Returns
Nothing.
Calls buffer_.clear(), resetting the buffer length to zero without releasing the allocated storage.
Declaration at line 591 of file expression-formatter.h, definition at line 126 of file expression-formatter-inlines.h.
Reference buffer_.
Referenced by micro_os_plus::micro_test_plus::detail::deferred_reporter::deferred_reporter and operator<<.
empty()
| inline nodiscard noexcept |
Returns whether the internal buffer is empty.
- Parameters
None.
- Return Values
-
true The buffer contains no characters.
false The buffer contains at least one character.
Returns buffer_.empty(), indicating whether the accumulated string has zero length.
Declaration at line 602 of file expression-formatter.h, definition at line 137 of file expression-formatter-inlines.h.
Reference buffer_.
Referenced by operator<<.
reserve()
| inline |
Reserves storage in the internal buffer.
- Parameters
-
capacity The minimum capacity to reserve.
- Returns
Nothing.
Calls buffer_.reserve(capacity) to pre-allocate storage, reducing subsequent dynamic allocations.
Declaration at line 623 of file expression-formatter.h, definition at line 159 of file expression-formatter-inlines.h.
Reference buffer_.
Referenced by operator<<.
str()
| inline nodiscard noexcept |
Returns a const reference to the internal buffer.
- Parameters
None.
- Returns
Const reference to the accumulated string.
Returns a const reference to the internal buffer_ string.
Declaration at line 570 of file expression-formatter.h, definition at line 104 of file expression-formatter-inlines.h.
Reference buffer_.
Protected Member Functions
colour_()
| inline nodiscard protected |
Selects the appropriate colour code based on a condition.
- Parameters
-
cond Boolean value indicating pass (true) or fail (false).
- Returns
The corresponding ANSI colour code as a string.
Returns the ANSI colour code for pass or fail, depending on the boolean condition provided.
Declaration at line 633 of file expression-formatter.h, definition at line 92 of file expression-formatter-inlines.h.
Reference colours_.
Referenced by operator<<, operator<<, operator<<, operator<<, operator<<, operator<<, operator<<, operator<<, operator<<, operator<<, operator<<, operator<< and operator<<.
Protected Member Attributes
buffer_
| protected |
The internal output buffer.
Definition at line 643 of file expression-formatter.h.
Referenced by append, c_str, clear, empty, operator<<, operator<<, operator<<, operator<<, operator<<, operator<<, operator<<, operator<<, operator<<, operator<<, operator<<, operator<<, operator<<, operator<<, operator<<, operator<<, operator<<, operator<<, operator<<, operator<<, reserve and str.
colours_
| protected |
ANSI colour codes for output formatting.
Definition at line 638 of file expression-formatter.h.
Referenced by expression_formatter, colour_, operator<<, operator<<, operator<<, operator<<, operator<<, operator<<, operator<<, operator<<, operator<<, operator<<, operator<< and operator<<.
The documentation for this class was generated from the following files:
Generated via doxygen2docusaurus 2.2.0 by Doxygen 1.17.0.