SOMFSTRING(3iv)

πŸ’– SoMFString πŸ’–

ok so first things first, the manual page header calls this SoMFString(3IV) and honestly? she's iconic. a whole field class that's just... strings. as many strings as your heart desires. let's get into it bestie 🫢


🌸 NAME 🌸

SoMFString β€” a multiple-value field containing any number of strings ✨

like. ANY number. zero, one, a thousand. she doesn't judge. she just holds strings. periodt πŸ’…


πŸ¦‹ INHERITS FROM πŸ¦‹

SoField > SoMField > SoMFString

so she's the third generation of field royalty πŸ‘‘ grandparent SoField, parent SoMField, and then our girl. main character energy fr fr.


✨ SYNOPSIS ✨

#include <Inventor/fields/SoMFString.h>

Methods from class SoMFString:

                     setValues(int start, int num, const char *strings[])
                     setValue(const char *string)
 static SoType       getClassTypeId()
 virtual void        getTypeId() const
 const SbString &    operator [](int i) const
 const SbString *    getValues(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)
 const SbString &    operator =(const SbString & newValue)
 void                setValue(const SbString & newValue)
 int                 operator ==(const SoMFString &f) const
 int                 operator !=(const SoMFString &f) const
 SbString *          startEditing()
 void                finishEditing()

Methods from class SoMField:

 int                 getNum() const
 void                setNum(int num)
 virtual void        deleteValues(int start, int num = -1)
 virtual void        insertSpace(int start, int num)
 SbBool              set1(int index, const char *valueString)
 void                get1(int index, SbString &valueString)

Methods from class SoField:

 void                setIgnored(SbBool ignore)
 SbBool              isIgnored() const
 SbBool              isDefault() const
 virtual SbBool      isOfType(SoType type) const
 SbBool              set(const char *valueString)
 void                get(SbString &valueString)
 void                touch()
 SbBool              connectFrom(SoField *fromField)
 SbBool              connectFrom(SoEngineOutput *fromEngine)
 void                disconnect()
 SbBool              isConnected() const
 SbBool              isConnectedFromField() const
 SbBool              getConnectedField(SoField *&writingField) const
 SbBool              isConnectedFromEngine() const
 SbBool              getConnectedEngine(SoEngineOutput *&engineOutput)
                          const
 void                enableConnection(SbBool flag)
 SbBool              isConnectionEnabled() const
 int                 getForwardConnections(SoFieldList &list) const
 SoFieldContainer *  getContainer() const

🌈 DESCRIPTION 🌈

A multiple-value field that contains any number of strings. yes bestie, she's a whole collection πŸŽ€

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!\"" ]

see that \"? that's the escape doing its little job. slay πŸ„


πŸ’… METHODS πŸ’…

  • setValues(int start, int num, const char *strings[]) β€” sets num values, starting at index start, to the strings in the given character arrays. batch update, we love efficiency ✨
  • setValue(const char *string) β€” deletes all values currently in this field and sets this field to contain only the given string. it's giving "out with the old, in with the one" πŸ’€
  • static SoType getClassTypeId()
  • virtual void getTypeId() const

returns the type for this class or a particular object of this class. the classic "who am i" duo πŸͺž

  • const SbString & operator [](int i) const β€” returns the i'th value of the field. Indexing past the end of the field (passing in i greater than getNum()) will return garbage. ok so do not do that β€” she will hand you literal garbage and not even feel bad about it 😭
  • const SbString * getValues(int start) const β€” 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. look but don't touch energy πŸ™ˆ
  • int find(const SbString & targetValue, SbBool addIfNotFound = FALSE) β€” finds the given value 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 will be added to the end of the array (but -1 is still returned). yes she adds it AND still says she didn't find it. chaotic but that's the spec bestie πŸ“
  • void setValues(int start, int num, const SbString *newValues) β€” sets num values starting at index start to the values in newValues. The array will be automatically be made larger to accomodate the new values, if necessary. she grows for you 🫢
  • void set1Value(int index, const SbString & newValue) β€” sets the index'th value in the array to newValue. The array will be automatically expanded, if necessary. one little slot, one little string, no stress πŸ’œ
  • const SbString & operator =(const SbString & newValue)
  • void setValue(const SbString & newValue)

sets the first value in the array to newValue, and deletes the second and subsequent values. brutal. efficient. iconic.

  • int operator ==(const SoMFString &f) const
  • int operator !=(const SoMFString &f) const

returns TRUE if all of the values of this field equal (do not equal) those of the given field. If the fields are different types FALSE will always be returned (even if one field is an SoMFFloat with one value of 1.0 and the other is an SoMFInt with a value of 1, for example). so like, 1.0 and 1 are not the same girl and the type check will call that out πŸŽ€

  • SbString * startEditing()
  • void finishEditing()

startEditing() 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).

ok bestie this one is serious 🚨 you're in edit mode, hands off the other editing methods. no adding, no removing. just vibes and in-place changes.

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. so she announces "i changed!!" even when nothing changed. we've all been there πŸ˜­πŸ’…


and that's the whole page!! πŸ¦‹ thanks for reading my little field manifesto.

sign-off time: this manual page was <purple>SoMFString(3IV)()</purple> β€” that's the source/version tag and the date slot, both sitting there all empty and mysterious, so consider this your cute little footer shoutout. byeeee bestie, go hold some strings πŸ’–βœ¨