SoMFString Class Reference
[Fields]

Multiple-value field containing any number of strings. More...

#include <Inventor/fields/SoMFString.h>

Inheritance diagram for SoMFString:
SoMField SoField SoTypedObject SoMFFilePathString

List of all members.

Public Member Functions

virtual SoType getTypeId () const
const SoMFStringoperator= (const SoMFString &f)
 SoMFString ()
virtual ~SoMFString ()
SbStringstartEditing ()
void finishEditing ()
const SbStringoperator[] (int i) const
const SbStringgetValues (int start) const
int find (const SbString &targetValue, SbBool addIfNotFound=FALSE)
void setValues (int start, int num, const SbString *newValues)
void set1Value (int index, const SbString &newValue)
void setValue (const SbString &newValue)
const SbStringoperator= (const SbString &newValue)
int operator== (const SoMFString &f) const
int operator!= (const SoMFString &f) const
virtual void enableDeleteValues ()
virtual void disableDeleteValues ()
virtual SbBool isDeleteValuesEnabled ()
virtual size_t getValueSize () const
void setValuesPointer (int num, const SbString *userData)
void setValuesPointer (int num, SbString *userData)
SoNONUNICODE void setValues (int start, int num, const char *strings[])
SoNONUNICODE void setValue (const char *string)
void setValues (int start, int num, const SO_WCHAR_T *strings[])
void setValue (const SO_WCHAR_T *string)
void deleteText (int fromLine, int fromChar, int toLine, int toChar)

Static Public Member Functions

static SoType getClassTypeId ()

Detailed Description

Multiple-value field containing any number of strings.

A multiple-value field that contains any number of strings.

SoMFStrings are written to file as one or more strings within double quotes. 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:

      [ cowEnizer , "Scene Boy" , "He said, \"I did not!\"" ]
     

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 and 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_".

Data copying:

SoMF fields are a kind of "smart container", automatically expanding as necessary to hold the data provided by the application. This is very convenient, but for large blocks of data it may be desireable to avoid making a copy of the application data. The setValuesPointer() methods allow Open Inventor to directly use an array of values supplied by the application. The application data is not copied. Please see SoMFVec3f for more information and example code.

Constructor & Destructor Documentation

SoMFString::SoMFString (  ) 

Default constructor.

virtual SoMFString::~SoMFString (  )  [virtual]

Destructor.


Member Function Documentation

void SoMFString::deleteText ( int  fromLine,
int  fromChar,
int  toLine,
int  toChar 
)

Convenience function to delete text from consecutive strings.

All text from the given character of one line (fromChar in fromLine) to the given character of another line (toChar in toLine), inclusive, is deleted. Any leftover text on fromLine and toLine is merged into one line.

virtual void SoMFString::disableDeleteValues (  )  [inline, virtual]

Temporary disable value deleting.

virtual void SoMFString::enableDeleteValues (  )  [inline, virtual]

Sets the enableDeleteValues flag.

This flag (if TRUE) allows Open Inventor to destroy the user data array given to setValuesPointer(). This user data array will be managed exactly like internal field data values. Default is FALSE.

int SoMFString::find ( const SbString targetValue,
SbBool  addIfNotFound = FALSE 
)

Finds the given targetValue in the array and returns the index of that value.

in the array. If the value is not found, -1 is returned. If addIfNotFound is set, then targetValue is added to the end of the array (but -1 is still returned).

void SoMFString::finishEditing (  )  [inline]

Indicates that batch edits have finished.

See startEditing().

static SoType SoMFString::getClassTypeId (  )  [static]

Returns the type identifier for this class.

Reimplemented from SoMField.

Reimplemented in SoMFFilePathString.

virtual SoType SoMFString::getTypeId (  )  const [virtual]

Returns the type identifier for this specific instance.

Implements SoTypedObject.

Reimplemented in SoMFFilePathString.

const SbString* SoMFString::getValues ( int  start  )  const [inline]

