Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
Boost.Nowide
Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | Friends | List of all members
boost::nowide::basic_stackstring< CharOut, CharIn, BufferSize > Class Template Reference

A class that allows to create a temporary wide or narrow UTF strings from wide or narrow UTF source. More...

#include <boost/nowide/stackstring.hpp>

Public Types

using output_char = CharOut
 Type of the output character (converted to)
 
using input_char = CharIn
 Type of the input character (converted from)
 

Public Member Functions

 basic_stackstring ()
 Creates a NULL stackstring.
 
 basic_stackstring (const input_char *input)
 
 basic_stackstring (const input_char *begin, const input_char *end)
 
 basic_stackstring (const basic_stackstring &other)
 Copy construct from other.
 
basic_stackstringoperator= (const basic_stackstring &other)
 Copy assign from other.
 
output_charconvert (const input_char *input)
 
output_charconvert (const input_char *begin, const input_char *end)
 
output_charget ()
 Return the converted, NULL-terminated string or NULL if no string was converted.
 
const output_charget () const
 Return the converted, NULL-terminated string or NULL if no string was converted.
 
void clear ()
 Reset the internal buffer to NULL.
 

Static Public Attributes

static const size_t buffer_size = BufferSize
 Size of the stack buffer.
 

Protected Member Functions

bool uses_stack_memory () const
 True if the stack memory is used.
 
size_t length () const
 

Friends

void swap (basic_stackstring &lhs, basic_stackstring &rhs)
 Swap lhs with rhs.
 

Detailed Description

template<typename CharOut = wchar_t, typename CharIn = char, size_t BufferSize = 256>
class boost::nowide::basic_stackstring< CharOut, CharIn, BufferSize >

A class that allows to create a temporary wide or narrow UTF strings from wide or narrow UTF source.

It uses a stack buffer if the string is short enough otherwise allocates a buffer on the heap.

Invalid UTF characters are replaced by the substitution character, see BOOST_NOWIDE_REPLACEMENT_CHARACTER

If a NULL pointer is passed to the constructor or convert method, NULL will be returned by c_str. Similarly a default constructed stackstring will return NULL on calling c_str.

Constructor & Destructor Documentation

◆ basic_stackstring() [1/2]

template<typename CharOut = wchar_t, typename CharIn = char, size_t BufferSize = 256>
boost::nowide::basic_stackstring< CharOut, CharIn, BufferSize >::basic_stackstring ( const input_char input)
inlineexplicit

Convert the NULL terminated string input and store in internal buffer If input is NULL, nothing will be stored

◆ basic_stackstring() [2/2]

template<typename CharOut = wchar_t, typename CharIn = char, size_t BufferSize = 256>
boost::nowide::basic_stackstring< CharOut, CharIn, BufferSize >::basic_stackstring ( const input_char begin,
const input_char end 
)
inline

Convert the sequence [begin, end) and store in internal buffer If begin is NULL, nothing will be stored

Member Function Documentation

◆ convert() [1/2]

template<typename CharOut = wchar_t, typename CharIn = char, size_t BufferSize = 256>
output_char* boost::nowide::basic_stackstring< CharOut, CharIn, BufferSize >::convert ( const input_char input)
inline

Convert the NULL terminated string input and store in internal buffer If input is NULL, the current buffer will be reset to NULL

◆ convert() [2/2]

template<typename CharOut = wchar_t, typename CharIn = char, size_t BufferSize = 256>
output_char* boost::nowide::basic_stackstring< CharOut, CharIn, BufferSize >::convert ( const input_char begin,
const input_char end 
)
inline

Convert the sequence [begin, end) and store in internal buffer If begin is NULL, the current buffer will be reset to NULL

◆ length()

template<typename CharOut = wchar_t, typename CharIn = char, size_t BufferSize = 256>
size_t boost::nowide::basic_stackstring< CharOut, CharIn, BufferSize >::length ( ) const
inlineprotected

Return the current length of the string excluding the NULL terminator If NULL is stored returns NULL


The documentation for this class was generated from the following file: