.TH "SbString" 3 "Fri Sep 6 2024 15:32:06" "Version 4.0.3" "Coin" \" -*- nroff -*- .ad l .nh .SH NAME SbString \- The \fBSbString\fP class is a string class with convenience functions for string operations\&. .SH SYNOPSIS .br .PP .PP \fR#include \fP .SS "Public Member Functions" .in +1c .ti -1c .RI "\fBSbString\fP (void)" .br .ti -1c .RI "\fBSbString\fP (const char *s)" .br .ti -1c .RI "\fBSbString\fP (const wchar_t *s)" .br .ti -1c .RI "\fBSbString\fP (const char *s, int start, int end)" .br .ti -1c .RI "\fBSbString\fP (const \fBSbString\fP &s)" .br .ti -1c .RI "\fBSbString\fP (const int digits)" .br .ti -1c .RI "\fB~SbString\fP ()" .br .ti -1c .RI "uint32_t \fBhash\fP (void) const" .br .ti -1c .RI "int \fBgetLength\fP (void) const" .br .ti -1c .RI "void \fBmakeEmpty\fP (SbBool freeold=TRUE)" .br .ti -1c .RI "const char * \fBgetString\fP (void) const" .br .ti -1c .RI "\fBSbString\fP \fBgetSubString\fP (int startidx, int endidx=\-1) const" .br .ti -1c .RI "void \fBdeleteSubString\fP (int startidx, int endidx=\-1)" .br .ti -1c .RI "void \fBaddIntString\fP (const int value)" .br .ti -1c .RI "char \fBoperator[]\fP (int index) const" .br .ti -1c .RI "\fBSbString\fP & \fBoperator=\fP (const char *s)" .br .ti -1c .RI "\fBSbString\fP & \fBoperator=\fP (const \fBSbString\fP &s)" .br .ti -1c .RI "\fBSbString\fP & \fBoperator+=\fP (const char *s)" .br .ti -1c .RI "\fBSbString\fP & \fBoperator+=\fP (const \fBSbString\fP &s)" .br .ti -1c .RI "\fBSbString\fP & \fBoperator+=\fP (const char c)" .br .ti -1c .RI "int \fBoperator!\fP (void) const" .br .ti -1c .RI "int \fBcompareSubString\fP (const char *text, int offset=0) const" .br .ti -1c .RI "\fBSbString\fP & \fBsprintf\fP (const char *formatstr,\&.\&.\&.)" .br .ti -1c .RI "\fBSbString\fP & \fBvsprintf\fP (const char *formatstr, va_list args)" .br .ti -1c .RI "void \fBapply\fP (char(*func)(char input))" .br .ti -1c .RI "int \fBfind\fP (const \fBSbString\fP &s) const" .br .ti -1c .RI "SbBool \fBfindAll\fP (const \fBSbString\fP &s, \fBSbIntList\fP &found) const" .br .ti -1c .RI "\fBSbString\fP \fBlower\fP () const" .br .ti -1c .RI "\fBSbString\fP \fBupper\fP () const" .br .ti -1c .RI "void \fBprint\fP (std::FILE *fp) const" .br .in -1c .SS "Static Public Member Functions" .in +1c .ti -1c .RI "static uint32_t \fBhash\fP (const char *s)" .br .in -1c .SH "Detailed Description" .PP The \fBSbString\fP 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\&. .PP This class should also be well suited for use by the application programmer throughout the application using the Coin library\&. .PP \fBSee also\fP .RS 4 \fBSbName\fP .RE .PP .SH "Constructor & Destructor Documentation" .PP .SS "SbString::SbString (void )\fR [inline]\fP" This is the default constructor\&. It initializes the string to be empty\&. .SS "SbString::SbString (const char * str)\fR [inline]\fP" This constructor assigns from the given string\&. .SS "SbString::SbString (const wchar_t * str)\fR [inline]\fP" This constructor converts the given string to UTF-8 and assigns it\&. .SS "SbString::SbString (const char * str, int start, int end)\fR [inline]\fP" This constructor constructs a string from the given substring from \fIstart\fP to \fIend\fP indices inclusive\&. If \fIend\fP is -1, the substring from \fIstart\fP until the end of the string is used\&. .SS "SbString::SbString (const \fBSbString\fP & str)\fR [inline]\fP" This is the copy constructor\&. .SS "SbString::SbString (const int digits)\fR [inline]\fP" Construct an \fBSbString\fP instance containing the \fIdigits\fP of the integer argument\&. .SS "SbString::~SbString ()\fR [inline]\fP" The destructor\&. Deallocates any internal resources used during the lifetime of the \fBSbString\fP instance\&. .SH "Member Function Documentation" .PP .SS "uint32_t SbString::hash (void ) const\fR [inline]\fP" This method returns a reasonable hash value for the current string\&. .PP \fBSee also\fP .RS 4 uint32_t \fBSbString::hash(const char * s)\fP .RE .PP .SS "static uint32_t SbString::hash (const char * s)\fR [inline]\fP, \fR [static]\fP" This static method returns a hash value for the given string\&. .SS "int SbString::getLength (void ) const\fR [inline]\fP" This method returns the length of the string\&. .SS "void SbString::makeEmpty (SbBool freeold = \fRTRUE\fP)\fR [inline]\fP" This method clears the string, making it an empty string ('')\&. If \fIfreeold\fP is \fRTRUE\fP (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\&. .SS "const char * SbString::getString (void ) const\fR [inline]\fP" This method returns the pointer to the string (character array)\&. .SS "\fBSbString\fP SbString::getSubString (int startidx, int endidx = \fR\-1\fP) const\fR [inline]\fP" This method returns a new string which contains a substring defined by the given indices \fIstartidx\fP and \fIendidx\fP (inclusive)\&. .PP If \fIendidx\fP is -1, the substring from \fIstartidx\fP to the end of the string is used\&. .PP This will return a string which is (\fIendidx\fP - \fIstartidx\fP + 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/'\&. .SS "void SbString::deleteSubString (int startidx, int endidx = \fR\-1\fP)\fR [inline]\fP" This method deletes the substring defined by \fIstartidx\fP and \fIendidx\fP (inclusive)\&. If \fIendidx\fP is -1, the substring from \fIstartidx\fP to the end of the string is deleted\&. .SS "void SbString::addIntString (const int value)\fR [inline]\fP" Constructs a string from the given integer (e\&.g\&. intToString(42) creates the string '42'), and adds this to the contents of the string\&. .SS "char SbString::operator[] (int index) const\fR [inline]\fP" Returns character at position \fIindex\fP in the string\&. .PP \fBSee also\fP .RS 4 \fBgetSubString()\fP .RE .PP .SS "\fBSbString\fP & SbString::operator= (const char * str)\fR [inline]\fP" This is the assignment operator\&. .SS "\fBSbString\fP & SbString::operator= (const \fBSbString\fP & str)\fR [inline]\fP" Assign from the given string\&. .SS "\fBSbString\fP & SbString::operator+= (const char * str)\fR [inline]\fP" Concatenate the given string to the end of the current one\&. .SS "\fBSbString\fP & SbString::operator+= (const \fBSbString\fP & str)\fR [inline]\fP" Concatenate the given string to the end of the current one\&. .SS "\fBSbString\fP & SbString::operator+= (const char c)\fR [inline]\fP" Concatenate the given character to the end of the current string\&. .PP \fBNote\fP .RS 4 This member function is not compatible with OpenInventor\&. .RE .PP .SS "int SbString::operator! (void ) const\fR [inline]\fP" This unary operator results in \fRTRUE\fP if the current string is empty ('') or \fRFALSE\fP otherwise\&. .SS "int SbString::compareSubString (const char * text, int offset = \fR0\fP) const\fR [inline]\fP" Uses \fItext\fP as a substring to be compared to the string, starting at offset \fIoffset\fP\&. Return value is 0 upon success, and the failing character comparison difference upon failure\&. .SS "\fBSbString\fP & SbString::sprintf (const char * formatstr, \&.\&.\&.)\fR [inline]\fP" Set \fBSbString\fP instance to the formatted string \fIformatstr\fP, replacing the current contents\&. The control characters within \fIformatstr\fP and the remaining arguments should follow the conventions of the printf() call\&. .PP Note that this function is not part of the original Open Inventor API\&. .SS "\fBSbString\fP & SbString::vsprintf (const char * formatstr, va_list args)\fR [inline]\fP" Set \fBSbString\fP instance to the formatted string \fIformatstr\fP, replacing the current contents\&. The control characters within \fIformatstr\fP and the arguments of the \fIargs\fP argument list should follow the conventions of the printf() call\&. .PP Note that this function is not part of the original Open Inventor API\&. .SS "void SbString::apply (char(* func )(char input))\fR [inline]\fP" Apply the conversion function \fIfunc\fP to every character of the current string\&. \fIfunc\fP is a pointer to a function that takes a character as input and returns a (probably converted) character\&. .PP Note that this function is not part of the original Open Inventor API\&. .SS "int SbString::find (const \fBSbString\fP & strarg) const" If \fIs\fP is found, the method returns the first index where \fIs\fP starts\&. Otherwise it returns -1\&. .PP Note: \fBSbString::find()\fP is a Coin specific extension to the original Open Inventor API\&. .PP \fBSee also\fP .RS 4 \fBSbString::findAll()\fP .RE .PP \fBSince\fP .RS 4 Coin 2\&.0 .RE .PP .SS "SbBool SbString::findAll (const \fBSbString\fP & strarg, \fBSbIntList\fP & found) const" All occurrences of \fIstr\fP is represented in \fIfound\fP as indices to the characters where \fIstr\fP starts\&. If 1 or more is found, \fRTRUE\fP is returned, else \fRFALSE\fP is returned\&. .PP Note: \fBSbString::findAll()\fP is an extension to the original Open Inventor API\&. .PP \fBSee also\fP .RS 4 \fBSbString::find()\fP .RE .PP \fBSince\fP .RS 4 Coin 2\&.0 .RE .PP .SS "\fBSbString\fP SbString::lower () const" Converts all of the characters to lowercase using tolower()\&. .PP \fBSince\fP .RS 4 Coin 3\&.1 .RE .PP .SS "\fBSbString\fP SbString::upper () const" Converts all of the characters to uppercase using toupper()\&. .PP \fBSince\fP .RS 4 Coin 3\&.1 .RE .PP .SS "void SbString::print (std::FILE * fp) const" Dump the state of this object to the \fIfp\fP file stream\&. Only works in debug version of library, method does nothing in an optimized build\&. .SH "Author" .PP Generated automatically by Doxygen for Coin from the source code\&.