Returns a pointer into the array of values in the field, starting at index start.

The values are read-only. See the startEditing()/finishEditing() methods for a way of modifying values in place.

virtual size_t SoMFString::getValueSize (  )  const [inline, virtual]

Get size of the value.

Reimplemented from SoField.

virtual SbBool SoMFString::isDeleteValuesEnabled (  )  [inline, virtual]

Returns FALSE if user data array has been given to.

setValuesPointer() and enableDeleteValues() has never been called, and memory for data has not been reallocated. Otherwise, returns TRUE.

int SoMFString::operator!= ( const SoMFString f  )  const [inline]

Returns TRUE if all of the values of this field do not equal.

those of the given f. If the fields are different types TRUE will always be returned.

Reimplemented from SoField.

const SbString& SoMFString::operator= ( const SbString newValue  )  [inline]

Sets the first value in the array to newValue, and deletes.

the second and subsequent values.

Reimplemented in SoMFFilePathString.

const SoMFString& SoMFString::operator= ( const SoMFString f  ) 

Copy from another field of same type.

Reimplemented in SoMFFilePathString.

int SoMFString::operator== ( const SoMFString f  )  const

Returns TRUE if all of the values of this field equal those of.

the given f. If the fields are different types FALSE will always be returned.

Reimplemented from SoField.

const SbString& SoMFString::operator[] ( int  i  )  const [inline]

Returns the i'th value of the field.

Indexing past the end of the field (passing in i greater than getNum()) will return garbage.

void SoMFString::set1Value ( int  index,
const SbString newValue 
)

Sets the index'th value in the array to newValue.

The array will be automatically expanded, if necessary.

void SoMFString::setValue ( const SO_WCHAR_T *  string  ) 

Deletes all values currently in this field and sets this field to contain only the given string.

SoNONUNICODE void SoMFString::setValue ( const char *  string  ) 

Deletes all values currently in this field and sets this field to contain only the given string.

Non Unicode List:
This function should not be used in a Unicode application.
void SoMFString::setValue ( const SbString newValue  ) 

Sets the first value in the array to newValue, and deletes.

the second and subsequent values.

void SoMFString::setValues ( int  start,
int  num,
const SO_WCHAR_T *  strings[] 
)

Sets num values, starting at index start , to the strings in the given character arrays.

SoNONUNICODE void SoMFString::setValues ( int  start,
int  num,
const char *  strings[] 
)

Sets num values, starting at index start , to the strings in the given character arrays.

Non Unicode List:
This function should not be used in a Unicode application.
void SoMFString::setValues ( int  start,
int  num,
const SbString newValues 
)

Sets num values starting at index start to the values.

in newValues. The array will automatically be made larger to accommodate the new values, if necessary.

void SoMFString::setValuesPointer ( int  num,
SbString userData 
)
void SoMFString::setValuesPointer ( int  num,
const SbString userData 
)

Sets the field to contain the num values stored in userData array.

This array will not be copied into the field: it will be directly used by the field. If num and userData are not correctly specified, the results are undefined (and probably undesirable). param num is the number of values that userData contains and must be a positive integer. param userData is an array allocated by malloc or realloc and can be deallocated by free (no constructor or destructor is called). userData must not be NULL. Its size must be at least num*sizeof(valueType).

SbString* SoMFString::startEditing (  )  [inline]

Returns a pointer to the internally maintained array that can be modified.

The values in the array may be changed, but values cannot be added or removed. It is illegal to call any other editing methods between startEditing() and finishEditing() (e.g. set1Value(), setValue(), etc.). Fields, engines or sensors connected to this field and sensors are not notified that this field has changed until finishEditing() is called. Calling finishEditing() always sets the isDefault() flag to FALSE and informs engines and sensors that the field changed, even if none of the values actually were changed.


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

Open Inventor Toolkit reference manual, generated on 15 Mar 2023
Copyright © Thermo Fisher Scientific All rights reserved.
http://www.openinventor.com/