Remote Call Framework 3.4
Tchar.hpp
Go to the documentation of this file.
1 
2 //******************************************************************************
3 // RCF - Remote Call Framework
4 //
5 // Copyright (c) 2005 - 2023, Delta V Software. All rights reserved.
6 // https://www.deltavsoft.com
7 //
8 // RCF is distributed under dual licenses - closed source or GPL.
9 // Consult your particular license for conditions of use.
10 //
11 // If you have not purchased a commercial license, you are using RCF under GPL terms.
12 //
13 // Version: 3.4
14 // Contact: support <at> deltavsoft.com
15 //
16 //******************************************************************************
17 
19 
20 #ifndef INCLUDE_UTIL_TCHAR_HPP
21 #define INCLUDE_UTIL_TCHAR_HPP
22 
23 #include <string>
24 
25 #include <RCF/Config.hpp>
26 #include <RCF/Export.hpp>
27 
28 #if (defined(UNICODE) || defined(_UNICODE)) && !defined(RCF_WINDOWS)
29 #error UNICODE and _UNICODE should only be defined for Windows builds.
30 #endif
31 
32 namespace RCF {
33 
34  RCF_EXPORT std::wstring stringToWstring(const std::string &s);
35  RCF_EXPORT std::string wstringToString(const std::wstring &ws);
36 
37 #ifdef __cpp_char8_t
38  RCF_EXPORT std::string u8stringToString(const std::u8string& u8s);
39 #else
40  RCF_EXPORT std::string u8stringToString(const std::string& u8s);
41 #endif
42 
43 #if (defined(UNICODE) || defined(_UNICODE))
44 
45  #define RCF_T(x) L ## x
46  typedef std::wstring tstring;
47  inline tstring toTstring(const std::string & s) { return stringToWstring(s); }
48  inline tstring toTstring(const std::wstring & s) { return s; }
49  inline std::string toAstring(const tstring & s) { return wstringToString(s); }
50  inline std::wstring toWstring(const tstring & s) { return s; }
51 
52 #else
53 
54  #define RCF_T(x) x
55  typedef std::string tstring;
56  inline tstring toTstring(const std::string & s) { return s; }
57  inline tstring toTstring(const std::wstring & ws) { return wstringToString(ws); }
58  inline std::string toAstring(const tstring & s) { return s; }
59  inline std::wstring toWstring(const tstring & s) { return stringToWstring(s); }
60 
61 #endif
62 
63 } // namespace RCF
64 
65 #endif // ! INCLUDE_UTIL_TCHAR_HPP
Definition: AmiIoHandler.hpp:23