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>

Collaboration diagram for Ogre::String:

Collaboration graph
[legend]
List of all members.

Public Types

typedef std::stringstream StrStreamType

Public Methods

 String ()
 Default constructor.

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

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

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

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

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.

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

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

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

bool startsWith (const String &pattern, bool lowerCase=true) const
 Returns whether the string begins with the pattern passed in.

bool endsWith (const String &pattern, bool lowerCase=true) const
 Returns whether the string ends with the pattern passed in.

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


Static Public Attributes

String BLANK = String("")
 Constant blank string, useful for returning by ref where local does not exist.


Detailed Description

Wrapper object for String to allow DLL export.

Note:
Derived from std::string.

Definition at line 97 of file OgreString.h.


Member Typedef Documentation

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

Definition at line 100 of file OgreString.h.


Constructor & Destructor Documentation

Ogre::String::String  
 

Default constructor.

Definition at line 104 of file OgreString.h.

References Ogre::_StringBase.

Ogre::String::String const String &    rhs
 

Definition at line 106 of file OgreString.h.

References Ogre::_StringBase.

Ogre::String::String const _StringBase   rhs
 

Copy constructor for std::string's.

Definition at line 110 of file OgreString.h.

References Ogre::_StringBase.

Ogre::String::String const char *    rhs
 

Copy-constructor for C-style strings.

Definition at line 114 of file OgreString.h.

References Ogre::_StringBase.


Member Function Documentation

bool Ogre::String::endsWith const String &    pattern,
bool    lowerCase = true
const
 

Returns whether the string ends with the pattern passed in.

Parameters:
pattern  The pattern to compare with.
lowerCase  If true, the end of the string will be lower cased before comparison, pattern should also be in lower case.

Definition at line 143 of file OgreString.cpp.

References toLowerCase().

Referenced by Ogre::D3D9Texture::_loadCubeTex(), and Ogre::GLTexture::load().

Ogre::String::operator const char *   const
 

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

Definition at line 119 of file OgreString.h.

template<typename T>
String& Ogre::String::operator<<   value
 

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).

Definition at line 183 of file OgreString.h.

References Ogre::_StringBase.

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.

Definition at line 60 of file OgreString.cpp.

Referenced by Ogre::CgProgram::buildArgs(), Ogre::TextBoxGuiElement::CmdTextArea::doSet(), Ogre::TextBoxGuiElement::CmdBackPanel::doSet(), Ogre::ScrollBarGuiElement::CmdScrollBit::doSet(), Ogre::ScrollBarGuiElement::CmdDownButton::doSet(), Ogre::ScrollBarGuiElement::CmdUpButton::doSet(), Ogre::PopupMenuGuiElement::CmdHSpacing::doSet(), Ogre::PopupMenuGuiElement::CmdVSpacing::doSet(), Ogre::PopupMenuGuiElement::CmdItemTemplate::doSet(), Ogre::PanelGuiElement::CmdTiling::doSet(), Ogre::ListGuiElement::CmdHSpacing::doSet(), Ogre::ListGuiElement::CmdScrollBar::doSet(), Ogre::ListGuiElement::CmdVSpacing::doSet(), Ogre::ListGuiElement::CmdItemTemplate::doSet(), Ogre::CgProgram::CmdProfiles::doSet(), Ogre::ButtonGuiElement::CmdButtonCaption::doSet(), Ogre::ButtonGuiElement::CmdButtonDisabledMaterial::doSet(), Ogre::ButtonGuiElement::CmdButtonHiliteUpMaterial::doSet(), Ogre::ButtonGuiElement::CmdButtonHiliteDownMaterial::doSet(), Ogre::ButtonGuiElement::CmdButtonUpMaterial::doSet(), Ogre::ButtonGuiElement::CmdButtonDownMaterial::doSet(), Ogre::BorderPanelGuiElement::CmdBorderBottomUV::doSet(), Ogre::BorderPanelGuiElement::CmdBorderTopUV::doSet(), Ogre::BorderPanelGuiElement::CmdBorderRightUV::doSet(), Ogre::BorderPanelGuiElement::CmdBorderLeftUV::doSet(), Ogre::BorderPanelGuiElement::CmdBorderTopRightUV::doSet(), Ogre::BorderPanelGuiElement::CmdBorderTopLeftUV::doSet(), Ogre::BorderPanelGuiElement::CmdBorderBottomRightUV::doSet(), Ogre::BorderPanelGuiElement::CmdBorderBottomLeftUV::doSet(), Ogre::BorderPanelGuiElement::CmdBorderMaterial::doSet(), Ogre::BorderPanelGuiElement::CmdBorderSize::doSet(), Ogre::BorderButtonGuiElement::CmdBorderButtonCaption::doSet(), Ogre::BorderButtonGuiElement::CmdBorderDisabledMaterial::doSet(), Ogre::BorderButtonGuiElement::CmdBorderHiliteUpMaterial::doSet(), Ogre::BorderButtonGuiElement::CmdBorderHiliteDownMaterial::doSet(), Ogre::BorderButtonGuiElement::CmdBorderUpMaterial::doSet(), Ogre::BorderButtonGuiElement::CmdBorderDownMaterial::doSet(), Ogre::MaterialSerializer::invokeParser(), Ogre::Skeleton::load(), Ogre::Mesh::load(), Ogre::BspLevel::loadEntities(), Ogre::ParticleSystemManager::parseAffectorAttrib(), Ogre::parseAlphaOpEx(), Ogre::parseAlphaRejection(), Ogre::parseAmbient(), Ogre::parseAnimTexture(), Ogre::ParticleSystemManager::parseAttrib(), Ogre::OverlayManager::parseAttrib(), Ogre::FontManager::parseAttribute(), Ogre::OverlayManager::parseChildren(), Ogre::parseColourOpEx(), Ogre::parseColourOpFallback(), Ogre::StringConverter::parseColourValue(), Ogre::parseCubicTexture(), Ogre::parseDiffuse(), Ogre::OverlayManager::parseElementAttrib(), Ogre::parseEmissive(), Ogre::ParticleSystemManager::parseEmitterAttrib(), Ogre::parseFiltering(), Ogre::parseFogging(), Ogre::parseFragmentProgram(), Ogre::parseIteration(), Ogre::parseLodDistances(), Ogre::StringConverter::parseMatrix3(), Ogre::StringConverter::parseMatrix4(), Ogre::OverlayManager::parseNewMesh(), Ogre::OverlayManager::parseOverlayFile(), Ogre::parseParamIndexed(), Ogre::parseParamIndexedAuto(), Ogre::parseParamNamed(), Ogre::parseParamNamedAuto(), Ogre::parseProgramCustomParameter(), Ogre::StringConverter::parseQuaternion(), Ogre::parseScale(), Ogre::parseSceneBlend(), Ogre::ParticleSystemManager::parseScript(), Ogre::MaterialSerializer::parseScriptLine(), Ogre::parseScroll(), Ogre::parseScrollAnim(), Ogre::Quake3ShaderManager::parseShaderAttrib(), Ogre::Quake3ShaderManager::parseShaderPassAttrib(), Ogre::parseSpecular(), Ogre::StringConverter::parseStringVector(), Ogre::parseTexture(), Ogre::StringConverter::parseVector3(), Ogre::parseVertexProgram(), and Ogre::parseWaveXform().

