Nugget
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | Protected Attributes | List of all members
eastl::fixed_string< T, nodeCount, bEnableOverflow, OverflowAllocator > Class Template Reference

#include <fixed_string.h>

Inheritance diagram for eastl::fixed_string< T, nodeCount, bEnableOverflow, OverflowAllocator >:
Inheritance graph
[legend]
Collaboration diagram for eastl::fixed_string< T, nodeCount, bEnableOverflow, OverflowAllocator >:
Collaboration graph
[legend]

Public Types

enum  { kMaxSize = nodeCount - 1 }
 
typedef fixed_vector_allocator< sizeof(T), nodeCount, EASTL_ALIGN_OF(T), 0, bEnableOverflow, OverflowAllocator > fixed_allocator_type
 
typedef fixed_allocator_type::overflow_allocator_type overflow_allocator_type
 
typedef basic_string< T, fixed_allocator_typebase_type
 
typedef fixed_string< T, nodeCount, bEnableOverflow, OverflowAllocator > this_type
 
typedef base_type::size_type size_type
 
typedef base_type::value_type value_type
 
typedef base_type::CtorDoNotInitialize CtorDoNotInitialize
 
typedef base_type::CtorSprintf CtorSprintf
 
typedef aligned_buffer< nodeCount *sizeof(T), EASTL_ALIGN_OF(T)> aligned_buffer_type
 
- Public Types inherited from eastl::basic_string< T, fixed_vector_allocator< sizeof(T), nodeCount, EASTL_ALIGN_OF(T), 0, true, EASTLAllocatorType > >
typedef basic_string< T, fixed_vector_allocator< sizeof(T), nodeCount, EASTL_ALIGN_OF(T), 0, true, EASTLAllocatorType > > 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 fixed_vector_allocator< sizeof(T), nodeCount, EASTL_ALIGN_OF(T), 0, true, EASTLAllocatorType > allocator_type
 

Public Member Functions

 fixed_string (const overflow_allocator_type &overflowAllocator)
 
 fixed_string (const base_type &x, size_type position, size_type n=base_type::npos)
 
 fixed_string (const value_type *p, size_type n)
 
 fixed_string (const value_type *p)
 
 fixed_string (size_type n, const value_type &value)
 
 fixed_string (const this_type &x)
 
 fixed_string (const this_type &x, const overflow_allocator_type &overflowAllocator)
 
 fixed_string (const base_type &x)
 
 fixed_string (const value_type *pBegin, const value_type *pEnd)
 
 fixed_string (CtorDoNotInitialize, size_type n)
 
 fixed_string (CtorSprintf, const value_type *pFormat,...)
 
 fixed_string (std::initializer_list< T > ilist, const overflow_allocator_type &overflowAllocator)
 
 fixed_string (this_type &&x)
 
 fixed_string (this_type &&x, const overflow_allocator_type &overflowAllocator)
 
this_typeoperator= (const this_type &x)
 
this_typeoperator= (const base_type &x)
 
this_typeoperator= (const value_type *p)
 
this_typeoperator= (const value_type c)
 
this_typeoperator= (std::initializer_list< T > ilist)
 
this_typeoperator= (this_type &&x)
 
void swap (this_type &x)
 
void set_capacity (size_type n)
 
void reset_lose_memory ()
 
size_type max_size () const
 
bool full () const
 
bool has_overflowed () const
 
bool can_overflow () const
 
this_type substr (size_type position, size_type n) const
 
this_type left (size_type n) const
 
this_type right (size_type n) const
 
const overflow_allocator_type & get_overflow_allocator () const EA_NOEXCEPT
 
overflow_allocator_type & get_overflow_allocator () EA_NOEXCEPT
 
void set_overflow_allocator (const overflow_allocator_type &allocator)
 
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)
 
void resize (size_type n, value_type c)
 
void resize (size_type n)
 
void clear () EA_NOEXCEPT
 
size_type capacity () const EA_NOEXCEPT
 
size_type size () const EA_NOEXCEPT
 
this_typesprintf_va_list (const value_type *pFormat, va_list arguments)
 
value_type * DoAllocate (size_type n)
 
void DoFree (value_type *p, size_type n)
 
Layout & internalLayout () EA_NOEXCEPT
 
const Layout & internalLayout () const EA_NOEXCEPT
 
const allocator_typeget_allocator () const EA_NOEXCEPT
 
allocator_typeget_allocator () EA_NOEXCEPT
 
- Public Member Functions inherited from eastl::basic_string< T, fixed_vector_allocator< sizeof(T), nodeCount, EASTL_ALIGN_OF(T), 0, true, EASTLAllocatorType > >
 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)
 
 basic_string (CtorConvert, const OtherCharType *p, const allocator_type &allocator=EASTL_BASIC_STRING_DEFAULT_ALLOCATOR)
 
 basic_string (CtorConvert, const OtherCharType *p, size_type n, const allocator_type &allocator=EASTL_BASIC_STRING_DEFAULT_ALLOCATOR)
 
 basic_string (CtorConvert, const OtherStringType &x)
 
const allocator_typeget_allocator () const EA_NOEXCEPT
 
allocator_typeget_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 >)
 
this_typeassign_convert (const OtherCharType *p)
 
this_typeassign_convert (const OtherCharType *p, size_type n)
 
this_typeassign_convert (const OtherStringType &x)
 
