Nugget
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
eastl::basic_string< T, Allocator > Class Template Reference

#include <string.h>

Inheritance diagram for eastl::basic_string< T, Allocator >:
Inheritance graph
[legend]
Collaboration diagram for eastl::basic_string< T, Allocator >:
Collaboration graph
[legend]

Classes

struct  CtorConvert
 
struct  CtorDoNotInitialize
 'npos' means non-valid position or simply non-position. More...
 
struct  CtorSprintf
 
struct  HeapLayout
 
struct  Layout
 
struct  RawLayout
 
struct  SSOLayout
 
struct  SSOPadding
 
struct  SSOPadding< CharT, 1 >
 

Public Types

typedef basic_string< T, Allocator > this_type
 
typedef basic_string_view< T > view_type
 
typedef T value_type
 
typedef T * pointer
 
typedef const T * const_pointer
 
typedef T & reference
 
typedef const T & const_reference
 
typedef T * iterator
 
typedef const T * const_iterator
 
typedef eastl::reverse_iterator< iterator > reverse_iterator
 
typedef eastl::reverse_iterator< const_iterator > const_reverse_iterator
 
typedef eastl_size_t size_type
 
typedef ptrdiff_t difference_type
 
typedef Allocator allocator_type
 

Public Member Functions

 basic_string (const allocator_type &allocator) EA_NOEXCEPT
 
 basic_string (const this_type &x, size_type position, size_type n=npos)
 
 basic_string (const value_type *p, size_type n, const allocator_type &allocator=EASTL_BASIC_STRING_DEFAULT_ALLOCATOR)
 
EASTL_STRING_EXPLICIT basic_string (const value_type *p, const allocator_type &allocator=EASTL_BASIC_STRING_DEFAULT_ALLOCATOR)
 
 basic_string (size_type n, value_type c, const allocator_type &allocator=EASTL_BASIC_STRING_DEFAULT_ALLOCATOR)
 
 basic_string (const this_type &x)
 
 basic_string (const this_type &x, const allocator_type &allocator)
 
 basic_string (const value_type *pBegin, const value_type *pEnd, const allocator_type &allocator=EASTL_BASIC_STRING_DEFAULT_ALLOCATOR)
 
 basic_string (CtorDoNotInitialize, size_type n, const allocator_type &allocator=EASTL_BASIC_STRING_DEFAULT_ALLOCATOR)
 
 basic_string (CtorSprintf, const value_type *pFormat,...)
 
 basic_string (std::initializer_list< value_type > init, const allocator_type &allocator=EASTL_BASIC_STRING_DEFAULT_ALLOCATOR)
 
 basic_string (this_type &&x) EA_NOEXCEPT
 
 basic_string (this_type &&x, const allocator_type &allocator)
 
 basic_string (const view_type &sv, const allocator_type &allocator=EASTL_BASIC_STRING_DEFAULT_ALLOCATOR)
 
 basic_string (const view_type &sv, size_type position, size_type n, const allocator_type &allocator=EASTL_BASIC_STRING_DEFAULT_ALLOCATOR)
 
template<typename OtherCharType >
 basic_string (CtorConvert, const OtherCharType *p, const allocator_type &allocator=EASTL_BASIC_STRING_DEFAULT_ALLOCATOR)
 
template<typename OtherCharType >
 basic_string (CtorConvert, const OtherCharType *p, size_type n, const allocator_type &allocator=EASTL_BASIC_STRING_DEFAULT_ALLOCATOR)
 
template<typename OtherStringType >
 basic_string (CtorConvert, const OtherStringType &x)
 
const allocator_type & get_allocator () const EA_NOEXCEPT
 
allocator_type & get_allocator () EA_NOEXCEPT
 
void set_allocator (const allocator_type &allocator)
 
 operator basic_string_view< T > () const EA_NOEXCEPT
 
this_typeoperator= (const this_type &x)
 
this_typeoperator= (const value_type *p)
 
this_typeoperator= (value_type c)
 
this_typeoperator= (std::initializer_list< value_type > ilist)
 
this_typeoperator= (view_type v)
 
this_typeoperator= (this_type &&x)
 
void swap (this_type &x)
 
this_typeassign (const this_type &x)
 
this_typeassign (const this_type &x, size_type position, size_type n=npos)
 
this_typeassign (const value_type *p, size_type n)
 
this_typeassign (const value_type *p)
 
this_typeassign (size_type n, value_type c)
 
this_typeassign (const value_type *pBegin, const value_type *pEnd)
 
this_typeassign (this_type &&x)
 
this_typeassign (std::initializer_list< value_type >)
 
template<typename OtherCharType >
this_typeassign_convert (const OtherCharType *p)
 
template<typename OtherCharType >
this_typeassign_convert (const OtherCharType *p, size_type n)
 
template<typename OtherStringType >
this_typeassign_convert (const OtherStringType &x)
 
iterator begin () EA_NOEXCEPT
 
const_iterator begin () const EA_NOEXCEPT
 
const_iterator cbegin () const EA_NOEXCEPT
 
iterator end () EA_NOEXCEPT
 
const_iterator end () const EA_NOEXCEPT
 
const_iterator cend () const EA_NOEXCEPT
 
reverse_iterator rbegin () EA_NOEXCEPT
 
const_reverse_iterator rbegin () const EA_NOEXCEPT
 
const_reverse_iterator crbegin () const EA_NOEXCEPT
 
reverse_iterator rend () EA_NOEXCEPT
 
const_reverse_iterator rend () const EA_NOEXCEPT
 
const_reverse_iterator crend () const EA_NOEXCEPT
 
bool empty () const EA_NOEXCEPT
 
size_type size () const EA_NOEXCEPT
 
size_type length () const EA_NOEXCEPT
 
size_type max_size () const EA_NOEXCEPT
 
size_type capacity () const EA_NOEXCEPT
 
void resize (size_type n, value_type c)
 
void resize (size_type n)
 
void reserve (size_type=0)
 
void set_capacity (size_type n=npos)
 
void force_size (size_type n)
 
void shrink_to_fit ()
 
const value_type * data () const EA_NOEXCEPT
 
value_type * data () EA_NOEXCEPT
 
const value_type * c_str () const EA_NOEXCEPT
 
reference operator[] (size_type n)
 
const_reference operator[] (size_type n) const
 
reference at (size_type n)
 
const_reference at (size_type n) const
 
reference front ()
 
const_reference front () const
 
reference back ()
 
const_reference back () const
 
this_typeoperator+= (const this_type &x)
 
this_typeoperator+= (const value_type *p)
 
this_typeoperator+= (value_type c)
 
this_typeappend (const this_type &x)
 
this_typeappend (const this_type &x, size_type position, size_type n=npos)
 
this_typeappend (const value_type *p, size_type n)
 
this_typeappend (const value_type *p)
 
this_typeappend (size_type n, value_type c)
 
this_typeappend (const value_type *pBegin, const value_type *pEnd)
 
this_typeappend_sprintf_va_list (const value_type *pFormat, va_list arguments)
 
this_typeappend_sprintf (const value_type *pFormat,...)
 
template<typename OtherCharType >
this_typeappend_convert (const OtherCharType *p)
 
template<typename OtherCharType >
this_typeappend_convert (const OtherCharType *p, size_type n)
 
template<typename OtherStringType >
this_typeappend_convert (const OtherStringType &x)
 
void push_back (value_type c)
 
void pop_back ()
 
this_typeinsert (size_type position, const this_type &x)
 
this_typeinsert (size_type position, const this_type &x, size_type beg, size_type n)
 
this_typeinsert (size_type position, const value_type *p, size_type n)
 
this_typeinsert (size_type position, const value_type *p)
 
this_typeinsert (size_type position, size_type n, value_type c)
 
iterator insert (const_iterator p, value_type c)
 
iterator insert (const_iterator p, size_type n, value_type c)
 
iterator insert (const_iterator p, const value_type *pBegin, const value_type *pEnd)
 
iterator insert (const_iterator p, std::initializer_list< value_type >)
 
this_typeerase (size_type position=0, size_type n=npos)
 
iterator erase (const_iterator p)
 
iterator erase (const_iterator pBegin, const_iterator pEnd)
 
reverse_iterator erase (reverse_iterator position)
 
reverse_iterator erase (reverse_iterator first, reverse_iterator last)
 
void clear () EA_NOEXCEPT
 
pointer detach () EA_NOEXCEPT
 
this_typereplace (size_type position, size_type n, const this_type &x)
 
