Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
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 <src/boost/nowide/stackstring.hpp>

Public Types

typedef CharOut output_char
 
typedef CharIn input_char
 

Public Member Functions

 basic_stackstring (basic_stackstring const &other)
 
void swap (basic_stackstring &other)
 
basic_stackstringoperator= (basic_stackstring const &other)
 
 basic_stackstring ()
 
bool convert (input_char const *input)
 
bool convert (input_char const *begin, input_char const *end)
 
output_charc_str ()
 
output_char constc_str () const
 
void clear ()
 
 ~basic_stackstring ()
 

Static Public Attributes

static const size_t buffer_size = BufferSize
 

Static Private Member Functions

static size_t get_space (size_t insize, size_t outsize, size_t in)
 

Private Attributes

output_char buffer_ [buffer_size]
 
output_charmem_buffer_
 

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 on stack buffer of the string is short enough and allocated a buffer on the heap if the size of the buffer is too small

Member Typedef Documentation

◆ input_char

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

◆ output_char

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

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 ( basic_stackstring< CharOut, CharIn, BufferSize > const other)
inline
32 :
34 {
35 clear();
36 if(other.mem_buffer_) {
37 size_t len = 0;
38 while(other.mem_buffer_[len])
39 len ++;
40 mem_buffer_ = new output_char[len + 1];
41 memcpy(mem_buffer_,other.mem_buffer_,sizeof(output_char) * (len+1));
42 }
43 else {
44 memcpy(buffer_,other.buffer_,buffer_size * sizeof(output_char));
45 }
46 }
static const size_t buffer_size
Definition stackstring.hpp:28
output_char * mem_buffer_
Definition stackstring.hpp:128
void clear()
Definition stackstring.hpp:103
output_char buffer_[buffer_size]
Definition stackstring.hpp:127
CharOut output_char
Definition stackstring.hpp:29

References boost::nowide::basic_stackstring< CharOut, CharIn, BufferSize >::buffer_, boost::nowide::basic_stackstring< CharOut, CharIn, BufferSize >::buffer_size, boost::nowide::basic_stackstring< CharOut, CharIn, BufferSize >::clear(), and boost::nowide::basic_stackstring< CharOut, CharIn, BufferSize >::mem_buffer_.

+ Here is the call graph for this function:

◆ 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 ( )
inline
63 : mem_buffer_(0)
64 {
65 }

◆ ~basic_stackstring()

template<typename CharOut = wchar_t, typename CharIn = char, size_t BufferSize = 256>
boost::nowide::basic_stackstring< CharOut, CharIn, BufferSize >::~basic_stackstring ( )
inline
112 {
113 clear();
114 }

References boost::nowide::basic_stackstring< CharOut, CharIn, BufferSize >::clear().

+ Here is the call graph for this function:

Member Function Documentation

◆ c_str() [1/2]

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

◆ c_str() [2/2]

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

◆ clear()

template<typename CharOut = wchar_t, typename CharIn = char, size_t BufferSize = 256>
void boost::nowide::basic_stackstring< CharOut, CharIn, BufferSize >::clear ( )
inline

◆ convert() [1/2]

template<typename CharOut = wchar_t, typename CharIn = char, size_t BufferSize = 256>
bool boost::nowide::basic_stackstring< CharOut, CharIn, BufferSize >::convert ( input_char const begin,
input_char const end 
)
inline
71 {
72 clear();
73
74 size_t space = get_space(sizeof(input_char),sizeof(output_char),end - begin) + 1;
75 if(space <= buffer_size) {
76 if(basic_convert(buffer_,buffer_size,begin,end))
77 return true;
78 clear();
79 return false;
80 }
81 else {
82 mem_buffer_ = new output_char[space];
83 if(!basic_convert(mem_buffer_,space,begin,end)) {
84 clear();
85 return false;
86 }
87 return true;
88 }
89
90 }
static size_t get_space(size_t insize, size_t outsize, size_t in)
Definition stackstring.hpp:116
CharIn input_char
Definition stackstring.hpp:30
CharOut * basic_convert(CharOut *buffer, size_t buffer_size, CharIn const *source_begin, CharIn const *source_end)
Template function that converts a buffer of UTF sequences in range [source_begin,source_end) to the o...
Definition convert.hpp:26

