123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248 |
- #ifndef BOOST_LOCALE_ENCODING_HPP_INCLUDED
- #define BOOST_LOCALE_ENCODING_HPP_INCLUDED
- #include <boost/locale/config.hpp>
- #ifdef BOOST_MSVC
- # pragma warning(push)
- # pragma warning(disable : 4275 4251 4231 4660)
- #endif
- #include <boost/locale/info.hpp>
- #include <boost/locale/encoding_errors.hpp>
- #include <boost/locale/encoding_utf.hpp>
- namespace boost {
- namespace locale {
-
-
-
- namespace conv {
-
-
-
-
-
-
-
- template<typename CharType>
- std::basic_string<CharType> to_utf(char const *begin,char const *end,std::string const &charset,method_type how=default_method);
-
-
-
- template<typename CharType>
- std::string from_utf(CharType const *begin,CharType const *end,std::string const &charset,method_type how=default_method);
-
-
-
-
-
- template<typename CharType>
- std::basic_string<CharType> to_utf(char const *begin,char const *end,std::locale const &loc,method_type how=default_method)
- {
- return to_utf<CharType>(begin,end,std::use_facet<info>(loc).encoding(),how);
- }
-
-
-
-
-
- template<typename CharType>
- std::string from_utf(CharType const *begin,CharType const *end,std::locale const &loc,method_type how=default_method)
- {
- return from_utf(begin,end,std::use_facet<info>(loc).encoding(),how);
- }
-
-
-
-
- template<typename CharType>
- std::basic_string<CharType> to_utf(std::string const &text,std::string const &charset,method_type how=default_method)
- {
- return to_utf<CharType>(text.c_str(),text.c_str()+text.size(),charset,how);
- }
-
-
-
- template<typename CharType>
- std::string from_utf(std::basic_string<CharType> const &text,std::string const &charset,method_type how=default_method)
- {
- return from_utf(text.c_str(),text.c_str()+text.size(),charset,how);
- }
-
-
-
- template<typename CharType>
- std::basic_string<CharType> to_utf(char const *text,std::string const &charset,method_type how=default_method)
- {
- char const *text_end = text;
- while(*text_end)
- text_end++;
- return to_utf<CharType>(text,text_end,charset,how);
- }
-
-
-
- template<typename CharType>
- std::string from_utf(CharType const *text,std::string const &charset,method_type how=default_method)
- {
- CharType const *text_end = text;
- while(*text_end)
- text_end++;
- return from_utf(text,text_end,charset,how);
- }
-
-
-
-
-
- template<typename CharType>
- std::basic_string<CharType> to_utf(std::string const &text,std::locale const &loc,method_type how=default_method)
- {
- return to_utf<CharType>(text.c_str(),text.c_str()+text.size(),loc,how);
- }
-
-
-
-
-
- template<typename CharType>
- std::string from_utf(std::basic_string<CharType> const &text,std::locale const &loc,method_type how=default_method)
- {
- return from_utf(text.c_str(),text.c_str()+text.size(),loc,how);
- }
-
-
-
-
-
- template<typename CharType>
- std::basic_string<CharType> to_utf(char const *text,std::locale const &loc,method_type how=default_method)
- {
- char const *text_end = text;
- while(*text_end)
- text_end++;
- return to_utf<CharType>(text,text_end,loc,how);
- }
-
-
-
-
-
- template<typename CharType>
- std::string from_utf(CharType const *text,std::locale const &loc,method_type how=default_method)
- {
- CharType const *text_end = text;
- while(*text_end)
- text_end++;
- return from_utf(text,text_end,loc,how);
- }
-
-
-
-
- BOOST_LOCALE_DECL
- std::string between(char const *begin,
- char const *end,
- std::string const &to_encoding,
- std::string const &from_encoding,
- method_type how=default_method);
-
-
-
-
- inline
- std::string between(char const *text,
- std::string const &to_encoding,
- std::string const &from_encoding,
- method_type how=default_method)
- {
- char const *end=text;
- while(*end)
- end++;
- return boost::locale::conv::between(text,end,to_encoding,from_encoding,how);
- }
-
-
-
- inline
- std::string between(std::string const &text,
- std::string const &to_encoding,
- std::string const &from_encoding,
- method_type how=default_method)
- {
- return boost::locale::conv::between(text.c_str(),text.c_str()+text.size(),to_encoding,from_encoding,how);
- }
-
-
- template<>
- BOOST_LOCALE_DECL std::basic_string<char> to_utf(char const *begin,char const *end,std::string const &charset,method_type how);
- template<>
- BOOST_LOCALE_DECL std::string from_utf(char const *begin,char const *end,std::string const &charset,method_type how);
- template<>
- BOOST_LOCALE_DECL std::basic_string<wchar_t> to_utf(char const *begin,char const *end,std::string const &charset,method_type how);
- template<>
- BOOST_LOCALE_DECL std::string from_utf(wchar_t const *begin,wchar_t const *end,std::string const &charset,method_type how);
- #ifdef BOOST_LOCALE_ENABLE_CHAR16_T
- template<>
- BOOST_LOCALE_DECL std::basic_string<char16_t> to_utf(char const *begin,char const *end,std::string const &charset,method_type how);
- template<>
- BOOST_LOCALE_DECL std::string from_utf(char16_t const *begin,char16_t const *end,std::string const &charset,method_type how);
- #endif
- #ifdef BOOST_LOCALE_ENABLE_CHAR32_T
- template<>
- BOOST_LOCALE_DECL std::basic_string<char32_t> to_utf(char const *begin,char const *end,std::string const &charset,method_type how);
- template<>
- BOOST_LOCALE_DECL std::string from_utf(char32_t const *begin,char32_t const *end,std::string const &charset,method_type how);
- #endif
-
-
- }
- }
- }
- #ifdef BOOST_MSVC
- #pragma warning(pop)
- #endif
- #endif
|