1 #ifndef CONVERSION_UTILITIES_WIDEN_H 2 #define CONVERSION_UTILITIES_WIDEN_H 19 template<
class E,
class T = std::
char_traits<E>,
class A = std::allocator<E> >
26 Widen(
const std::locale &locale = std::locale()) :
28 m_pctype(&
std::use_facet<
std::ctype<E> >(locale))
37 std::basic_string<E, T, A> operator() (
const std::string &
string)
const 39 typename std::basic_string<E, T, A>::size_type srcLen =
string.length();
40 const char *srcBeg =
string.c_str();
41 std::vector<E> tmp(srcLen);
42 m_pctype->widen(srcBeg, srcBeg + srcLen, &tmp[0]);
43 return std::basic_string<E, T, A>(&tmp[0], srcLen);
48 const std::ctype<E>* m_pctype;
53 #endif // CONVERSION_UTILITIES_WIDEN_H
Converts a std::string to a wide string using the specified locale.
Contains several functions providing conversions between different data types.
Widen(const std::locale &locale=std::locale())
Constructs a new instance with the specified locale.
#define CPP_UTILITIES_EXPORT
Marks the symbol to be exported by the c++utilities library.