![]() |
http://www.sim.no http://www.coin3d.org |
The SbString class is a string class with convenience functions for string operations.This is the class used for storing and working with character strings. It automatically takes care of supporting all the "bookkeeping" tasks usually associated with working with character strings, like memory allocation and deallocation etc. More...
#include <Inventor/SbString.h>
Public Member Functions | |
SbString (void) | |
SbString (const char *s) | |
SbString (const char *s, int start, int end) | |
SbString (const SbString &s) | |
SbString (const int digits) | |
~SbString () | |
uint32_t | hash (void) const |
int | getLength (void) const |
void | makeEmpty (SbBool freeold=TRUE) |
const char * | getString (void) const |
SbString | getSubString (int startidx, int endidx=-1) const |
void | deleteSubString (int startidx, int endidx=-1) |
void | addIntString (const int value) |
char | operator[] (int index) const |
SbString & | operator= (const char *s) |
SbString & | operator= (const SbString &s) |
SbString & | operator+= (const char *s) |
SbString & | operator+= (const SbString &s) |
SbString & | operator+= (const char c) |
int | operator! (void) const |
int | compareSubString (const char *text, int offset=0) const |
SbString & | sprintf (const char *formatstr,...) |
SbString & | vsprintf (const char *formatstr, va_list args) |
void | apply (char(*func)(char input)) |
int | find (const SbString &s) const |
SbBool | findAll (const SbString &s, SbIntList &found) const |
Static Public Member Functions | |
static uint32_t | hash (const char *s) |
Friends | |
int | operator== (const SbString &sbstr, const char *s) |
int | operator== (const char *s, const SbString &sbstr) |
int | operator== (const SbString &str1, const SbString &str2) |
int | operator!= (const SbString &sbstr, const char *s) |
int | operator!= (const char *s, const SbString &sbstr) |
int | operator!= (const SbString &str1, const SbString &str2) |
The SbString class is a string class with convenience functions for string operations.
This is the class used for storing and working with character strings. It automatically takes care of supporting all the "bookkeeping" tasks usually associated with working with character strings, like memory allocation and deallocation etc.
This class should also be well suited for use by the application programmer throughout the application using the Coin library.
SbString::SbString | ( | void | ) | [inline] |
This is the default constructor. It initializes the string to be empty.
SbString::SbString | ( | const char * | str | ) | [inline] |
This constructor assigns from the given string.
SbString::SbString | ( | const char * | str, |
int | start, | ||
int | end | ||
) | [inline] |
This constructor constructs a string from the given substring from start to end indices inclusive. If end is -1, the substring from start until the end of the string is used.
SbString::SbString | ( | const SbString & | str | ) | [inline] |
This is the copy constructor.
SbString::SbString | ( | const int | digits | ) | [inline] |
Construct an SbString instance containing the digits of the integer argument.
SbString::~SbString | ( | ) | [inline] |
The destructor. Deallocates any internal resources used during the lifetime of the SbString instance.
uint32_t SbString::hash | ( | void | ) | const [inline] |
This method returns a reasonable hash value for the current string.
uint32_t SbString::hash | ( | const char * | s | ) | [inline, static] |
This static method returns a hash value for the given string.
int SbString::getLength | ( | void | ) | const [inline] |
This method returns the length of the string.
Referenced by SoInput::closeFile(), SoTexture2::doAction(), find(), findAll(), SoInput::findFile(), SoDB::getHeaderData(), SoText2::GLRender(), SoOutput::padHeader(), SoInput::popFile(), SoInput::read(), SoInteractionKit::readDefaultParts(), SbImage::readFile(), SoTextureCubeMap::readInstance(), SoFile::readNamedFile(), SoDB::registerHeader(), SoInput::searchForFile(), SoOutput::write(), and SoBase::writeHeader().
void SbString::makeEmpty | ( | SbBool | freeold = TRUE | ) | [inline] |
This method clears the string, making it an empty string (""). If freeold is TRUE
(which is the default), the memory used by the old string is freed. Otherwise, memory will be kept and reused when the string is manipulated later.
Referenced by SoInput::read(), and SoFile::readInstance().
const char * SbString::getString | ( | void | ) | const [inline] |
This method returns the pointer to the string (character array).
Referenced by SoInput::checkISReference(), SoInput::closeFile(), SoSwitch::doAction(), SoTransformerDragger::dragStart(), SoTabPlaneDragger::dragStart(), SoHandleBoxDragger::dragStart(), SoInput::findFile(), SoType::fromName(), SoInput::getBasename(), SoGlyph::getGlyph(), SoInput::getPathname(), SoDB::getVersion(), SoOffscreenRenderer::getWriteFiletypeInfo(), SoAudioDevice::init(), SoInput::openFile(), SoInput::popFile(), SoReadError::post(), SbTime::print(), SoInput::pushFile(), SoInput::read(), SoField::read(), SoInteractionKit::readDefaultParts(), SoFieldData::readFieldDescriptions(), SbImage::readFile(), SoTextureCubeMap::readInstance(), SoTexture2::readInstance(), SoImage::readInstance(), SoBumpMap::readInstance(), SoFile::readNamedFile(), SoBase::readRoute(), SoDB::registerHeader(), SbName::SbName(), SoInput::searchForFile(), SoBaseKit::set(), SoHandleBoxDragger::setAllPartsActive(), SoField::setDefault(), SoBase::setName(), SoTransformBoxDragger::setUpConnections(), SoTabBoxDragger::setUpConnections(), SoCenterballDragger::setUpConnections(), SoField::shouldWrite(), SoOutput::write(), SoBase::writeHeader(), and SoOffscreenRenderer::writeToFile().
SbString SbString::getSubString | ( | int | startidx, |
int | endidx = -1 |
||
) | const [inline] |
This method returns a new string which contains a substring defined by the given indices startidx and endidx (inclusive).
If endidx is -1, the substring from startidx to the end of the string is used.
This will return a string which is (endidx - startidx + 1) characters long, i.e. if this string is "foo/bar" and we call by SbString::getSubString(0, 3), the returned string will be "foo/".
Referenced by SoType::fromName(), SoInput::getBasename(), SoDB::getHeaderData(), SoInput::getPathname(), SoOffscreenRenderer::getWriteFiletypeInfo(), SoInput::searchForFile(), and SoBase::writeHeader().
void SbString::deleteSubString | ( | int | startidx, |
int | endidx = -1 |
||
) | [inline] |
This method deletes the substring defined by startidx and endidx (inclusive). If endidx is -1, the substring from startidx to the end of the string is deleted.
Referenced by SoMFString::deleteText().
void SbString::addIntString | ( | const int | value | ) | [inline] |
Constructs a string from the given integer (e.g. intToString(42) creates the string "42"), and adds this to the contents of the string.
Referenced by SbTime::format(), and SoBaseKit::getPartString().
char SbString::operator[] | ( | int | index | ) | const [inline] |
Returns character at position index in the string.
SbString & SbString::operator= | ( | const char * | str | ) | [inline] |
This is the assignment operator.
SbString & SbString::operator+= | ( | const char * | str | ) | [inline] |
Concatenate the given string to the end of the current one.
Concatenate the given string to the end of the current one.
SbString & SbString::operator+= | ( | const char | c | ) | [inline] |
Concatenate the given character to the end of the current string.
int SbString::operator! | ( | void | ) | const [inline] |
This unary operator results in TRUE
if the current string is empty ("") or FALSE
otherwise.
int SbString::compareSubString | ( | const char * | text, |
int | offset = 0 |
||
) | const [inline] |
Uses text as a substring to be compared to the string, starting at offset offset. Return value is 0 upon success, and the failing character comparison difference upon failure.
SbString & SbString::sprintf | ( | const char * | formatstr, |
... | |||
) | [inline] |
Set SbString instance to the formatted string formatstr, replacing the current contents. The control characters within formatstr and the remaining arguments should follow the conventions of the printf() call.
Note that this function is not part of the original Open Inventor API.
Referenced by SoTransformerDragger::dragStart(), SoTabPlaneDragger::dragStart(), SoHandleBoxDragger::dragStart(), SoInput::findFile(), SoType::fromName(), SoInput::getLocationString(), SoWWWAnchor::handleEvent(), SoField::read(), SoFieldData::readFieldDescriptions(), SoInput::searchForFile(), SoHandleBoxDragger::setAllPartsActive(), SoTransformBoxDragger::setUpConnections(), SoTabBoxDragger::setUpConnections(), SoCenterballDragger::setUpConnections(), SoOutput::write(), and SoBase::writeHeader().
SbString & SbString::vsprintf | ( | const char * | formatstr, |
va_list | args | ||
) | [inline] |
Set SbString instance to the formatted string formatstr, replacing the current contents. The control characters within formatstr and the arguments of the args argument list should follow the conventions of the printf() call.
Note that this function is not part of the original Open Inventor API.
Referenced by SoReadError::post().
int SbString::find | ( | const SbString & | strarg | ) | const |
If s is found, the method returns the first index where s starts. Otherwise it returns -1.
Note: SbString::find() is a Coin specific extension to the original Open Inventor API.
References getLength(), and operator[]().
All occurences of str is represented in found as indices to the characters where str starts. If 1 or more is found, TRUE
is returned, else FALSE
is returned.
Note: SbString::findAll() is an extension to the original Open Inventor API.
References SbIntList::append(), SbPList::getLength(), getLength(), operator[](), and SbPList::truncate().
int operator== | ( | const SbString & | str, |
const char * | s | ||
) | [friend] |
Equality operator. Check if the strings have the same contents.
int operator== | ( | const char * | s, |
const SbString & | str | ||
) | [friend] |
Equality operator. Check if the strings have the same contents.
Equality operator. Check if the strings have the same contents.
int operator!= | ( | const SbString & | str, |
const char * | s | ||
) | [friend] |
Inequality operator.
int operator!= | ( | const char * | s, |
const SbString & | str | ||
) | [friend] |
Inequality operator.
Copyright © 1998-2007 by Systems in Motion AS. All rights reserved.
Generated on Mon Feb 28 2011 10:12:01 for Coin by Doxygen. 1.7.3