RCFProto

- Main Page
- Classes
- Files

- File List

All Classes Functions Typedefs
convert.hpp
1
2 //******************************************************************************
3 // RCF - Remote Call Framework
4 //
5 // Copyright (c) 2005 - 2013, 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: 2.0
15 // Contact: support <at> deltavsoft.com
16 //
17 //******************************************************************************
18
19 #ifndef RCF_BOOST_CONVERT_HPP_VP_2004_04_28
20 #define RCF_BOOST_CONVERT_HPP_VP_2004_04_28
21
22 #include <RCF/Export.hpp>
23
24 #if !defined(BOOST_NO_STD_WSTRING)
25
26 #include <boost/detail/workaround.hpp>
27
28 #include <string>
29 #include <vector>
30 #include <locale>
31 // for mbstate_t
32 #include <cwchar>
33 #include <stdexcept>
34
35 #if defined(BOOST_NO_STDC_NAMESPACE)
36 #include <wchar.h>
37 namespace std
38 {
39 using ::mbstate_t;
40 }
41 #endif
42
43 namespace RcfBoost { namespace boost {
44
47 RCF_EXPORT std::wstring
48 from_8_bit(const std::string& s,
49 const std::codecvt<wchar_t, char, std::mbstate_t>& cvt);
50
53 RCF_EXPORT std::string
54 to_8_bit(const std::wstring& s,
55 const std::codecvt<wchar_t, char, std::mbstate_t>& cvt);
56
57
60 RCF_EXPORT std::wstring
61 from_utf8(const std::string& s);
62
64 RCF_EXPORT std::string
65 to_utf8(const std::wstring& s);
66
69 RCF_EXPORT std::string
70 to_local_8_bit(const std::wstring& s);
71
74 RCF_EXPORT std::wstring
75 from_local_8_bit(const std::string& s);
76
77 namespace program_options
78 {
83 RCF_EXPORT std::string to_internal(const std::string&);
85 RCF_EXPORT std::string to_internal(const std::wstring&);
86
87 template<class T>
88 std::vector<std::string> to_internal(const std::vector<T>& s)
89 {
90 std::vector<std::string> result;
91 for (unsigned i = 0; i < s.size(); ++i)
92 result.push_back(to_internal(s[i]));
93 return result;
94 }
95
96 }
97
98
99
100 } } // namespace RcfBoost namespace Boost
101
102 #else
103 #include <vector>
104 #include <string>
105 namespace RcfBoost { namespace boost{
106 namespace program_options{
107 RCF_EXPORT std::string to_internal(const std::string&);
108
109 template<class T>
110 std::vector<std::string> to_internal(const std::vector<T>& s)
111 {
112 std::vector<std::string> result;
113 for (unsigned i = 0; i < s.size(); ++i)
114 result.push_back(to_internal(s[i]));
115 return result;
116 }
117 }
118 } } // namespace RcfBoost namespace boost
119 #endif
120 #endif