pstore2
ctype.hpp
Go to the documentation of this file.
1 //===- include/pstore/support/ctype.hpp -------------------*- mode: C++ -*-===//
2 //* _ *
3 //* ___| |_ _ _ _ __ ___ *
4 //* / __| __| | | | '_ \ / _ \ *
5 //* | (__| |_| |_| | |_) | __/ *
6 //* \___|\__|\__, | .__/ \___| *
7 //* |___/|_| *
8 //===----------------------------------------------------------------------===//
9 //
10 // Part of the pstore project, under the Apache License v2.0 with LLVM Exceptions.
11 // See https://github.com/SNSystems/pstore/blob/master/LICENSE.txt for license
12 // information.
13 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
14 //
15 //===----------------------------------------------------------------------===//
17 
18 #ifndef PSTORE_SUPPORT_CTYPE_HPP
19 #define PSTORE_SUPPORT_CTYPE_HPP
20 
21 #include <cctype>
22 #include <cwctype>
23 
24 namespace pstore {
25 
26  inline bool isspace (char const c) {
27  // std::isspace() has undefined behavior if the input value is not representable as unsigned
28  // char and not not equal to EOF.
29  auto const uc = static_cast<unsigned char> (c);
30  // TODO: std::isspace()'s behavior is affected by the current locale, but our "locale" is
31  // always UTF-8.
32  return std::isspace (static_cast<int> (uc)) != 0;
33  }
34 
35  inline bool isspace (wchar_t const c) { return std::iswspace (static_cast<wint_t> (c)) != 0; }
36 
37 } // namespace pstore
38 
39 #endif // PSTORE_SUPPORT_CTYPE_HPP
Definition: nonpod2.cpp:40