References boost::nowide::basic_convert(), boost::nowide::basic_stackstring< CharOut, CharIn, BufferSize >::buffer_, boost::nowide::basic_stackstring< CharOut, CharIn, BufferSize >::buffer_size, boost::nowide::basic_stackstring< CharOut, CharIn, BufferSize >::clear(), boost::nowide::basic_stackstring< CharOut, CharIn, BufferSize >::get_space(), and boost::nowide::basic_stackstring< CharOut, CharIn, BufferSize >::mem_buffer_.

+ Here is the call graph for this function:

◆ convert() [2/2]

template<typename CharOut = wchar_t, typename CharIn = char, size_t BufferSize = 256>
bool boost::nowide::basic_stackstring< CharOut, CharIn, BufferSize >::convert ( input_char const input)
inline
67 {
68 return convert(input,details::basic_strend(input));
69 }
bool convert(input_char const *input)
Definition stackstring.hpp:66
static int input(void)

References boost::nowide::basic_stackstring< CharOut, CharIn, BufferSize >::convert(), and input().

Referenced by boost::nowide::basic_stackstring< CharOut, CharIn, BufferSize >::convert().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_space()

template<typename CharOut = wchar_t, typename CharIn = char, size_t BufferSize = 256>
static size_t boost::nowide::basic_stackstring< CharOut, CharIn, BufferSize >::get_space ( size_t  insize,
size_t  outsize,
size_t  in 
)
inlinestaticprivate
117 {
118 if(insize <= outsize)
119 return in;
120 else if(insize == 2 && outsize == 1)
121 return 3 * in;
122 else if(insize == 4 && outsize == 1)
123 return 4 * in;
124 else // if(insize == 4 && outsize == 2)
125 return 2 * in;
126 }

Referenced by boost::nowide::basic_stackstring< CharOut, CharIn, BufferSize >::convert().

+ Here is the caller graph for this function:

◆ operator=()

template<typename CharOut = wchar_t, typename CharIn = char, size_t BufferSize = 256>
basic_stackstring & boost::nowide::basic_stackstring< CharOut, CharIn, BufferSize >::operator= ( basic_stackstring< CharOut, CharIn, BufferSize > const other)
inline
55 {
56 if(this != &other) {
57 basic_stackstring tmp(other);
58 swap(tmp);
59 }
60 return *this;
61 }
basic_stackstring()
Definition stackstring.hpp:63
void swap(basic_stackstring &other)
Definition stackstring.hpp:48

References boost::nowide::basic_stackstring< CharOut, CharIn, BufferSize >::swap().

+ Here is the call graph for this function:

◆ swap()

template<typename CharOut = wchar_t, typename CharIn = char, size_t BufferSize = 256>
void boost::nowide::basic_stackstring< CharOut, CharIn, BufferSize >::swap ( basic_stackstring< CharOut, CharIn, BufferSize > &  other)
inline
49 {
50 std::swap(mem_buffer_,other.mem_buffer_);
51 for(size_t i=0;i<buffer_size;i++)
52 std::swap(buffer_[i],other.buffer_[i]);
53 }

References boost::nowide::basic_stackstring< CharOut, CharIn, BufferSize >::buffer_, boost::nowide::basic_stackstring< CharOut, CharIn, BufferSize >::buffer_size, and boost::nowide::basic_stackstring< CharOut, CharIn, BufferSize >::mem_buffer_.

Referenced by boost::nowide::basic_stackstring< CharOut, CharIn, BufferSize >::operator=().

+ Here is the caller graph for this function:

Member Data Documentation

◆ buffer_

◆ buffer_size

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

◆ mem_buffer_


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