Skip to main content

utility.h File

C++ header file with declarations for the µTest++ utility helpers. More...

Included Headers

#include <string_view> #include <vector> #include "inlines/utility-inlines.h"

Namespaces Index

namespacemicro_os_plus

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

namespacemicro_test_plus

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

namespaceutility

Utility functions for the µTest++ testing framework. More...

Functions Index

const char *extract_file_name (const char *path) noexcept

Extracts the file name component from a full path. More...

boolis_match (std::string_view input, std::string_view pattern)

Check if a string matches a pattern. More...

template <class T = std::string_view, class Delim_T>
auto split (T input, Delim_T delim) -> std::vector< T >

Split a string into a vector of sub-strings. More...

Description

C++ header file with declarations for the µTest++ utility helpers.

This header provides declarations for the utility helper functions used within the µTest++ framework. It defines interfaces for string operations including file-name extraction, pattern matching, and string splitting.

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
27
28#ifndef MICRO_OS_PLUS_MICRO_TEST_PLUS_UTILITY_H_
29#define MICRO_OS_PLUS_MICRO_TEST_PLUS_UTILITY_H_
30
31// ----------------------------------------------------------------------------
32
33#if defined(__cplusplus)
34
35// ----------------------------------------------------------------------------
36
37#if __has_include("micro-os-plus/project-config.h")
38#include "micro-os-plus/project-config.h"
39#endif // __has_include("micro-os-plus/project-config.h")
40
41#if __has_include("micro-os-plus/micro-test-plus-defines.h")
42#include "micro-os-plus/micro-test-plus-defines.h"
43#endif // __has_include("micro-os-plus/micro-test-plus-defines.h")
44
45#include <string_view>
46#include <vector>
47
48// ----------------------------------------------------------------------------
49
50#if defined(__GNUC__)
51#pragma GCC diagnostic push
52
53#if defined(__clang__)
54#pragma clang diagnostic ignored "-Wc++98-compat"
55#endif // defined(__clang__)
56#endif // defined(__GNUC__)
57
58// ============================================================================
59
61{
62 // --------------------------------------------------------------------------
63
82 namespace utility
83 {
92 [[nodiscard]] const char*
93 extract_file_name (const char* path) noexcept;
94
104 [[nodiscard]] bool
105 is_match (std::string_view input, std::string_view pattern);
106
118 template <class T, class Delim_T>
119 [[nodiscard]] auto
120 split (T input, Delim_T delim) -> std::vector<T>;
121
122 // ------------------------------------------------------------------------
123 } // namespace utility
124
125 // --------------------------------------------------------------------------
126} // namespace micro_os_plus::micro_test_plus
127
128// ----------------------------------------------------------------------------
129
130#if defined(__GNUC__)
131#pragma GCC diagnostic pop
132#endif // defined(__GNUC__)
133
134// ----------------------------------------------------------------------------
135
136#endif // defined(__cplusplus)
137
138// ============================================================================
139// Templates, inlines & constexpr implementations.
140
142
143// ----------------------------------------------------------------------------
144
145#endif // MICRO_OS_PLUS_MICRO_TEST_PLUS_UTILITY_H_
146
147// ----------------------------------------------------------------------------

Generated via doxygen2docusaurus 2.2.2 by Doxygen 1.17.0.