Logo Search packages:      
Sourcecode: scummvm version File versions  Download package

Common::String Class Reference

#include <str.h>

List of all members.

Detailed Description

Simple string class for ScummVM. Provides automatic storage managment, and overloads several operators in a 'natural' fashion, mimicking the std::string class. Even provides simple iterators.

This class tries to avoid allocating lots of small blocks on the heap, since that is inefficient on several platforms supported by ScummVM. Instead, small strings are stored 'inside' the string object (i.e. on the stack, for stack allocated objects), and only for strings exceeding a certain length do we allocate a buffer on the heap.

Definition at line 44 of file str.h.

Public Types

typedef const char * const_iterator
typedef char * iterator

Public Member Functions

const_iterator begin () const
iterator begin ()
const char * c_str () const
void clear ()
int compareTo (const char *x) const
int compareTo (const String &x) const
int compareToIgnoreCase (const char *x) const
int compareToIgnoreCase (const String &x) const
bool contains (const char *x) const
void deleteChar (uint32 p)
void deleteLastChar ()
bool empty () const
const_iterator end () const
iterator end ()
bool equals (const char *x) const
bool equals (const String &x) const
bool equalsIgnoreCase (const char *x) const
bool equalsIgnoreCase (const String &x) const
uint hash () const
bool hasPrefix (const char *x) const
bool hasSuffix (const char *x) const
void insertChar (char c, uint32 p)
char lastChar () const
bool operator!= (const char *x) const
bool operator!= (const String &x) const
Stringoperator+= (char c)
Stringoperator+= (const String &str)
Stringoperator+= (const char *str)
bool operator< (const String &x) const
bool operator<= (const String &x) const
Stringoperator= (char c)
Stringoperator= (const String &str)
Stringoperator= (const char *str)
bool operator== (const char *x) const
bool operator== (const String &x) const
bool operator> (const String &x) const
bool operator>= (const String &x) const
char & operator[] (int idx)
char operator[] (int idx) const
uint size () const
 String (char c)
 String (const String &str)
 String (const char *str, uint32 len=0)
void toLowercase ()
void toUppercase ()

Static Public Attributes

static const String emptyString

Protected Member Functions

void decRefCount (int *oldRefCount)
void ensureCapacity (uint32 new_len, bool keep_old)
void incRefCount () const
bool isStorageIntern () const

Protected Attributes

union {
   struct {
      uint32   _capacity
      int *   _refCount
   }   _extern
   char   _storage [_builtinCapacity]
uint32 _len
char * _str

Static Protected Attributes

static const uint32 _builtinCapacity = 32

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

Generated by  Doxygen 1.6.0   Back to index