Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:30:27

0001 // Copyright (c) 2009-2020 Vladimir Batov.
0002 // Use, modification and distribution are subject to the Boost Software License,
0003 // Version 1.0. See http://www.boost.org/LICENSE_1_0.txt.
0004 
0005 #ifndef BOOST_CONVERT_DETAIL_IS_CHAR_HPP
0006 #define BOOST_CONVERT_DETAIL_IS_CHAR_HPP
0007 
0008 #include <boost/convert/detail/config.hpp>
0009 #include <cctype>
0010 #include <cwctype>
0011 
0012 namespace boost { namespace cnv
0013 {
0014     using  char_type = char;
0015     using uchar_type = unsigned char;
0016     using wchar_type = wchar_t;
0017     using  char_cptr = char const*;
0018 
0019     namespace detail
0020     {
0021         template<typename> struct is_char             : std::false_type {};
0022         template<>         struct is_char< char_type> : std:: true_type {};
0023         template<>         struct is_char<wchar_type> : std:: true_type {};
0024     }
0025     template <typename T> struct is_char : detail::is_char<typename boost::remove_const<T>::type> {};
0026 
0027     template<typename char_type> inline bool      is_space(char_type);
0028     template<typename char_type> inline char_type to_upper(char_type);
0029 
0030     template<> inline bool       is_space ( char_type c) { return bool(std::isspace(static_cast<uchar_type>(c))); }
0031     template<> inline bool       is_space (uchar_type c) { return bool(std::isspace(c)); }
0032     template<> inline bool       is_space (wchar_type c) { return bool(std::iswspace(c)); }
0033     template<> inline  char_type to_upper ( char_type c) { return std::toupper(static_cast<uchar_type>(c)); }
0034     template<> inline uchar_type to_upper (uchar_type c) { return std::toupper(c); }
0035     template<> inline wchar_type to_upper (wchar_type c) { return std::towupper(c); }
0036 }}
0037 
0038 #endif // BOOST_CONVERT_DETAIL_IS_CHAR_HPP
0039