File indexing completed on 2025-01-18 09:50:14
0001
0002
0003
0004
0005
0006 #ifndef BOOST_CONVERT_HPP_VP_2004_04_28
0007 #define BOOST_CONVERT_HPP_VP_2004_04_28
0008
0009 #include <boost/program_options/config.hpp>
0010
0011 #if !defined(BOOST_NO_STD_WSTRING)
0012
0013 #include <boost/detail/workaround.hpp>
0014
0015 #include <string>
0016 #include <vector>
0017 #include <locale>
0018
0019 #include <cwchar>
0020 #include <stdexcept>
0021
0022 #if defined(BOOST_NO_STDC_NAMESPACE)
0023 #include <wchar.h>
0024 namespace std
0025 {
0026 using ::mbstate_t;
0027 }
0028 #endif
0029
0030 namespace boost {
0031
0032
0033
0034 BOOST_PROGRAM_OPTIONS_DECL std::wstring
0035 from_8_bit(const std::string& s,
0036 const std::codecvt<wchar_t, char, std::mbstate_t>& cvt);
0037
0038
0039
0040 BOOST_PROGRAM_OPTIONS_DECL std::string
0041 to_8_bit(const std::wstring& s,
0042 const std::codecvt<wchar_t, char, std::mbstate_t>& cvt);
0043
0044
0045
0046
0047 BOOST_PROGRAM_OPTIONS_DECL std::wstring
0048 from_utf8(const std::string& s);
0049
0050
0051 BOOST_PROGRAM_OPTIONS_DECL std::string
0052 to_utf8(const std::wstring& s);
0053
0054
0055
0056 BOOST_PROGRAM_OPTIONS_DECL std::string
0057 to_local_8_bit(const std::wstring& s);
0058
0059
0060
0061 BOOST_PROGRAM_OPTIONS_DECL std::wstring
0062 from_local_8_bit(const std::string& s);
0063
0064 namespace program_options
0065 {
0066
0067
0068
0069
0070 BOOST_PROGRAM_OPTIONS_DECL std::string to_internal(const std::string&);
0071
0072 BOOST_PROGRAM_OPTIONS_DECL std::string to_internal(const std::wstring&);
0073
0074 template<class T>
0075 std::vector<std::string> to_internal(const std::vector<T>& s)
0076 {
0077 std::vector<std::string> result;
0078 for (unsigned i = 0; i < s.size(); ++i)
0079 result.push_back(to_internal(s[i]));
0080 return result;
0081 }
0082
0083 }
0084
0085
0086
0087 }
0088
0089 #else
0090 #include <vector>
0091 #include <string>
0092 namespace boost{
0093 namespace program_options{
0094 BOOST_PROGRAM_OPTIONS_DECL std::string to_internal(const std::string&);
0095
0096 template<class T>
0097 std::vector<std::string> to_internal(const std::vector<T>& s)
0098 {
0099 std::vector<std::string> result;
0100 for (unsigned i = 0; i < s.size(); ++i)
0101 result.push_back(to_internal(s[i]));
0102 return result;
0103 }
0104 }
0105 }
0106 #endif
0107 #endif