- Your Widget Set For OpenGL
Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | Related Pages

ufo::UString Class Reference

A simple wrapper for std::string which is derived from UObject. More...

#include <ustring.hpp>

Inheritance diagram for ufo::UString:

ufo::UObject ufo::UCollectable List of all members.

Public Member Functions

 UString (char *str)
 UString (const char *str)
 UString (const std::string &str)
bool operator== (UString &str) const
bool operator== (const UString &str) const
bool operator== (const std::string &str) const
UStringoperator= (char *str)
UStringoperator= (const char *str)
UStringoperator= (const std::string &str)
 operator std::string () const
const std::string & str () const
std::string & str ()
const char * c_str () const
void detach ()
std::vector< std::string > tokenize (char delimiter) const
UString upperCase () const
UString lowerCase () const
virtual unsigned int hashCode () const
virtual bool equals (const UString *str) const
virtual bool equals (const UObject *obj) const
virtual std::string toString () const
virtual UObjectclone () const

Static Public Member Functions

template<typename TYPE> std::string toString (const TYPE &t)
int toInt (const std::string &str)
unsigned int toUnsignedInt (const std::string &str)
double toDouble (const std::string &str)
unsigned int hash (const char *cstr)

Protected Member Functions

virtual std::ostream & paramString (std::ostream &os) const

Detailed Description

A simple wrapper for std::string which is derived from UObject.

Uses implicit data sharing. Implements some usefule functions like toString(Type & T), tokenize(), unsigned int hash(const char*), etc.

Author:
Johannes Schmidt


Member Function Documentation

const char * ufo::UString::c_str  )  const [inline]
 

Returns a const char pointer to the shared string object.

virtual UObject* ufo::UString::clone  )  const [virtual]
 

tries to make a new object with the same internal data.

Reimplemented from ufo::UObject.

void ufo::UString::detach  ) 
 

Creates a local copy of the shared string.

virtual bool ufo::UString::equals const UObject obj  )  const [virtual]
 

checks if this object is the same object than obj

Reimplemented from ufo::UObject.

virtual bool ufo::UString::equals const UString str  )  const [virtual]
 

checks if this object is the same object than obj

unsigned int ufo::UString::hash const char *  cstr  )  [static]
 

Computes a hash value using horner's rule.

virtual unsigned int ufo::UString::hashCode  )  const [virtual]
 

returns a std::size_t which is used when UObject pointers are the keys for UHashMap. If equals(UObject*) returns true, these two objects should return the same hash code. If these objects are different, the hash code may be equal.

Returns:
a hash code.

Reimplemented from ufo::UObject.

UString ufo::UString::lowerCase  )  const
 

Returns a new string with all characters in lower case.

virtual std::ostream& ufo::UString::paramString std::ostream &  os  )  const [protected, virtual]
 

Prints some useful internal data to the ostream os. This method is meant only for debugging purposes.

Reimplemented from ufo::UObject.

std::string & ufo::UString::str  )  [inline]
 

Returns a reference to the internal string. Be careful, this changes the internal string for all UString objects which are using the shared string. Use detach() if you want to modify only this UString object. This string should not be stored as it may be invalid when the UString objet gets out of scope.

See also:
detach

const std::string & ufo::UString::str  )  const [inline]
 

Returns a const ref to the internal string. This string should not be stored as it may be invalid when the UString objet gets out of scope.

std::vector<std::string> ufo::UString::tokenize char  delimiter  )  const
 

The string is cut at every occurence of the character delimiter. The resulting array of strings (without delimiter) is returned.

Returns:
A tokenized vector of strings.

virtual std::string ufo::UString::toString  )  const [virtual]
 

Returns only the string

Reimplemented from ufo::UObject.

template<typename TYPE>
std::string ufo::UString::toString const TYPE &  t  )  [static]
 

returns a string representation of the given type

UString ufo::UString::upperCase  )  const
 

Returns a new string with all characters in upper case.


The documentation for this class was generated from the following file:
The libUFO Project - written by Johannes Schmidt