1#ifndef LH_OS_TYPES_H
2#define LH_OS_TYPES_H
3
4#include <string>
5#include <cstdint>
6
7namespace litehtml
8{
9#if defined( WIN32 ) || defined( _WIN32 ) || defined( WINCE )
10
11// noexcept appeared since Visual Studio 2013
12#if defined(_MSC_VER) && _MSC_VER < 1900
13#define noexcept
14#endif
15
16#ifndef LITEHTML_UTF8
17
18 typedef std::wstring tstring;
19 typedef wchar_t tchar_t;
20 typedef std::wstringstream tstringstream;
21
22 #define _t(quote) L##quote
23
24 #define t_strlen wcslen
25 #define t_strcmp wcscmp
26 #define t_strncmp wcsncmp
27 #define t_strtol wcstol
28 #define t_atoi _wtoi
29 #define t_itoa(value, buffer, size, radix) _itow_s(value, buffer, size, radix)
30 #define t_strstr wcsstr
31 #define t_isspace iswspace
32 #define t_to_string(val) std::to_wstring(val)
33
34#else
35
36 typedef std::string tstring;
37 typedef char tchar_t;
38 typedef std::stringstream tstringstream;
39
40 #define _t(quote) quote
41
42 #define t_strlen strlen
43 #define t_strcmp strcmp
44 #define t_strncmp strncmp
45 #define t_strtol strtol
46 #define t_atoi atoi
47 #define t_itoa(value, buffer, size, radix) _itoa_s(value, buffer, size, radix)
48 #define t_strstr strstr
49 #define t_isspace isspace
50 #define t_to_string(val) std::to_string(val)
51
52#endif
53
54 #ifdef _WIN64
55 typedef unsigned __int64 uint_ptr;
56 #else
57 typedef unsigned int uint_ptr;
58 #endif
59
60#else
61 #define LITEHTML_UTF8
62
63 typedef std::string tstring;
64 typedef char tchar_t;
65 typedef std::uintptr_t uint_ptr;
66 typedef std::stringstream tstringstream;
67
68 #define _t(quote) quote
69
70 #define t_strlen strlen
71 #define t_strcmp strcmp
72 #define t_strncmp strncmp
73
74 #define t_itoa(value, buffer, size, radix) snprintf(buffer, size, "%d", value)
75
76 #define t_strtol strtol
77 #define t_atoi atoi
78 #define t_strstr strstr
79 #define t_isspace isspace
80 #define t_to_string(val) std::to_string(val)
81
82#endif
83}
84
85#endif // LH_OS_TYPES_H
86

source code of qttools/src/assistant/qlitehtml/src/3rdparty/litehtml/include/litehtml/os_types.h