8 #ifndef BOOST_NOWIDE_STACKSTRING_HPP_INCLUDED 9 #define BOOST_NOWIDE_STACKSTRING_HPP_INCLUDED 11 #include <boost/nowide/convert.hpp> 30 template<
typename CharOut =
wchar_t,
typename CharIn =
char,
size_t BufferSize = 256>
69 const size_t len = other.
length();
79 std::memcpy(data_, other.data_,
sizeof(
output_char) * (len + 1));
94 return convert(input, input + detail::strlen(input));
106 const size_t input_len = end - begin;
108 const size_t min_output_size = input_len + 1;
116 const size_t max_output_size = input_len * detail::utf::utf_traits<output_char>::max_width + 1;
118 const bool success = detail::convert_buffer(data_, max_output_size, begin, end) == data_;
150 std::swap(lhs.buffer_[i], rhs.buffer_[i]);
153 lhs.data_ = rhs.data_;
154 rhs.data_ = rhs.buffer_;
156 rhs.buffer_[i] = lhs.buffer_[i];
160 rhs.data_ = lhs.data_;
161 lhs.data_ = lhs.buffer_;
163 lhs.buffer_[i] = rhs.buffer_[i];
165 std::swap(lhs.data_, rhs.data_);
172 return data_ == buffer_;
basic_stackstring(const input_char *input)
Definition: stackstring.hpp:48
basic_stackstring< wchar_t, char, 256 > wstackstring
Definition: stackstring.hpp:194
bool uses_stack_memory() const
True if the stack memory is used.
Definition: stackstring.hpp:170
basic_stackstring< char, wchar_t, 16 > short_stackstring
Definition: stackstring.hpp:206
basic_stackstring(const basic_stackstring &other)
Copy construct from other.
Definition: stackstring.hpp:59
basic_stackstring< wchar_t, char, 16 > wshort_stackstring
Definition: stackstring.hpp:202
basic_stackstring & operator=(const basic_stackstring &other)
Copy assign from other.
Definition: stackstring.hpp:64
static const size_t buffer_size
Size of the stack buffer.
Definition: stackstring.hpp:35
void clear()
Reset the internal buffer to NULL.
Definition: stackstring.hpp:136
basic_stackstring(const input_char *begin, const input_char *end)
Definition: stackstring.hpp:54
output_char * convert(const input_char *begin, const input_char *end)
Definition: stackstring.hpp:100
basic_stackstring< char, wchar_t, 256 > stackstring
Definition: stackstring.hpp:198
const output_char * get() const
Return the converted, NULL-terminated string or NULL if no string was converted.
Definition: stackstring.hpp:131
size_t length() const
Definition: stackstring.hpp:176
output_char * convert(const input_char *input)
Definition: stackstring.hpp:91
A class that allows to create a temporary wide or narrow UTF strings from wide or narrow UTF source.
Definition: stackstring.hpp:31
basic_stackstring()
Creates a NULL stackstring.
Definition: stackstring.hpp:42
output_char * get()
Return the converted, NULL-terminated string or NULL if no string was converted.
Definition: stackstring.hpp:126
friend void swap(basic_stackstring &lhs, basic_stackstring &rhs)
Swap lhs with rhs.
Definition: stackstring.hpp:143
CharOut output_char
Type of the output character (converted to)
Definition: stackstring.hpp:37
CharIn input_char
Type of the input character (converted from)
Definition: stackstring.hpp:39