bool Ogre::String::startsWith const String &    pattern,
bool    lowerCase = true
const
 

Returns whether the string begins with the pattern passed in.

Parameters:
pattern  The pattern to compare with.
lowerCase  If true, the end of the string will be lower cased before comparison, pattern should also be in lower case.

Definition at line 129 of file OgreString.cpp.

References toLowerCase().

String Ogre::String::toLowerCase void   
 

Upper-cases all the characters in the string.

Definition at line 101 of file OgreString.cpp.

Referenced by endsWith(), Ogre::Zip::getAllNamesLike(), Ogre::Quake3Shader::getAlternateName(), Ogre::Codec::getCodec(), Ogre::Skeleton::load(), Ogre::Mesh::load(), Ogre::BspLevel::loadEntities(), Ogre::parseAlphaOpEx(), Ogre::parseAlphaRejection(), Ogre::FontManager::parseAttribute(), Ogre::parseColourOp(), Ogre::parseColourOpEx(), Ogre::parseColourOpFallback(), Ogre::parseColourWrite(), Ogre::parseCullHardware(), Ogre::parseCullSoftware(), Ogre::parseDepthCheck(), Ogre::parseDepthFunc(), Ogre::parseDepthWrite(), Ogre::parseEnvMap(), Ogre::parseFiltering(), Ogre::parseFogging(), Ogre::parseFragmentProgram(), Ogre::parseIteration(), Ogre::parseLighting(), Ogre::ParticleSystemManager::parseNewAffector(), Ogre::ParticleSystemManager::parseNewEmitter(), Ogre::parseParamIndexed(), Ogre::parseParamIndexedAuto(), Ogre::parseSceneBlend(), Ogre::Quake3ShaderManager::parseShaderFile(), Ogre::parseShading(), Ogre::parseTexAddressMode(), Ogre::parseVertexProgram(), Ogre::parseWaveXform(), and startsWith().

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.

Definition at line 124 of file OgreString.cpp.

References Ogre::Real.

String Ogre::String::toUpperCase void   
 

Lower-cases all the characters in the string.

Definition at line 113 of file OgreString.cpp.

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).

Definition at line 34 of file OgreString.cpp.

Referenced by Ogre::DataChunk::getLine(), Ogre::ConfigFile::load(), and Ogre::BspLevel::loadEntities().


Member Data Documentation

String Ogre::String::BLANK = String("") [static]
 

Constant blank string, useful for returning by ref where local does not exist.

Definition at line 32 of file OgreString.cpp.


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

Copyright © 2002-2003 by The OGRE Team
Last modified Wed Jan 21 00:20:46 2004