tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
iswspace.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2// SPDX-FileCopyrightText: Copyright (C) 2021 Tobias Hienzsch
3
4#ifndef TETL_CWCTYPE_ISWSPACE_HPP
5#define TETL_CWCTYPE_ISWSPACE_HPP
6
7#include <etl/_cwchar/wint_t.hpp>
8
9namespace etl {
10
11/// Checks if the given wide character is a wide whitespace character as
12/// classified by the currently installed C locale.
13///
14/// If the value of ch is neither representable as a wchar_t nor equal
15/// to the value of the macro WEOF, the behavior is undefined. In the default
16/// locale, the whitespace characters are the following:
17///
18/// - space (0x20)
19/// - form feed (0x0c)
20/// - line feed (0x0a)
21/// - carriage return (0x0d)
22/// - horizontal tab (0x09)
23/// - vertical tab (0x0b)
24///
25/// https://en.cppreference.com/w/cpp/string/wide/iswspace
26///
27/// \ingroup cwctype
28[[nodiscard]] constexpr auto iswspace(wint_t ch) noexcept -> int
29{
30 auto const sp = ch == L' ';
31 auto const form = ch == L'\f';
32 auto const line = ch == L'\n';
33 auto const carriage = ch == L'\r';
34 auto const hTab = ch == L'\t';
35 auto const vTab = ch == L'\v';
36 return static_cast<int>(sp || form || line || carriage || hTab || vTab);
37}
38} // namespace etl
39
40#endif // TETL_CWCTYPE_ISWSPACE_HPP
constexpr auto iswspace(wint_t ch) noexcept -> int
Checks if the given wide character is a wide whitespace character as classified by the currently inst...
Definition iswspace.hpp:28
Definition adjacent_find.hpp:9