alternative Standard Libary  0.29.8
std::simple_wstring_storage< E, TAllocator > Template-Klassenreferenz

#include <simple_string_storage.hpp>

Öffentliche Typen

using value_type = E
 
using size_type = int
 
using allocator_type = TAllocator
 
using const_iterator = const value_type *
 

Öffentliche Methoden

 simple_wstring_storage (const allocator_type &allocator)
 
 simple_wstring_storage (const value_type *str, const allocator_type &allocator)
 
 simple_wstring_storage (const value_type *str, size_type len, const allocator_type &allocator)
 
 simple_wstring_storage (const simple_wstring_storage &rhs, const allocator_type &allocator)
 
 ~simple_wstring_storage ()
 
simple_wstring_storageoperator= (const simple_wstring_storage &rhs)
 
void assign (const value_type *str, size_type len)
 
void append (const value_type *str, size_type len)
 
const value_typec_str () const
 
size_type length () const
 
size_type capacity () const
 
void clear ()
 
const allocator_typeget_allocator () const
 
void make_unique (size_type)
 
value_typeget_data ()
 

Statische öffentliche Attribute

static const unsigned long kGranularity = 32
 

Geschützte Methoden

bool invariant () const
 

Ausführliche Beschreibung

template<typename E, class TAllocator>
class std::simple_wstring_storage< E, TAllocator >

Dokumentation der benutzerdefinierten Datentypen

◆ allocator_type

template<typename E , class TAllocator >
using std::simple_wstring_storage< E, TAllocator >::allocator_type = TAllocator

◆ const_iterator

template<typename E , class TAllocator >
using std::simple_wstring_storage< E, TAllocator >::const_iterator = const value_type*

◆ size_type

template<typename E , class TAllocator >
using std::simple_wstring_storage< E, TAllocator >::size_type = int

◆ value_type

template<typename E , class TAllocator >
using std::simple_wstring_storage< E, TAllocator >::value_type = E

Beschreibung der Konstruktoren und Destruktoren

◆ simple_wstring_storage() [1/4]

template<typename E , class TAllocator >
std::simple_wstring_storage< E, TAllocator >::simple_wstring_storage ( const allocator_type allocator)
inlineexplicit
228  : m_length(0), m_allocator(allocator)
229  {
230  m_data = construct_string(0, m_capacity);
231  }

◆ simple_wstring_storage() [2/4]

template<typename E , class TAllocator >
std::simple_wstring_storage< E, TAllocator >::simple_wstring_storage ( const value_type str,
const allocator_type allocator 
)
inline
233  : m_allocator(allocator)
234  {
235  const int len = wcslen(str);
236  m_data = construct_string(len, m_capacity);
237  Sys::wMemCpy(m_data, str, len*sizeof(value_type));
238  m_length = len;
239  m_data[len] = 0;
240  }
static void wMemCpy(void *to, const void *from, size_t bytes)
Definition: PLATFORM.cpp:52
E value_type
Definition: simple_string_storage.hpp:221
std::string str(T begin, T end)
Definition: utils.hpp:39

◆ simple_wstring_storage() [3/4]

template<typename E , class TAllocator >
std::simple_wstring_storage< E, TAllocator >::simple_wstring_storage ( const value_type str,
size_type  len,
const allocator_type allocator 
)
inline
242  : m_allocator(allocator)
243  {
244  m_data = construct_string(len, m_capacity);
245  Sys::wMemCpy(m_data, str, len*sizeof(value_type));
246  m_length = len;
247  m_data[len] = 0;
248  }
static void wMemCpy(void *to, const void *from, size_t bytes)
Definition: PLATFORM.cpp:52
E value_type
Definition: simple_string_storage.hpp:221
std::string str(T begin, T end)
Definition: utils.hpp:39

◆ simple_wstring_storage() [4/4]

template<typename E , class TAllocator >
std::simple_wstring_storage< E, TAllocator >::simple_wstring_storage ( const simple_wstring_storage< E, TAllocator > &  rhs,
const allocator_type allocator 
)
inline
250  : m_data(0), m_capacity(0), m_length(0), m_allocator(allocator)
251  {
252  assign(rhs.c_str(), rhs.length());
253  }
void assign(const value_type *str, size_type len)
Definition: simple_string_storage.hpp:268

◆ ~simple_wstring_storage()

template<typename E , class TAllocator >
std::simple_wstring_storage< E, TAllocator >::~simple_wstring_storage ( )
inline
255  {
256  release_string();
257  }

