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 (char x) const
bool contains (const char *x) const
bool contains (const String &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 hasPrefix (const String &x) const
bool hasSuffix (const char *x) const
bool hasSuffix (const String &x) const
void insertChar (char c, uint32 p)
char lastChar () const
bool matchString (const String &pat, bool ignoreCase=false, bool pathMode=false) const
bool matchString (const char *pat, bool ignoreCase=false, bool pathMode=false) 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) const
void setChar (char c, uint32 p)
uint size () const
 String (char c)
 String (const String &str)
 String (const char *beginP, const char *endP)
 String (const char *str, uint32 len)
 String (const char *str)
 String ()
void toLowercase ()
void toUppercase ()
void trim ()

Static Public Member Functions

static Common::String printf (const char *fmt,...) GCC_PRINTF(1

Protected Member Functions

void decRefCount (int *oldRefCount)
void ensureCapacity (uint32 new_size, bool keep_old)
void incRefCount () const
void initWithCStr (const char *str, uint32 len)
bool isStorageIntern () const
void makeUnique ()

Protected Attributes

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

Static Protected Attributes

static const uint32 _builtinCapacity = 32 - sizeof(uint32) - sizeof(char *)

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

Generated by  Doxygen 1.6.0   Back to index