Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Ogre::String Class Reference

Wrapper object for String to allow DLL export. More...

#include <OgreString.h>

Inheritance diagram for Ogre::String:

_StringBase List of all members.

Public Types

typedef std::stringstream StrStreamType

Public Methods

 String ()
 Default constructor. More...

 String (const String &rhs)
 String (const _StringBase &rhs)
 Copy constructor for std::string's. More...

 String (const char *rhs)
 Copy-constructor for C-style strings. More...

 operator const char * () const
 Used for interaction with functions that require the old C-style strings. More...

void trim (bool left=true, bool right=true)
 Removes any whitespace characters, be it standard space or TABs and so on. More...

std::vector< String > split (const String &delims="\t\n", unsigned int maxSplits=0) const
 Returns a StringVector that contains all the substrings delimited by the characters in the passed delims argument. More...

String toLowerCase (void)
 Upper-cases all the characters in the string. More...

String toUpperCase (void)
 Lower-cases all the characters in the string. More...

Real toReal (void) const
 Converts the contents of the string to a Real. More...

template<typename T> String & operator<< (T value)
 Template operator for appending another type into the string. More...


Detailed Description

Wrapper object for String to allow DLL export.

Note:
Derived from std::string.


Member Typedef Documentation

typedef std::stringstream Ogre::String::StrStreamType
 


Constructor & Destructor Documentation

Ogre::String::String   [inline]
 

Default constructor.

Ogre::String::String const String &    rhs [inline]
 

Ogre::String::String const _StringBase   rhs [inline]
 

Copy constructor for std::string's.

Ogre::String::String const char *    rhs [inline]
 

Copy-constructor for C-style strings.


Member Function Documentation

Ogre::String::operator const char *   const [inline]
 

Used for interaction with functions that require the old C-style strings.

template<typename T>
String& Ogre::String::operator<<   value [inline]
 

Template operator for appending another type into the string.

Remarks:
Because this operator is templated, you can append any value into a string as long as there is an operator<<(std::basic_iostream, type) or similar method defined somewhere. All the primitive types have this already, and many of the Ogre types do too (see Vector3 for an example).

std::vector< String > Ogre::String::split const String &    delims = "\t\n",
unsigned int    maxSplits = 0
const
 

Returns a StringVector that contains all the substrings delimited by the characters in the passed delims argument.

Parameters:
delims  A list of delimiter characters to split by
maxSplits  The maximum number of splits to perform (0 for unlimited splits). If this parameters is > 0, the splitting process will stop after this many splits, left to right.

String Ogre::String::toLowerCase void   
 

Upper-cases all the characters in the string.

Real Ogre::String::toReal void    const
 

Converts the contents of the string to a Real.

Remarks:
Assumes the only contents of the string are a valid parsable Real. Defaults to a value of 0.0 if conversion is not possible.

String Ogre::String::toUpperCase void   
 

Lower-cases all the characters in the string.

void Ogre::String::trim bool    left = true,
bool    right = true
 

Removes any whitespace characters, be it standard space or TABs and so on.

Remarks:
The user may specify wether they want to trim only the beginning or the end of the String ( the default action is to trim both).

Copyright © 2002 by The OGRE Team