tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
isgraph.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2// SPDX-FileCopyrightText: Copyright (C) 2020 Tobias Hienzsch
3
4#ifndef TETL_CCTYPE_ISGRAPH_HPP
5#define TETL_CCTYPE_ISGRAPH_HPP
6
7#include <etl/_cctype/isdigit.hpp>
8#include <etl/_cctype/islower.hpp>
9#include <etl/_cctype/ispunct.hpp>
10#include <etl/_cctype/isupper.hpp>
11
12namespace etl {
13
14/// \brief Checks if the given character is graphic (has a graphical
15/// representation) as classified by the default C locale.
16///
17/// \param ch Character to classify.
18///
19/// \returns Non-zero value if the character is a punctuation character, zero
20/// otherwise.
21///
22/// https://en.cppreference.com/w/cpp/string/byte/isgraph
23///
24/// \ingroup cctype
25[[nodiscard]] constexpr auto isgraph(int ch) noexcept -> int
26{
27 auto const isDigit = etl::isdigit(ch) != 0;
28 auto const isUpper = etl::isupper(ch) != 0;
29 auto const isLower = etl::islower(ch) != 0;
30 auto const isPunct = etl::ispunct(ch) != 0;
31
32 return static_cast<int>(isDigit || isLower || isUpper || isPunct);
33}
34} // namespace etl
35
36#endif // TETL_CCTYPE_ISGRAPH_HPP
constexpr auto isupper(int ch) noexcept -> int
Checks if the given character is classified as a uppercase character according to the default C local...
Definition isupper.hpp:20
constexpr auto isgraph(int ch) noexcept -> int
Checks if the given character is graphic (has a graphical representation) as classified by the defaul...
Definition isgraph.hpp:25
constexpr auto ispunct(int ch) noexcept -> int
Checks if the given character is a punctuation character as classified by the current C locale.
Definition ispunct.hpp:23
constexpr auto islower(int ch) noexcept -> int
Checks if the given character is classified as a lowercase character according to the default C local...
Definition islower.hpp:20
constexpr auto isdigit(int ch) noexcept -> int
Checks if the given character is one of the 10 decimal digits: 0123456789.
Definition isdigit.hpp:16
Definition adjacent_find.hpp:9