File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1111* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
1212****/
1313
14+ #include < cctype>
1415#include < cstdlib>
1516#include < array>
17+ #include < cwctype>
18+ #include < type_traits>
1619#include " ../json.h"
1720
1821#if defined(_MSC_VER)
@@ -198,6 +201,17 @@ typename std::char_traits<CharType>::int_type eof()
198201 return std::char_traits<CharType>::eof ();
199202}
200203
204+ template <typename CharType>
205+ bool is_whitespace_character (typename std::char_traits<CharType>::int_type ch)
206+ {
207+ if constexpr (std::is_same<CharType, wchar_t >::value)
208+ {
209+ return std::iswspace (static_cast <wint_t >(ch)) != 0 ;
210+ }
211+
212+ return std::isspace (static_cast <unsigned char >(ch)) != 0 ;
213+ }
214+
201215template <typename CharType>
202216class JSON_StreamParser : public JSON_Parser <CharType>
203217 {
@@ -305,7 +319,7 @@ typename JSON_Parser<CharType>::int_type JSON_Parser<CharType>::EatWhitespace()
305319{
306320 auto ch = NextCharacter ();
307321
308- while ( ch != eof<CharType>() && iswspace ( static_cast < wint_t >(ch) ))
322+ while ( ch != eof<CharType>() && is_whitespace_character<CharType >(ch))
309323 {
310324 ch = NextCharacter ();
311325 }
You can’t perform that action at this time.
0 commit comments