Dokumentation der Elementfunktionen

◆ append()

template<typename E , class TAllocator >
void std::simple_wstring_storage< E, TAllocator >::append ( const value_type str,
size_type  len 
)
inline
282  {
283  const size_type prevLen = length();
284  const size_type newLen = prevLen + len;
285  if (m_capacity <= newLen + 1)
286  {
287  size_type newCapacity;
288  value_type* newData = construct_string(newLen, newCapacity);
289  Sys::wMemCpy(newData, m_data, prevLen * sizeof(value_type));
290  release_string();
291  m_data = newData;
292  m_capacity = newCapacity;
293  }
294  Sys::wMemCpy(m_data + prevLen, str, len * sizeof(value_type));
295  m_data[newLen] = 0;
296  m_length = newLen;
297  assert(invariant());
298  }
static void wMemCpy(void *to, const void *from, size_t bytes)
Definition: PLATFORM.cpp:52
E value_type
Definition: simple_string_storage.hpp:221
size_type length() const
Definition: simple_string_storage.hpp:305
bool invariant() const
Definition: simple_string_storage.hpp:325
int size_type
Definition: simple_string_storage.hpp:222
std::string str(T begin, T end)
Definition: utils.hpp:39

◆ assign()

template<typename E , class TAllocator >
void std::simple_wstring_storage< E, TAllocator >::assign ( const value_type str,
size_type  len 
)
inline
269  {
270  //assert(str != m_data);
271  if (m_capacity <= len + 1)
272  {
273  release_string();
274  m_data = construct_string(len, m_capacity);
275  }
276  Sys::wMemCpy(m_data, str, len*sizeof(value_type));
277  m_length = len;
278  m_data[len] = 0;
279  }
static void wMemCpy(void *to, const void *from, size_t bytes)
Definition: PLATFORM.cpp:52
E value_type
Definition: simple_string_storage.hpp:221
std::string str(T begin, T end)
Definition: utils.hpp:39

◆ c_str()

template<typename E , class TAllocator >
const value_type* std::simple_wstring_storage< E, TAllocator >::c_str ( ) const
inline
301  {
302  return m_data;
303  }

◆ capacity()

template<typename E , class TAllocator >
size_type std::simple_wstring_storage< E, TAllocator >::capacity ( ) const
inline
310 { return m_capacity; }

◆ clear()

template<typename E , class TAllocator >
void std::simple_wstring_storage< E, TAllocator >::clear ( )
inline
313  {
314  release_string();
315  m_data = construct_string(0, m_capacity);
316  m_length = 0;
317  }

◆ get_allocator()

template<typename E , class TAllocator >
const allocator_type& std::simple_wstring_storage< E, TAllocator >::get_allocator ( ) const
inline
319 { return m_allocator; }

◆ get_data()

template<typename E , class TAllocator >
value_type* std::simple_wstring_storage< E, TAllocator >::get_data ( )
inline
322 { return m_data; }

◆ invariant()

template<typename E , class TAllocator >
bool std::simple_wstring_storage< E, TAllocator >::invariant ( ) const
inlineprotected
326  {
327  assert(m_data);
328  assert(m_length <= m_capacity);
329  if (length() != 0)
330  assert(m_data[length()] == 0);
331  return true;
332  }
size_type length() const
Definition: simple_string_storage.hpp:305

◆ length()

template<typename E , class TAllocator >
size_type std::simple_wstring_storage< E, TAllocator >::length ( ) const
inline
306  {
307  return m_length;
308  }

◆ make_unique()

template<typename E , class TAllocator >
void std::simple_wstring_storage< E, TAllocator >::make_unique ( size_type  )
inline
321 {}

◆ operator=()

template<typename E , class TAllocator >
simple_wstring_storage& std::simple_wstring_storage< E, TAllocator >::operator= ( const simple_wstring_storage< E, TAllocator > &  rhs)
inline
260  {
261  if (m_data != rhs.c_str())
262  {
263  assign(rhs.c_str(), rhs.length());
264  }
265  return *this;
266  }
void assign(const value_type *str, size_type len)
Definition: simple_string_storage.hpp:268

Dokumentation der Datenelemente

◆ kGranularity

template<typename E , class TAllocator >
const unsigned long std::simple_wstring_storage< E, TAllocator >::kGranularity = 32
static

Die Dokumentation für diese Klasse wurde erzeugt aufgrund der Datei: