Remote Call Framework 3.2
Tchar.hpp
Go to the documentation of this file.
1 
2 //******************************************************************************
3 // RCF - Remote Call Framework
4 //
5 // Copyright (c) 2005 - 2020, Delta V Software. All rights reserved.
6 // http://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
12 // under GPL terms.
13 //
14 // Version: 3.2
15 // Contact: support <at> deltavsoft.com
16 //
17 //******************************************************************************
18 
20 
21 #ifndef INCLUDE_UTIL_TCHAR_HPP
22 #define INCLUDE_UTIL_TCHAR_HPP
23 
24 #include <string>
25 
26 #include <RCF/Config.hpp>
27 #include <RCF/Export.hpp>
28 
29 #if (defined(UNICODE) || defined(_UNICODE)) && !defined(RCF_WINDOWS)
30 #error UNICODE and _UNICODE should only be defined for Windows builds.
31 #endif
32 
33 namespace RCF {
34 
35  RCF_EXPORT std::wstring stringToWstring(const std::string &s);
36  RCF_EXPORT std::string wstringToString(const std::wstring &ws);
37 
38 #if (defined(UNICODE) || defined(_UNICODE))
39 
40  #define RCF_T(x) L ## x
41  typedef std::wstring tstring;
42  inline tstring toTstring(const std::string & s) { return stringToWstring(s); }
43  inline tstring toTstring(const std::wstring & s) { return s; }
44  inline std::string toAstring(const tstring & s) { return wstringToString(s); }
45  inline std::wstring toWstring(const tstring & s) { return s; }
46 
47 #else
48 
49  #define RCF_T(x) x
50  typedef std::string tstring;
51  inline tstring toTstring(const std::string & s) { return s; }
52  inline tstring toTstring(const std::wstring & ws) { return wstringToString(ws); }
53  inline std::string toAstring(const tstring & s) { return s; }
54  inline std::wstring toWstring(const tstring & s) { return stringToWstring(s); }
55 
56 #endif
57 
58 } // namespace RCF
59 
60 #endif // ! INCLUDE_UTIL_TCHAR_HPP
Definition: AmiIoHandler.hpp:24