Field containing a string. More...
#include <Inventor/fields/SoSFString.h>
Public Member Functions | |
virtual SoType | getTypeId () const |
const SoSFString & | operator= (const SoSFString &f) |
SoSFString () | |
virtual | ~SoSFString () |
const SbString & | getValue () const |
void | setValue (const SbString &newValue) |
const SbString & | operator= (const SbString &newValue) |
int | operator== (const SoSFString &f) const |
int | operator!= (const SoSFString &f) const |
virtual size_t | getValueSize () const |
SoNONUNICODE void | setValue (const char *string) |
void | setValue (const SO_WCHAR_T *string) |
Static Public Member Functions | |
static SoType | getClassTypeId () |
Field containing a string.
A field containing an string (sequence of characters).
SoSFStrings are written to file as a sequence of ASCII characters in double quotes (optional if the string doesn't contain any whitespace). Any characters (including newlines) may appear within the quotes. To include a double quote character within the string, precede it with a backslash. For example:
Testing "One, Two, Three" "He said, \"Immel did it!\""
are all valid strings.
Unicode Support
Unicode is an industry standard for encoding text of all forms and languages for use by computers. Open Inventor supports Unicode encoding, which allows internationalization of text in a standard cross-platform fashion.
String as well as classes like SoSFString support the wchar_t type which is used for Unicode strings, and all of the text nodes are able to render Unicode strings.
SbString includes methods for construction of Unicode strings, string operators (=, += ,== ,!=, <, >, <=, >=), as well as a query method (SbString::isUnicode()).
To be able to display a particular Unicode character, the selected font must have a character for that Unicode value. Many fonts do not contain a complete set of Unicode characters. However, the shareware Unicode font file "Code2000" seems to work well.
Note that Unicode characters are not directly supported in Open Inventor files. Unicode strings are written as if the bytes in the string were a string of 8-bit characters. The string will be prefixed by "MCS_U_".
SoSFString::SoSFString | ( | ) |
Default constructor.
virtual SoSFString::~SoSFString | ( | ) | [virtual] |
Destructor.
static SoType SoSFString::getClassTypeId | ( | ) | [static] |
Returns the type identifier for this class.
Reimplemented from SoSField.
Reimplemented in SoSFFilePathString.
virtual SoType SoSFString::getTypeId | ( | ) | const [virtual] |
Returns the type identifier for this specific instance.
Implements SoTypedObject.
Reimplemented in SoSFFilePathString.
const SbString& SoSFString::getValue | ( | ) | const [inline] |
Returns this field's value.
virtual size_t SoSFString::getValueSize | ( | ) | const [inline, virtual] |
Get size of the value.
Reimplemented from SoField.
int SoSFString::operator!= | ( | const SoSFString & | f | ) | const [inline] |
Returns FALSE if otherField is of the same type and has the same value as this field.
Reimplemented from SoField.
Sets this field to newValue.
Reimplemented in SoSFFilePathString.
const SoSFString& SoSFString::operator= | ( | const SoSFString & | f | ) |
Copy from another field of same type.
Reimplemented in SoSFFilePathString.
int SoSFString::operator== | ( | const SoSFString & | f | ) | const |
Returns TRUE if otherField is of the same type and has the same value as this field.
Reimplemented from SoField.
void SoSFString::setValue | ( | const SO_WCHAR_T * | string | ) |
Convenience method to set the field's value given a character array.
SoNONUNICODE void SoSFString::setValue | ( | const char * | string | ) |
Convenience method to set the field's value given a character array.
void SoSFString::setValue | ( | const SbString & | newValue | ) |
Sets this field to newValue.