this_typereplace (size_type pos1, size_type n1, const this_type &x, size_type pos2, size_type n2=npos)
 
this_typereplace (size_type position, size_type n1, const value_type *p, size_type n2)
 
this_typereplace (size_type position, size_type n1, const value_type *p)
 
this_typereplace (size_type position, size_type n1, size_type n2, value_type c)
 
this_typereplace (const_iterator first, const_iterator last, const this_type &x)
 
this_typereplace (const_iterator first, const_iterator last, const value_type *p, size_type n)
 
this_typereplace (const_iterator first, const_iterator last, const value_type *p)
 
this_typereplace (const_iterator first, const_iterator last, size_type n, value_type c)
 
this_typereplace (const_iterator first, const_iterator last, const value_type *pBegin, const value_type *pEnd)
 
size_type copy (value_type *p, size_type n, size_type position=0) const
 
size_type find (const this_type &x, size_type position=0) const EA_NOEXCEPT
 
size_type find (const value_type *p, size_type position=0) const
 
size_type find (const value_type *p, size_type position, size_type n) const
 
size_type find (value_type c, size_type position=0) const EA_NOEXCEPT
 
size_type rfind (const this_type &x, size_type position=npos) const EA_NOEXCEPT
 
size_type rfind (const value_type *p, size_type position=npos) const
 
size_type rfind (const value_type *p, size_type position, size_type n) const
 
size_type rfind (value_type c, size_type position=npos) const EA_NOEXCEPT
 
size_type find_first_of (const this_type &x, size_type position=0) const EA_NOEXCEPT
 
size_type find_first_of (const value_type *p, size_type position=0) const
 
size_type find_first_of (const value_type *p, size_type position, size_type n) const
 
size_type find_first_of (value_type c, size_type position=0) const EA_NOEXCEPT
 
size_type find_last_of (const this_type &x, size_type position=npos) const EA_NOEXCEPT
 
size_type find_last_of (const value_type *p, size_type position=npos) const
 
size_type find_last_of (const value_type *p, size_type position, size_type n) const
 
size_type find_last_of (value_type c, size_type position=npos) const EA_NOEXCEPT
 
size_type find_first_not_of (const this_type &x, size_type position=0) const EA_NOEXCEPT
 
size_type find_first_not_of (const value_type *p, size_type position=0) const
 
size_type find_first_not_of (const value_type *p, size_type position, size_type n) const
 
size_type find_first_not_of (value_type c, size_type position=0) const EA_NOEXCEPT
 
size_type find_last_not_of (const this_type &x, size_type position=npos) const EA_NOEXCEPT
 
size_type find_last_not_of (const value_type *p, size_type position=npos) const
 
size_type find_last_not_of (const value_type *p, size_type position, size_type n) const
 
size_type find_last_not_of (value_type c, size_type position=npos) const EA_NOEXCEPT
 
this_type substr (size_type position=0, size_type n=npos) const
 
int compare (const this_type &x) const EA_NOEXCEPT
 
int compare (size_type pos1, size_type n1, const this_type &x) const
 
int compare (size_type pos1, size_type n1, const this_type &x, size_type pos2, size_type n2) const
 
int compare (const value_type *p) const
 
int compare (size_type pos1, size_type n1, const value_type *p) const
 
int compare (size_type pos1, size_type n1, const value_type *p, size_type n2) const
 
int comparei (const this_type &x) const EA_NOEXCEPT
 
int comparei (const value_type *p) const
 
void make_lower ()
 
void make_upper ()
 
void ltrim ()
 
void rtrim ()
 
void trim ()
 
void ltrim (const value_type *p)
 
void rtrim (const value_type *p)
 
void trim (const value_type *p)
 
this_type left (size_type n) const
 
this_type right (size_type n) const
 
this_typesprintf_va_list (const value_type *pFormat, va_list arguments)
 
this_typesprintf (const value_type *pFormat,...)
 
bool validate () const EA_NOEXCEPT
 
int validate_iterator (const_iterator i) const EA_NOEXCEPT
 
template<typename OtherCharType >
basic_string< T, Allocator > & append_convert (const OtherCharType *pOther)
 
template<typename OtherStringType >
basic_string< T, Allocator > & append_convert (const OtherStringType &x)
 