basic_string< T, fixed_vector_allocator< sizeof(T), nodeCount, EASTL_ALIGN_OF(T), 0, true, EASTLAllocatorType > > & assign_convert (const OtherCharType *p)
 
basic_string< T, fixed_vector_allocator< sizeof(T), nodeCount, EASTL_ALIGN_OF(T), 0, true, EASTLAllocatorType > > & assign_convert (const OtherCharType *p, size_type n)
 
basic_string< T, fixed_vector_allocator< sizeof(T), nodeCount, EASTL_ALIGN_OF(T), 0, true, EASTLAllocatorType > > & assign_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,...)
 
this_typeappend_convert (const OtherCharType *p)
 
this_typeappend_convert (const OtherCharType *p, size_type n)
 
this_typeappend_convert (const OtherStringType &x)
 
basic_string< T, fixed_vector_allocator< sizeof(T), nodeCount, EASTL_ALIGN_OF(T), 0, true, EASTLAllocatorType > > & append_convert (const OtherCharType *pOther)
 
basic_string< T, fixed_vector_allocator< sizeof(T), nodeCount, EASTL_ALIGN_OF(T), 0, true, EASTLAllocatorType > > & append_convert (const OtherStringType &x)
 
basic_string< T, fixed_vector_allocator< sizeof(T), nodeCount, EASTL_ALIGN_OF(T), 0, true, EASTLAllocatorType > > & append_convert (const OtherCharType *pOther, size_type n)
 
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 ltrim (const value_type *p)
 
void rtrim ()
 
void rtrim (const value_type *p)
 
void trim ()
 
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
 

Public Attributes

eastl::compressed_pair< Layout, allocator_typemPair
 
value_type mArray [1]
 
aligned_buffer_type mBuffer
 

Static Public Attributes

static const EA_CONSTEXPR size_type npos
 
- Static Public Attributes inherited from eastl::basic_string< T, fixed_vector_allocator< sizeof(T), nodeCount, EASTL_ALIGN_OF(T), 0, true, EASTLAllocatorType > >
static const EA_CONSTEXPR size_type npos
 
static EA_CONSTEXPR_OR_CONST size_type kMaxSize
 

Protected Attributes

union {
   value_type   mArray [1]
 
   aligned_buffer_type   mBuffer
 
}; 
 
- Protected Attributes inherited from eastl::basic_string< T, fixed_vector_allocator< sizeof(T), nodeCount, EASTL_ALIGN_OF(T), 0, true, EASTLAllocatorType > >
eastl::compressed_pair< Layout, allocator_typemPair
 

Additional Inherited Members

- Static Public Member Functions inherited from eastl::basic_string< T, fixed_vector_allocator< sizeof(T), nodeCount, EASTL_ALIGN_OF(T), 0, true, EASTLAllocatorType > >
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)
 
- Protected Member Functions inherited from eastl::basic_string< T, fixed_vector_allocator< sizeof(T), nodeCount, EASTL_ALIGN_OF(T), 0, true, EASTLAllocatorType > >
Layout & internalLayout () EA_NOEXCEPT
 
const Layout & internalLayout () const EA_NOEXCEPT
 
allocator_typeinternalAllocator () EA_NOEXCEPT
 
const allocator_typeinternalAllocator () 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 inherited from eastl::basic_string< T, fixed_vector_allocator< sizeof(T), nodeCount, EASTL_ALIGN_OF(T), 0, true, EASTLAllocatorType > >
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)
 
- Static Protected Attributes inherited from eastl::basic_string< T, fixed_vector_allocator< sizeof(T), nodeCount, EASTL_ALIGN_OF(T), 0, true, EASTLAllocatorType > >
static EA_CONSTEXPR_OR_CONST size_type kHeapMask
 
static EA_CONSTEXPR_OR_CONST size_type kSSOMask
 

Detailed Description

template<typename T, int nodeCount, bool bEnableOverflow = true, typename OverflowAllocator = EASTLAllocatorType>
class eastl::fixed_string< T, nodeCount, bEnableOverflow, OverflowAllocator >

fixed_string

A fixed_string with bEnableOverflow == true is identical to a regular string in terms of its behavior. All the expectations of regular string apply to it and no additional expectations come from it. When bEnableOverflow is false, fixed_string behaves like regular string with the exception that its capacity can never increase. All operations you do on such a fixed_string which require a capacity increase will result in undefined behavior or an C++ allocation exception, depending on the configuration of EASTL.

Note: The nodeCount value is the amount of characters to allocate, which needs to take into account a terminating zero. Thus if you want to store strings with a strlen of 30, the nodeCount value must be at least 31.

Template parameters: T The type of object the string holds (char, wchar_t, char8_t, char16_t, char32_t). nodeCount The max number of objects to contain. bEnableOverflow Whether or not we should use the overflow heap if our object pool is exhausted. OverflowAllocator Overflow allocator, which is only used if bEnableOverflow == true. Defaults to the global heap.

Notes: The nodeCount value must be at least 2, one for a character and one for a terminating 0.

As of this writing, the string class necessarily reallocates when an insert of self is done into self. As a result, the fixed_string class doesn't support inserting self into self unless the bEnableOverflow template parameter is true.

Example usage: fixed_string<char, 128 + 1, true> fixedString("hello world"); // Can hold up to a strlen of 128.

fixedString = "hola mundo"; fixedString.clear(); fixedString.resize(200); fixedString.sprintf("%f", 1.5f);


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