5#ifndef ICE_UTIL_STRING_CONVERTER_H
6#define ICE_UTIL_STRING_CONVERTER_H
45template<
typename charT>
47#ifndef ICE_CPP11_MAPPING
62 virtual void fromUTF8(
const Byte* sourceStart,
const Byte* sourceEnd, std::basic_string<charT>& target)
const = 0;
69#if defined(__clang__) && !defined(ICE_STATIC_LIBS)
74template class ICE_API BasicStringConverter<char>;
75template class ICE_API BasicStringConverter<wchar_t>;
164namespace IceUtilInternal
170ICE_API std::vector<unsigned short> toUTF16(
const std::vector<IceUtil::Byte>&);
171ICE_API std::vector<unsigned int> toUTF32(
const std::vector<IceUtil::Byte>&);
176ICE_API std::vector<IceUtil::Byte> fromUTF32(
const std::vector<unsigned int>&);
#define ICE_DEFINE_PTR(TPtr, T)
Definition Config.h:377
#define ICE_API
Definition Config.h:197
A StringConverter converts narrow or wide-strings to and from UTF-8 byte sequences.
Definition StringConverter.h:50
virtual Byte * toUTF8(const charT *sourceStart, const charT *sourceEnd, UTF8Buffer &buf) const =0
Returns a pointer to byte after the last written byte (which may be past the last byte returned by ge...
virtual ~BasicStringConverter()
Definition StringConverter.h:64
virtual void fromUTF8(const Byte *sourceStart, const Byte *sourceEnd, std::basic_string< charT > &target) const =0
Unmarshals a UTF-8 sequence into a basic_string.
Provides bytes to toUTF8.
Definition StringConverter.h:24
virtual Byte * getMoreBytes(size_t howMany, Byte *firstUnused)=0
Obtains more bytes.
void setProcessStringConverter(const StringConverterPtr &c)
Sets the per-process narrow string converter.
BasicStringConverter< wchar_t > WstringConverter
A wide string converter.
Definition StringConverter.h:83
std::string nativeToUTF8(const std::string &str, const StringConverterPtr &nc)
Converts the given string from the native narrow string encoding to UTF-8 using the given converter.
void setProcessWstringConverter(const WstringConverterPtr &c)
Sets the per process wide string converter.
WstringConverterPtr createUnicodeWstringConverter()
Creates a WstringConverter that converts to and from UTF-16 or UTF-32 depending on sizeof(wchar_t).
std::string UTF8ToNative(const std::string &str, const StringConverterPtr &nc)
Converts the given string from UTF-8 to the native narrow string encoding using the given converter.
std::string wstringToString(const std::wstring &str, const StringConverterPtr &nc=0, const WstringConverterPtr &wc=0)
Converts the given wide string to a narrow string.
::IceUtil::Handle< WstringConverter > WstringConverterPtr
Definition StringConverter.h:84
::IceUtil::Handle< StringConverter > StringConverterPtr
Definition StringConverter.h:80
BasicStringConverter< char > StringConverter
A narrow string converter.
Definition StringConverter.h:79
unsigned char Byte
Definition Config.h:326
std::wstring stringToWstring(const std::string &str, const StringConverterPtr &nc=0, const WstringConverterPtr &wc=0)
Converts the given narrow string to a wide string.
WstringConverterPtr getProcessWstringConverter()
Retrieves the per-process wide string converter.
StringConverterPtr getProcessStringConverter()
Retrieves the per-process narrow string converter.
IceUtil::StringConverterPtr StringConverterPtr
Definition StringConverter.h:20