template<typename OtherCharType >
basic_string< T, Allocator > & append_convert (const OtherCharType *pOther, size_type n)
 
template<typename OtherCharType >
basic_string< T, Allocator > & assign_convert (const OtherCharType *p)
 
template<typename OtherCharType >
basic_string< T, Allocator > & assign_convert (const OtherCharType *p, size_type n)
 
template<typename OtherStringType >
basic_string< T, Allocator > & assign_convert (const OtherStringType &x)
 

Static Public Member Functions

static int compare (const value_type *pBegin1, const value_type *pEnd1, const value_type *pBegin2, const value_type *pEnd2)
 
static int comparei (const value_type *pBegin1, const value_type *pEnd1, const value_type *pBegin2, const value_type *pEnd2)
 

Static Public Attributes

static const EA_CONSTEXPR size_type npos = (size_type)-1
 
static EA_CONSTEXPR_OR_CONST size_type kMaxSize = ~kHeapMask
 

Protected Member Functions

LayoutinternalLayout () EA_NOEXCEPT
 
const LayoutinternalLayout () const EA_NOEXCEPT
 
allocator_type & internalAllocator () EA_NOEXCEPT
 
const allocator_type & internalAllocator () const EA_NOEXCEPT
 
value_type * DoAllocate (size_type n)
 
void DoFree (value_type *p, size_type n)
 
size_type GetNewCapacity (size_type currentCapacity)
 
size_type GetNewCapacity (size_type currentCapacity, size_type minimumGrowSize)
 
void AllocateSelf ()
 
void AllocateSelf (size_type n)
 
void DeallocateSelf ()
 
iterator InsertInternal (const_iterator p, value_type c)
 
void RangeInitialize (const value_type *pBegin, const value_type *pEnd)
 
void RangeInitialize (const value_type *pBegin)
 
void SizeInitialize (size_type n, value_type c)
 
bool IsSSO () const EA_NOEXCEPT
 
void ThrowLengthException () const
 
void ThrowRangeException () const
 
void ThrowInvalidArgumentException () const
 

Static Protected Member Functions

static const value_type * CharTypeStringFindEnd (const value_type *pBegin, const value_type *pEnd, value_type c)
 
static const value_type * CharTypeStringRFind (const value_type *pRBegin, const value_type *pREnd, const value_type c)
 
static const value_type * CharTypeStringSearch (const value_type *p1Begin, const value_type *p1End, const value_type *p2Begin, const value_type *p2End)
 
static const value_type * CharTypeStringRSearch (const value_type *p1Begin, const value_type *p1End, const value_type *p2Begin, const value_type *p2End)
 
static const value_type * CharTypeStringFindFirstOf (const value_type *p1Begin, const value_type *p1End, const value_type *p2Begin, const value_type *p2End)
 
static const value_type * CharTypeStringRFindFirstOf (const value_type *p1RBegin, const value_type *p1REnd, const value_type *p2Begin, const value_type *p2End)
 
static const value_type * CharTypeStringFindFirstNotOf (const value_type *p1Begin, const value_type *p1End, const value_type *p2Begin, const value_type *p2End)
 
static const value_type * CharTypeStringRFindFirstNotOf (const value_type *p1RBegin, const value_type *p1REnd, const value_type *p2Begin, const value_type *p2End)
 

Protected Attributes

eastl::compressed_pair< Layout, allocator_type > mPair
 

Static Protected Attributes

static EA_CONSTEXPR_OR_CONST size_type kHeapMask = ~(size_type(~size_type(0)) >> 1)
 
static EA_CONSTEXPR_OR_CONST size_type kSSOMask = 0x80
 

Detailed Description

template<typename T, typename Allocator = EASTLAllocatorType>
class eastl::basic_string< T, Allocator >

basic_string

Implements a templated string class, somewhat like C++ std::basic_string.

Notes: As of this writing, an insert of a string into itself necessarily triggers a reallocation, even if there is enough capacity in self to handle the increase in size. This is due to the slightly tricky nature of the operation of modifying one's self with one's self, and thus the source and destination are being modified during the operation. It might be useful to rectify this to the extent possible.

Our usage of noexcept specifiers is a little different from the requirements specified by std::basic_string in C++11. This is because our allocators are instances and not types and thus can be non-equal and result in exceptions during assignments that theoretically can't occur with std containers.


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