.TH "SbName" 3 "Thu May 29 2014" "Version 4.0.0a" "Coin" \" -*- nroff -*- .ad l .nh .SH NAME SbName \- .PP The \fBSbName\fP class stores strings by reference\&. .PP The class is used by Coin for storing keywords, names and other strings\&. They are stored in a manner where identical strings are guaranteed to map to the same memory address (as returned by the \fBSbName::getString()\fP method)\&. .SH SYNOPSIS .br .PP .PP \fC#include \fP .SS "Public Member Functions" .in +1c .ti -1c .RI "\fBSbName\fP (void)" .br .ti -1c .RI "\fBSbName\fP (const char *namestring)" .br .ti -1c .RI "\fBSbName\fP (const \fBSbString\fP &str)" .br .ti -1c .RI "\fBSbName\fP (const \fBSbName\fP &name)" .br .ti -1c .RI "\fB~SbName\fP ()" .br .ti -1c .RI "const char * \fBgetString\fP (void) const " .br .ti -1c .RI "int \fBgetLength\fP (void) const " .br .ti -1c .RI "int \fBoperator!\fP (void) const " .br .ti -1c .RI "\fBoperator const char *\fP (void) const " .br .in -1c .SS "Static Public Member Functions" .in +1c .ti -1c .RI "static SbBool \fBisIdentStartChar\fP (const char c)" .br .ti -1c .RI "static SbBool \fBisIdentChar\fP (const char c)" .br .ti -1c .RI "static SbBool \fBisBaseNameStartChar\fP (const char c)" .br .ti -1c .RI "static SbBool \fBisBaseNameChar\fP (const char c)" .br .ti -1c .RI "static const \fBSbName\fP & \fBempty\fP (void)" .br .in -1c .SS "Friends" .in +1c .ti -1c .RI "int \fBoperator==\fP (const \fBSbName\fP &lhs, const char *rhs)" .br .ti -1c .RI "int \fBoperator==\fP (const char *lhs, const \fBSbName\fP &rhs)" .br .ti -1c .RI "int \fBoperator==\fP (const \fBSbName\fP &lhs, const \fBSbName\fP &rhs)" .br .ti -1c .RI "int \fBoperator!=\fP (const \fBSbName\fP &lhs, const char *rhs)" .br .ti -1c .RI "int \fBoperator!=\fP (const char *lhs, const \fBSbName\fP &rhs)" .br .ti -1c .RI "int \fBoperator!=\fP (const \fBSbName\fP &lhs, const \fBSbName\fP &rhs)" .br .in -1c .SH "Detailed Description" .PP The \fBSbName\fP class stores strings by reference\&. .PP The class is used by Coin for storing keywords, names and other strings\&. They are stored in a manner where identical strings are guaranteed to map to the same memory address (as returned by the \fBSbName::getString()\fP method)\&. The main advantage of storing identical strings to the same memory address is that it simplifies comparison operations, and particularly when working with string data as keys in other data structures, like e\&.g\&. in hash (dictionary) tables\&. .PP Apart from that, mapping identical strings to the same memory address can also save on memory resources, and provide run-time optimizations\&. String comparisons for \fBSbName\fP objects are very efficient, for instance\&. .PP There is an aspect of using \fBSbName\fP instances that it is important to be aware of: since strings are stored \fIpermanently\fP, using \fBSbName\fP instances in code where there is continually changing strings or the continual addition of new unique strings will in the end swamp memory resources\&. So where possible, use \fBSbString\fP instances instead\&. .PP \fBSee also:\fP .RS 4 \fBSbString\fP .RE .PP .SH "Constructor & Destructor Documentation" .PP .SS "SbName::SbName (void)" This is the default constructor\&. .SS "SbName::SbName (const char *namestring)" Constructor\&. Adds the \fInamestring\fP string to the name table\&. .SS "SbName::SbName (const \fBSbString\fP &str)" Constructor\&. Adds \fIstr\fP to the name table\&. .SS "SbName::SbName (const \fBSbName\fP &name)" Copy constructor\&. .SS "SbName::~SbName ()" The destructor\&. .SH "Member Function Documentation" .PP .SS "const char * SbName::getString (void) const" This method returns pointer to character array for the name\&. .PP The returned memory pointer for the character string is guaranteed to be valid for the remaining life time of the process, even after all \fBSbName\fP instances referencing the string has been destructed\&. .SS "int SbName::getLength (void) const" This method returns the number of characters in the name\&. .SS "int SbName::operator! (void) const" This unary operator results in \fCFALSE\fP if the \fBSbName\fP object is non-empty and \fCTRUE\fP if the \fBSbName\fP object is empty\&. An empty name contains a null-length string\&. .SS "SbName::operator const char * (void) const" This operator returns a pointer to the character array for the name string\&. It is intended for implicit use\&. Use \fBSbName::getString()\fP explicitly instead of this operator - it might be removed later\&. .PP \fBSee also:\fP .RS 4 const char * SbName::getString(void) .RE .PP .SS "SbBool SbName::isIdentStartChar (const charc)\fC [static]\fP" This method checks if the \fIc\fP character is a valid identifier start character for a name\&. .PP \fBSee also:\fP .RS 4 SbBool \fBSbName::isIdentChar(const char c)\fP .RE .PP .SS "SbBool SbName::isIdentChar (const charc)\fC [static]\fP" This method checks if the \fIc\fP character is a valid character for a name\&. .PP \fBSee also:\fP .RS 4 SbBool \fBSbName::isIdentStartChar(const char c)\fP .RE .PP .SS "SbBool SbName::isBaseNameStartChar (const charc)\fC [static]\fP" Returns \fCTRUE\fP if the given character is valid for use as the first character of a name for an object derived from a class inheriting \fBSoBase\fP\&. .PP \fBSoBase\fP derived objects needs to be named in a manner which will not clash with the special characters reserved as tokens in the syntax rules of Open Inventor and VRML files\&. .PP Legal characters for the first character of an \fBSoBase\fP object name is underscore ('_') and any uppercase and lowercase alphabetic character from the ASCII character set (i\&.e\&. A-Z and a-z)\&. .PP This method is not part of the original Open Inventor API\&. .PP \fBSee also:\fP .RS 4 \fBisBaseNameChar()\fP .RE .PP .SS "SbBool SbName::isBaseNameChar (const charc)\fC [static]\fP" Returns \fCTRUE\fP if the given character is valid for use in naming object instances of classes derived from \fBSoBase\fP\&. .PP \fBSoBase\fP derived objects needs to be named in a manner which will not clash with the special characters reserved as tokens in the syntax rules of Open Inventor and VRML files\&. .PP Legal characters to use for an \fBSoBase\fP object name is any character from the ASCII character set from and including character 33 (hex 0x21) to and including 126 (hex 0x7e), \fIexcept\fP single and double apostrophes, the plus sign and punctuation, backslash and the curly braces\&. .PP This method is not part of the original Open Inventor API\&. .PP \fBSee also:\fP .RS 4 \fBisBaseNameStartChar()\fP .RE .PP .SS "const \fBSbName\fP & SbName::empty (void)\fC [static]\fP" Returns an empty-string \fBSbName\fP instance\&. .PP \fBSince:\fP .RS 4 Coin 3\&.0 .RE .PP .SH "Friends And Related Function Documentation" .PP .SS "int operator== (const \fBSbName\fP &lhs, const char *rhs)\fC [friend]\fP" This operator checks for equality and returns \fCTRUE\fP if so, and \fCFALSE\fP otherwise\&. .SS "int operator== (const char *lhs, const \fBSbName\fP &rhs)\fC [friend]\fP" This operator checks for equality and returns \fCTRUE\fP if so, and \fCFALSE\fP otherwise\&. .SS "int operator== (const \fBSbName\fP &lhs, const \fBSbName\fP &rhs)\fC [friend]\fP" This operator checks for equality and returns \fCTRUE\fP if so, and \fCFALSE\fP otherwise\&. .SS "int \fBoperator!\fP= (const \fBSbName\fP &lhs, const char *rhs)\fC [friend]\fP" This operator checks for inequality and returns \fCTRUE\fP if so, and \fCFALSE\fP if the names are equal\&. .SS "int \fBoperator!\fP= (const char *lhs, const \fBSbName\fP &rhs)\fC [friend]\fP" This operator checks for inequality and returns \fCTRUE\fP if so, and \fCFALSE\fP if the names are equal\&. .SS "int \fBoperator!\fP= (const \fBSbName\fP &lhs, const \fBSbName\fP &rhs)\fC [friend]\fP" This operator checks for inequality and returns \fCTRUE\fP if so, and \fCFALSE\fP if the names are equal\&. .SH "Author" .PP Generated automatically by Doxygen for Coin from the source code\&.