Skip to main content

expression-formatter.cpp File

C++ source file with non-template implementations for the µTest++ expression formatter. More...

Included Headers

Namespaces Index

namespacemicro_os_plus

The primary namespace for the µOS++ framework. More...

namespacemicro_test_plus

Primary namespace for the µTest++ testing framework. More...

namespacedetail

Internal implementation details for the µTest++ framework. More...

Description

C++ source file with non-template implementations for the µTest++ expression formatter.

This source file contains the non-template operator<< overloads of expression_formatter for all standard arithmetic, character, string, boolean, and null-pointer types. Each overload appends the formatted value — together with an appropriate type suffix where applicable — to the internal string buffer.

All definitions reside within the micro_os_plus::micro_test_plus namespace.

This file must be included when building the µTest++ library.

File Listing

The file content with the documentation metadata removed is:

1/*
2 * This file is part of the µOS++ project (https://micro-os-plus.github.io/).
3 * Copyright (c) 2021-2026 Liviu Ionescu. All rights reserved.
4 *
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose is hereby granted, under the terms of the MIT license.
7 *
8 * If a copy of the license was not distributed with this file, it can be
9 * obtained from https://opensource.org/licenses/mit.
10 *
11 * Major parts of the code are inspired from v1.1.8 of the Boost UT project,
12 * released under the terms of the Boost Version 1 Software License,
13 * which can be obtained from https://www.boost.org/LICENSE_1_0.txt.
14 */
15
16// ----------------------------------------------------------------------------
17
35
36// ----------------------------------------------------------------------------
37
38#if defined(MICRO_OS_PLUS_INCLUDE_CONFIG_H)
39#include <micro-os-plus/config.h>
40#endif // MICRO_OS_PLUS_INCLUDE_CONFIG_H
41
43
44// ----------------------------------------------------------------------------
45
46#if defined(__GNUC__)
47#pragma GCC diagnostic ignored "-Waggregate-return"
48#if defined(__clang__)
49#pragma clang diagnostic ignored "-Wc++98-compat"
50#pragma clang diagnostic ignored "-Wc++98-compat-pedantic"
51#endif
52#endif
53
54// ============================================================================
55
57{
58 // --------------------------------------------------------------------------
59
66 expression_formatter::operator<<(std::string_view sv)
67 {
68 buffer_.append (sv);
69 return *this;
70 }
71
79 {
80 buffer_.append (1, c);
81 return *this;
82 }
83
91 {
92 buffer_.append (s);
93 return *this;
94 }
95
103 {
104 buffer_.append (v ? "true" : "false");
105 return *this;
106 }
107
114 {
115 buffer_.append ("nullptr");
116 return *this;
117 }
118
126 {
128 buffer_.append ("c");
129 return *this;
130 }
131
139 {
141 buffer_.append ("uc");
142 return *this;
143 }
144
152 {
154 buffer_.append ("s");
155 return *this;
156 }
157
164 expression_formatter::operator<<(unsigned short v)
165 {
167 buffer_.append ("us");
168 return *this;
169 }
170
178 {
180 return *this;
181 }
182
190 {
192 buffer_.append ("u");
193 return *this;
194 }
195
203 {
205 buffer_.append ("l");
206 return *this;
207 }
208
216 {
218 buffer_.append ("ul");
219 return *this;
220 }
221
228 expression_formatter::operator<<(signed long long v)
229 {
231 buffer_.append ("ll");
232 return *this;
233 }
234
241 expression_formatter::operator<<(unsigned long long v)
242 {
244 buffer_.append ("ull");
245 return *this;
246 }
247
255 {
257 buffer_.append ("f");
258 return *this;
259 }
260
268 {
270 return *this;
271 }
272
280 {
282 buffer_.append ("l");
283 return *this;
284 }
285
286 // --------------------------------------------------------------------------
287} // namespace micro_os_plus::micro_test_plus::detail
288
289// ----------------------------------------------------------------------------

Generated via doxygen2docusaurus 2.2.0 by Doxygen 1.17.0.