SoInput(3)

πŸ“¦
version 4.0.10 Β· 4 versions
, in fedora 43, fedora 44

πŸ’– SoInput(3) πŸ’–

okay bestie, welcome to SoInput(3) β€” that's the Coin manual, section 3, and it's literally the glow-up guide to file import. no cap, this one's a whole saga, so we're doing it in parts. grab a boba. πŸ§‹βœ¨


✨ NAME ✨

The SoInput class is an abstraction of file import functionality.


✨ SYNOPSIS ✨

#include <Inventor/SoInput.h>

πŸ’… Public Member Functions

SoInput (void)
SoInput (SoInput *dictIn)
SoProto * findProto (const SbName &name)
void addProto (SoProto *proto)
void pushProto (SoProto *proto)
SoProto * getCurrentProto (void) const
void popProto (void)
void addRoute (const SbName &fromnode, const SbName &fromfield, const SbName &tonode, const SbName &tofield)
SbBool checkISReference (SoFieldContainer *container, const SbName &fieldname, SbBool &readok)
virtual ~SoInput (void)
virtual void setFilePointer (FILE *newFP)
virtual SbBool openFile (const char *fileName, SbBool okIfNotFound=FALSE)
virtual SbBool pushFile (const char *fileName)
virtual void closeFile (void)
virtual SbBool isValidFile (void)
virtual SbBool isValidBuffer (void)
virtual FILE * getCurFile (void) const
virtual const char * getCurFileName (void) const
virtual void setBuffer (const void *bufpointer, size_t bufsize)
void setStringArray (const char *strings[])
virtual size_t getNumBytesRead (void) const
virtual SbString getHeader (void)
virtual float getIVVersion (void)
virtual SbBool isBinary (void)
virtual SbBool get (char &c)
virtual SbBool getASCIIBuffer (char &c)
virtual SbBool getASCIIFile (char &c)
virtual SbBool readHex (uint32_t &l)
virtual SbBool read (char &c)
virtual SbBool read (char &c, SbBool skip)
virtual SbBool read (SbString &s)
virtual SbBool read (SbName &n, SbBool validIdent=FALSE)
virtual SbBool read (int &i)
virtual SbBool read (unsigned int &i)
virtual SbBool read (short &s)
virtual SbBool read (unsigned short &s)
virtual SbBool read (float &f)
virtual SbBool read (double &d)
virtual SbBool readByte (int8_t &b)
virtual SbBool readByte (uint8_t &b)
virtual SbBool readBinaryArray (unsigned char *c, int length)
virtual SbBool readBinaryArray (int32_t *l, int length)
virtual SbBool readBinaryArray (float *f, int length)
virtual SbBool readBinaryArray (double *d, int length)
virtual SbBool eof (void) const
SbBool isFileVRML1 (void)
SbBool isFileVRML2 (void)
virtual void resetFilePointer (FILE *fptr)
virtual void getLocationString (SbString &string) const
virtual void putBack (const char c)
virtual void putBack (const char *str)
virtual void addReference (const SbName &name, SoBase *base, SbBool addToGlobalDict=TRUE)
virtual void removeReference (const SbName &name)
virtual SoBase * findReference (const SbName &name) const

🌟 Static Public Member Functions

static void addDirectoryFirst (const char *dirName)
static void addDirectoryLast (const char *dirName)
static void addEnvDirectoriesFirst (const char *envVarName, const char *separator=':  ')
static void addEnvDirectoriesLast (const char *envVarName, const char *separator=':   ')
static void removeDirectory (const char *dirName)
static void clearDirectories (void)
static const SbStringList & getDirectories (void)
static void init (void)
static SbString getPathname (const char *const filename)
static SbString getPathname (const SbString &s)
static SbString getBasename (const char *const filename)
static SbString getBasename (const SbString &s)
static SbString searchForFile (const SbString &basename, const SbStringList &directories, const SbStringList &subdirectories)

πŸ”’ Protected Member Functions

virtual SbBool popFile (void)
void setIVVersion (float version)
FILE * findFile (const char *fileName, SbString &fullName)
void initFile (FILE *newFP, const char *fileName, SbString *fullName, SbBool openedHere, SbDict *refDict=NULL)
SbBool checkHeader (SbBool bValidateBufferHeader=FALSE)
SbBool fromBuffer (void) const
SbBool skipWhiteSpace (void)
size_t freeBytesInBuf (void) const
SbBool readInteger (int32_t &l)
SbBool readUnsignedInteger (uint32_t &l)
SbBool readReal (double &d)
SbBool readUnsignedIntegerString (char *str)
int readDigits (char *str)
int readHexDigits (char *str)
int readChar (char *str, char charToRead)
SbBool makeRoomInBuf (size_t nBytes)
void convertShort (char *from, short *s)
void convertInt32 (char *from, int32_t *l)
void convertFloat (char *from, float *f)
void convertDouble (char *from, double *d)
void convertShortArray (char *from, short *to, int len)
void convertInt32Array (char *from, int32_t *to, int len)
void convertFloatArray (char *from, float *to, int len)
void convertDoubleArray (char *from, double *to, int len)
SbBool isFileURL (const char *url)
char * URLToFile (char *out_buf, const char *in_buf)
SbBool IsURL (const char *c_strng)

πŸ›‘οΈ Static Protected Member Functions

static void setDirectories (SbStringList *dirs)

🌈 Detailed Description 🌈

The SoInput class is an abstraction of file import functionality.

bestie, this class is doing the most so you don't have to. it handles basically all the annoying chores of doing data import in Coin. it throws a layer of abstraction over the read operations so the rest of the Coin code genuinely cannot tell whether it's reading from a file, from a memory buffer, or from stdin. lowkey iconic behaviour. πŸ’…

and it's not just vibes β€” SoInput also takes care of checking file validity, plus it keeps track of info about the features in the various file formats that are supported.

Example usage:

int
main(void)
{
  SoDB::init();

  SoInput in;
  if (in.openFile("fab_model.iv")) {
    SoSeparator * root = SoDB::readAll(&in);
    if (root) {
      // Do stuff with the imported scene graph here
      // ...
      return 0;
    }
  }

  return 1;
}
⚠️ Important note, and I mean it: there are several public and protected methods which make it possible to pass in or get returned FILE* structures in this class. Do not use these methods when the Coin library has been compiled as an Microsoft Windows DLL, as passing FILE* instances back or forth to DLLs is dangerous and will most likely cause a crash. This is an intrinsic limitation for Microsoft Windows DLLs. not me being dramatic, it's literally in the docs. 😭

This class supports one environment variable called COIN_SOINPUT_SEARCH_GLOBAL_DICT. When set to "1", the global dictionary is searched after the current file dictionary when resolving USE keywords. This makes it possible to reference nodes in other files. The reason for introducing this feature is that the SoFile node rereads the file whenever the name field changes. The first time the file is read, it is possible to reference nodes in the parent file, using the USE keyword. But, when the file is reread this is no longer possible, since the reading now starts at the SoFile node, with an empty dictionary.

πŸ‘€ See also

  • SoOutput, SoDB

🍼 Constructor & Destructor Documentation 🍼

πŸ’— SoInput::SoInput (void )

Constructor. If no file pointer is set, input will be read from stdin. so like, if you don't point it anywhere it just starts yapping at your terminal. okay periodt.

πŸ’— SoInput::SoInput (SoInput * dictIn)

A constructor which copies the reference mappings from dictIn upon initialization. it's giving "inherited the whole family's lore." 🫢

πŸ’— SoInput::~SoInput (void ) [virtual]

Destructor. Runs SoInput::closeFile() to close any open files. she cleans up after herself, as she should. ✨


πŸ“š Member Function Documentation πŸ“š

πŸ” SoProto * SoInput::findProto (const SbName & name)

Searches for PROTO named name. This function will only return PROTOs that have been read by the current SoInput instance. so no, it's not gonna dig through the whole global pile for you. πŸ™ˆ

Since

Coin 2.3

βž• void SoInput::addProto (SoProto * proto)

Adds a PROTO proto which should be active in the current scope.

This function is an extension for Coin, and it is not available in the original SGI Open Inventor v2.1 API.

Since

Coin 2.0

πŸ“₯ void SoInput::pushProto (SoProto * proto)

Pushed a PROTO proto onto the PROTO stack. The PROTO stack is used during VRML2 file parsing.

This function is an extension for Coin, and it is not available in the original SGI Open Inventor v2.1 API.

See also

  • popProto()

Since

Coin 2.0

πŸ‘‘ SoProto * SoInput::getCurrentProto (void ) const

Returns the PROTO at the top of the PROTO stack. the main character of the stack, fr.

This function is an extension for Coin, and it is not available in the original SGI Open Inventor v2.1 API.

See also

  • pushProto()

Since

Coin 2.0

πŸ“€ void SoInput::popProto (void )

Pops a PROTO off the PROTO stack. bye bestie πŸ’œ

This function is an extension for Coin, and it is not available in the original SGI Open Inventor v2.1 API.

See also

  • pushProto()

Since

Coin 2.0

πŸ”— void SoInput::addRoute (const SbName & fromnode, const SbName & fromfield, const SbName & tonode, const SbName & tofield)

Adds a ROUTE from fromnode's fromfield, to tonode's tofield. This makes it possible to define ROUTEs in files before the fromnode or tonode is parsed. it's the "we'll figure out the seating chart later" of scene graphs. πŸŽ€

This function is an extension for Coin, and it is not available in the original SGI Open Inventor v2.1 API.

Since

Coin 2.0

πŸ•΅οΈ SbBool SoInput::checkISReference (SoFieldContainer * container, const SbName & fieldname, SbBool & readok)

Checks if the next bytes in in is the IS keyword. Returns TRUE if the IS keyword was found, readok will be set to FALSE if some error occurred while searching for the IS keyword.

This function is an extension for Coin, and it is not available in the original SGI Open Inventor v2.1 API.

Since

Coin 2.0

πŸ—‚οΈ void SoInput::setFilePointer (FILE * newFP) [virtual]

Uses the given file pointer as the input file. The input stack of files will be emptied first. Closing a file passed in by its file pointer is the library user's responsibility. yeah bestie, that one's on you. πŸ’…

⚠️ Important note: do not use this method when the Coin library has been compiled as a Microsoft Windows DLL, as passing FILE* instances back or forth to DLLs is dangerous and will most likely cause a crash. This is an intrinsic limitation for Microsoft Windows DLLs.

Note that it is not allowed to pass a FILE* to a gzip-compressed file under Mac OS X. nope. not a thing. πŸ™…

See also

  • openFile(), closeFile()

πŸ“‚ SbBool SoInput::openFile (const char * fileName, SbBool okIfNotFound = FALSE) [virtual]

Open the given file, and make it the only one in the file stack. If okIfNotFound is FALSE, show a warning message if the file could not be opened.

Returns TRUE if file could be opened for reading, FALSE otherwise.

Note: even if your attempt at opening a file is unsuccessful, the SoInput instance will not default to reading from stdin after a call has been made to this method. so don't come crying to stdin, it's not taking you back. 😭

See also

  • setFilePointer(), pushFile(), closeFile()

πŸ“š SbBool SoInput::pushFile (const char * filename) [virtual]

Push a new file on top of the stack. Further read operations will take place with the new file until it reaches end-of-file, upon when the file will be popped of the stack and we'll continue with the next file in the stack. it's a whole stack of files and honestly? obsessed. πŸ”₯

Returns TRUE if the file could be opened for reading, FALSE otherwise.

See also

  • openFile()

✨ void SoInput::closeFile (void ) [virtual]

Bestie, this one wipes the whole internal stack of files. Any file that got opened by openFile() or pushFile() gets closed too β€” but not the files that came in through setFilePointer(), because those are your responsibility, not ours. πŸ’…

And honestly? You usually don't even need to call this yourself. The SoInput destructor does it for you automatically, closing any open files the moment your SoInput instance goes out of scope. It's giving self-care. 🧚

See also

  • setFilePointer(), openFile(), pushFile()

✨ SbBool SoInput::isValidFile (void ) [virtual]

Checks whether the file you're currently on is a valid file that the Coin library can actually read. Vibe check for files, basically. πŸ¦‹

When you're reading files through something like SoDB::readAll(), this check already happens for you, so your application code usually doesn't need to touch this method. No cap.


✨ SbBool SoInput::isValidBuffer (void ) [virtual]

Returns TRUE if the current text buffer is a valid iv-file that the Coin library can read. ✨

Same deal as above: when reading through e.g. SoDB::readAll(), this gets checked automatically, so application code usually doesn't need to use this method.


✨ FILE * SoInput::getCurFile (void ) const [virtual]

Hands you the file pointer of the file sitting on top of the input stack. If the "file" is actually a memory buffer, you get NULL back instead. πŸ™ˆ

Important note, bestie, please read this one: do not use this method when the Coin library has been compiled as a Microsoft Windows DLL. Passing FILE* instances back and forth to DLLs is dangerous and will most likely cause a crash. It's an intrinsic limitation for Microsoft Windows DLLs. πŸ’€

See also

  • getCurFileName()

✨ const char * SoInput::getCurFileName (void ) const [virtual]

Returns the name of the file on top of the input stack. If the top level "file" is a memory buffer, you get NULL. That's it, that's the whole thing. πŸŽ€

See also

  • getCurFile()

✨ void SoInput::setBuffer (const void * bufpointer, size_t bufsize) [virtual]

Sets up the input stream so it reads from a memory buffer. Heads up: it closes all the open files in the file stack first. 🫢

History moment, iykyk: in the original SGI Inventor API this method was designed as char * bufpointer. Coin followed that right up until Coin 3, and then changed the signature to const starting from Coin 4.0.


✨ void SoInput::setStringArray (const char * strings[])

Sets up the input stream to read from the strings pointed to by a NULL-terminated array of string pointers. It's made for reading memory-inlined scene graphs. 🌸

The rationale here is a compiler portability problem with compiling large, static string buffers. Some compilers have fixed max-lengths on this feature β€” just over 1KB β€” which obviously becomes a problem real fast. This method lets you specify the buffer as an array of smaller string buffers, typically one string for each line in the Inventor file. Slay. πŸ‘‘

SoNode *
makeSceneGraph(void) {
  static const char * inlinescenegraph[] = {
    "#Inventor V2.1 ascii\n",
    "\n",
    "Separator {\n",
    "  Cube {\n",
    "  }\n",
    "}\n",
    NULL
  };
  SoInput in;
  if ( !in.setStringArray(inlinescenegraph) ) return NULL;
  return SoDB::readAll(&in);
}

See also

  • setBuffer()
This function is an extension for Coin, and it is not available in the original SGI Open Inventor v2.1 API.

Since

  • Coin 2.1

✨ size_t SoInput::getNumBytesRead (void ) const [virtual]

Returns how many bytes have been read so far from the current file or memory buffer.

Okay but listen: you can only use this while you're actively reading the file. Once reading has finished, the current file gets popped off the file stack and a more or less random number comes back. 😭 Use the stat() system call to find the size of a file instead (or fseek() and ftell()).

✨ SbBool SoInput::getHeader (void ) [virtual]

Returns the header of the current file. πŸŽ€


✨ float SoInput::getIVVersion (void ) [virtual]

Returns the library version that's needed to read a file with the given header. And if the header of the current file isn't valid? You get 0.0f. ⭐


✨ SbBool SoInput::isBinary (void ) [virtual]

Returns TRUE if the current file is in binary format. Binary girlies rise. πŸ¦‹


✨ SbBool SoInput::get (char & c) [virtual]

Grabs the next character in the current stream and drops it in c. Returns FALSE on end of file.

See also

  • read()

✨ SbBool SoInput::getASCIIBuffer (char & c) [virtual]

Returns the next character in the current stream. But bestie β€” don't use this method. SoInput is supposed to hide whether or not you're reading from a file or a memory buffer. It's only hanging around for compatibility reasons. πŸ’€


✨ SbBool SoInput::getASCIIFile (char & c) [virtual]

Returns the next character in the current stream. Same warning, same energy: don't use this method β€” SoInput is meant to hide whether you're reading from a file or memory. It's included for compatibility reasons only.


✨ SbBool SoInput::readHex (uint32_t & l) [virtual]

Reads an unsigned integer in hexadecimal format from the current stream into l. Note that no error checking is done to see if it actually is a hex format value. It's giving trust issues. πŸ™ˆ

A number in hexadecimal format must have the "0x" prefix.

Returns FALSE if end of file is encountered.


✨ SbBool SoInput::read (char & c) [virtual]

Skips whitespace and reads the next character in the input stream into c. Returns FALSE if it hits end of file.


✨ SbBool SoInput::read (char & c, SbBool skip) [virtual]

Reads the next character in the input stream into c, returns FALSE if it hits end of file. If skip is TRUE, it skips whitespace before reading a character.


✨ SbBool SoInput::read (SbString & s) [virtual]

Skips whitespace and extracts a string into s. A string can be wrapped in quotes, and in that case you get all the characters between the quotes back β€” spaces, tabs, newlines, all of it, everything included. 🌈 A quote character (i.e. ") can also be part of the string, but it has to be preceded by a \' character.

A string that isn't wrapped in quotes gets terminated by the first whitespace character that shows up after it.

Returns FALSE when it encounters end of file (EOF) before the string is fully parsed, or on any other error.

Note, and this one is sneaky: this function does not return FALSE when it encounters all EOFs. When multiple files are on the stack and a string is being parsed (the parser has found one or more valid characters) and EOF is hit, parsing stops and the read string is returned along with TRUE. The next time the read method is called, the stack is popped and a read string from the next file is returned β€” not always returning FALSE between the files (though it might, on certain circumstances). The solution to this is to test for end of file after each successive read operation. Periodt. πŸ’…

✨ SbBool SoInput::read (SbName & n, SbBool validIdent = FALSE) [virtual]

Reads a name from the current stream and puts it in n.

This method should not be used specifically to read all instances of SbName. The semantics of the interface is such that it's designed to handle identifier tokens from the Inventor / VRML file formats β€” i.e. cases where node names, node types and field names are to be read. So if your goal is to read the value of a SbName field that is not any of the above, and at least when the string might be quoted, then you should most likely use SoInput::read(SbString &) instead. πŸŽ€

If validIdent is TRUE the name needs to be a valid identifier (no reserved characters etc), while validIdent equal to FALSE means we'll just read characters for the next word until we hit whitespace or one of the "{"/"}" delimiters.

Returns FALSE on encountering end of file before a full name has been read β€” if validIdent is also FALSE. If validIdent is passed as TRUE, the return value will be FALSE if no valid name was found, but not necessarily on end of file.


✨ SbBool SoInput::read (int & i) [virtual]

Reads an integer from the current file or buffer position into i. Returns FALSE if we hit end of file prematurely. 😭


✨ SbBool SoInput::read (unsigned int & i) [virtual]

Reads an unsigned integer from the current file or buffer position into i. Returns FALSE if we hit end of file prematurely.


✨ SbBool SoInput::read (short & s) [virtual]

Reads a short integer from the current file or buffer position into s. Returns FALSE if we hit end of file prematurely.


✨ SbBool SoInput::read (unsigned short & s) [virtual]

Reads an unsigned short integer from the current file or buffer position into s. Returns FALSE if we hit end of file prematurely.


✨ SbBool SoInput::read (float & f) [virtual]

Reads a float value from the current file or buffer position into f. Returns FALSE if we hit end of file prematurely.


✨ SbBool SoInput::read (double & d) [virtual]

Reads a double value from the current file or buffer position into d. Returns FALSE if we hit end of file prematurely.


✨ SbBool SoInput::readByte (int8_t & b) [virtual]

Reads a signed byte integer from the current file or buffer position into b. Returns FALSE if we hit end of file prematurely.


✨ SbBool SoInput::readByte (uint8_t & b) [virtual]

Reads an unsigned byte integer from the current file or buffer position into b. Returns FALSE if we hit end of file prematurely.


✨ SbBool SoInput::readBinaryArray (unsigned char * c, int length) [virtual]

Reads length characters from the current stream into c. Returns FALSE if end of file is encountered before the given number of bytes could be read. πŸ”₯


✨ SbBool SoInput::readBinaryArray (int32_t * l, int length) [virtual]

Reads length 32-bit integers from the current stream into l. Returns FALSE if end of file is encountered before the given number of integers could be read.


✨ SbBool SoInput::readBinaryArray (float * f, int length) [virtual]

Reads length floats from the current stream into f. Returns FALSE if end of file is encountered before the given number of binary float values could be read.


✨ SbBool SoInput::readBinaryArray (double * d, int length) [virtual]

Reads length double floats from the current stream into d. Returns FALSE if end of file is encountered before the given number of binary double float values could be read.


✨ SbBool SoInput::eof (void ) const [virtual]

Returns TRUE if we're at the end of the current stream, otherwise FALSE. Simple, iconic, no notes. πŸ’–


✨ SbBool SoInput::isFileVRML1 (void )

Returns TRUE if the current file is a VRML V1.0 file. πŸ¦‹

This function is an extension for Coin, and it is not available in the original SGI Open Inventor v2.1 API.

✨ SbBool SoInput::isFileVRML2 (void )

Returns TRUE if the current file is a VRML 2 / VRML97 file. 🌸

This function is an extension for Coin, and it is not available in the original SGI Open Inventor v2.1 API.

✨ void SoInput::resetFilePointer (FILE * fptr) [virtual]

This function has been obsoleted in Coin. Rest in peace, girl. πŸ’€


✨ void SoInput::getLocationString (SbString & str) const [virtual]

Plops the current line number location and file name into a string, which is meant to be used in the output when read errors happen. So when something goes wrong, at least you know where. 🫢


✨ void SoInput::putBack (const char c) [virtual]

Inserts character c into the stream at the current position. Little rewind moment. ⭐

✨ void SoInput::putBack(const char * str) [virtual]

Okay bestie, this one's literally a rewind button πŸ’« β€” it sticks the string str back into the stream right at the current position. Sneaky, cute, done.


✨ void SoInput::addReference(const SbName & name, SoBase * base, SbBool addToGlobalDict = TRUE) [virtual]

Adds a name↔SoBase mapping into our dictionary, so like… you're introducing name to base and now they're mutuals fr fr 🫢.

See also:

  • findReference()
  • removeReference()

✨ void SoInput::removeReference(const SbName & name) [virtual]

Removes a name↔SoBase mapping from our dictionary. Unfollowing, basically πŸ’”.

See also:

  • findReference()
  • addReference()

✨ SoBase * SoInput::findReference(const SbName & name) const [virtual]

Finds a SoBase-derived object that got mapped to name earlier during the import process. It's giving "wait, I know her" πŸ‘€.

By default the Coin library only searches through the nodes it already loaded from the same file. But if you set the environment variable COIN_SOINPUT_SEARCH_GLOBAL_DICT to "1", you force the import process to search for USE-references across all nodes that have been loaded or otherwise instantiated. Big main character energy for your whole scene graph 🌈.

See also:

  • addReference()
  • removeReference()

✨ void SoInput::addDirectoryFirst(const char * dirName) [static]

Adds a directory to the search list, and the added directory gets searched before any of the other directories in the list. Cutting the line, but make it valid πŸ’….

See also:

  • addDirectoryLast(), addEnvDirectoriesFirst(), addEnvDirectoriesLast()
  • removeDirectory(), clearDirectories()

✨ void SoInput::addDirectoryLast(const char * dirName) [static]

Adds a directory to the search list, and this one gets searched after any of the other directories in the list. Patient queen, waiting her turn ✨.

See also:

  • addDirectoryFirst(), addEnvDirectoriesFirst(), addEnvDirectoriesLast()
  • removeDirectory(), clearDirectories()

✨ void SoInput::addEnvDirectoriesFirst(const char * envVarName, const char * separator = ': ') [static]

Adds in front of the list all the directories found in the environment variable envVarName. The separator string should contain all the characters you want interpreted as separators in that environment variable string list. Default separators are ':', tab and space. Yes bestie, tab and space are the default too, no cap.

See also:

  • addDirectoryFirst(), addDirectoryLast()
  • addEnvDirectoriesLast()
  • removeDirectory(), clearDirectories()

✨ void SoInput::addEnvDirectoriesLast(const char * envVarName, const char * separator = ': ') [static]

Adds at the end of the list all the directories found in the environment variable envVarName. The separator string should contain all the characters to be interpreted as separators in the environment variable string list. Default separators are ':', tab and space. Same vibe as her sister method, just queueing at the back πŸŽ€.

See also:

  • addDirectoryFirst(), addDirectoryLast()
  • addEnvDirectoriesFirst()
  • removeDirectory(), clearDirectories()

✨ void SoInput::removeDirectory(const char * dirName) [static]

Removes the given directory from the directory search list. The search list gets scanned from last to first for the directory name, so directories can easily be "stacked" β€” push them with addDirectoryLast() and then remove them with this method. It's a stack, it's a tower, it's iconic πŸ‘‘.

See also:

  • addDirectoryFirst(), addDirectoryLast()
  • addEnvDirectoriesFirst(), addEnvDirectoriesLast()
  • clearDirectories()

✨ void SoInput::clearDirectories(void) [static]

Removes all entries from the directory search list. Total reset, clean slate, fresh start 🧚.

See also:

  • addDirectoryFirst(), addDirectoryLast()
  • addEnvDirectoriesFirst(), addEnvDirectoriesLast()
  • removeDirectory()

✨ const SbStringList & SoInput::getDirectories(void) [static]

Returns the list of directories that get searched when loading Coin and VRML format files. Directory searches happen whenever any external references show up in a file β€” for instance texture images πŸ–ΌοΈ.


✨ void SoInput::init(void) [static]

Initializes the static variables in the class. This one gets called from SoDB::init(). She doesn't get out of bed for anything less πŸ’€.


✨ SbString SoInput::getPathname(const char *const filename) [static]

Finds and returns the part of the given filename that is the directory path name.


✨ SbString SoInput::getPathname(const SbString & s) [static]

Same deal, SbString edition: finds and returns the part of the given filename that is the directory path name.


✨ SbString SoInput::getBasename(const char *const filename) [static]

Finds and returns the part of the given filename that is the base name β€” i.e. the filename without the leading directory path. Just the little guy, no entourage πŸ“.


✨ SbString SoInput::getBasename(const SbString & s) [static]

SbString flavor: finds and returns the part of the given filename that is the base name (i.e. the filename without the leading directory path).


✨ SbString SoInput::searchForFile(const SbString & basename, const SbStringList & directories, const SbStringList & subdirectories) [static]

Give her a basename for a file plus an array of directories to search, and she returns the full name of the file she found πŸ”βœ¨.

In addition to looking at the root of each directory in directories, all subdirectories are also searched for each item in directories.

If no file matching basename could be found in any of the directories, she returns an empty string. Not ghosting you, just… nothing there 😭.

Heads up bestie: this method is a Coin extension, not part of the original Inventor API. So don't go looking for it in the old docs.

✨ SbBool SoInput::popFile(void) [protected], [virtual]

Pops the topmost file off the stack. Returns FALSE if there was no file on the stack to pop. And note: a file is only popped when there is more than one file on the stack β€” she refuses to leave the stack empty, boundaries πŸ’….

See also:

  • pushFile(), openFile(), closeFile()

✨ void SoInput::setIVVersion(float version) [protected]

Changes the file format version number for the stream at the top of the stack. Glow-up via a number ✨.


✨ FILE * SoInput::findFile(const char * basename, SbString & fullname) [protected]

This API member is considered internal to the library, as it is not likely to be of interest to the application programmer. iykyk 🀫

Returns the currently active stream.

She scans through the include directories in order and tries to find a file with the given basename in any one of them. If the file is found, she puts the full name with the complete path from the current directory of the process into fullname, opens the file, and returns the file pointer πŸ”₯.

If the file could either not be found or not opened for reading, she returns NULL. Sad but honest πŸ˜”.

Important note: do not use this method when the Coin library has been compiled as a Microsoft Windows DLL. Passing FILE* instances back or forth to DLLs is dangerous and will most likely cause a crash. This is an intrinsic limitation for Microsoft Windows DLLs. Like, genuinely do not πŸ’€.

✨ void SoInput::initFile(FILE * newFP, const char * fileName, SbString * fullName, SbBool openedHere, SbDict * refDict = NULL) [protected]

This function has been obsoleted in Coin. Rip bozo πŸͺ¦.


✨ SbBool SoInput::checkHeader(SbBool bValidateBufferHeader = FALSE) [protected]

Returns TRUE if the current stream has had its header parsed. If it hasn't, this method will attempt to read the header and returns TRUE if it could be done.

If bValidateBufferHeader is TRUE, the returned flag will also be FALSE if the file stream header was not of a supported file format type. Picky? Yes. Correct? Also yes πŸ’….


✨ SbBool SoInput::fromBuffer(void) const [protected]

Returns TRUE if the current input stream is fetching data from a memory buffer, or FALSE if the input is from a file. Are we buffering or are we filing, bestie 🌸.


✨ SbBool SoInput::skipWhiteSpace(void) [protected]

Moves the file pointer past whitespace in the current file or buffer. Returns FALSE if end of file is encountered. Just skipping the boring bits ✨.


✨ size_t SoInput::freeBytesInBuf(void) const [protected]

This function has been obsoleted in Coin. Gone, but not forgotten πŸͺ¦.


✨ SbBool SoInput::readInteger(int32_t & l) [protected]

Reads a 32-bit signed integer value from the current stream. Returns FALSE if we hit end of file prematurely 😭.


✨ SbBool SoInput::readUnsignedInteger(uint32_t & l) [protected]

Reads a 32-bit unsigned integer value from the current stream. Returns FALSE if we hit end of file prematurely 😭.


✨ SbBool SoInput::readReal(double & d) [protected]

Reads a double-precision floating point value from the current stream. Returns FALSE if we hit end of file prematurely or if no valid string representing a value could be read. She's not accepting just anything πŸŽ€.


✨ SbBool SoInput::readUnsignedIntegerString(char * str) [protected]

Reads a set of bytes from the stream making up an unsigned integer and puts them at str.

Returns FALSE if no string representing an unsigned integer could be read.


✨ int SoInput::readDigits(char * str) [protected]

Reads decimal base digits from the current input stream into str and returns the number of characters read. Counting is self-care, periodt πŸ”’.


✨ int SoInput::readHexDigits(char * str) [protected]

Reads hexadecimal base digits from the current input stream into str and returns the number of characters read. Same energy, base 16 πŸ’œ.


✨ int SoInput::readChar(char * s, char charToRead) [protected]

Reads the next character in the stream and compares it to charToRead. Returns 1 on success, 0 on failure. Failure may come from either end of file, or from the next character in the stream being different than charToRead. Two ways to lose, one way to win 🫢.


✨ void SoInput::makeRoomInBuf(size_t nBytes) [protected]

This function has been obsoleted in Coin. She's retired πŸ’€.


✨ void SoInput::convertShort(char * from, short * s) [protected]

Converts the bytes at from β€” which must be a short integer in network format (i.e. most significant byte first) β€” to a short integer in native format, which is put at the s pointer. Byte-order glow-up ✨.


✨ void SoInput::convertInt32(char * from, int32_t * l) [protected]

Converts the bytes at from β€” which must be a 32-bit integer in network format (i.e. most significant byte first) β€” to a 32-bit integer in native format, which is put at the l pointer.


✨ void SoInput::convertFloat(char * from, float * f) [protected]

Converts the bytes at from β€” which must be a single-precision floating point number in network format β€” to a single-precision floating point number in native format, which is put at the f pointer.


✨ void SoInput::convertDouble(char * from, double * d) [protected]

Converts the bytes at from β€” which must be a double-precision floating point number in network format β€” to a double-precision floating point number in native format, which is put at the d pointer.


✨ void SoInput::convertShortArray(char * from, short * to, int len) [protected]

Converts a block of short numbers in network format to native format. Bulk conversion, she's efficient like that πŸ”₯.

See also:

  • convertShort()

✨ void SoInput::convertInt32Array(char * from, int32_t * to, int len) [protected]

Converts a block of 32-bit integer numbers in network format to native format.

See also:

  • convertInt32()

✨ void SoInput::convertFloatArray(char * from, float * to, int len) [protected]

Converts a block of single-precision floating point numbers in network format to native format.

See also:

  • convertFloat()

✨ void SoInput::convertDoubleArray(char * from, double * to, int len) [protected]

Converts a block of double-precision floating point numbers in network format to native format.

See also:

  • convertDouble()

✨ SbBool SoInput::isFileURL(const char * url) [protected]

This function is part of the TGS Inventor API, but is not implemented in Coin. So like… the vibes are there, the code is not πŸ™ˆ.

  • char * SoInput::URLToFile (char * out_buf, const char * in_buf) [protected] β€” okay so bestie, this one exists in the TGS Inventor API, but Coin literally never implemented it. It's giving "name on the roster, never showed up to class" πŸ’€. Don't call it expecting magic, fr fr.
  • SbBool SoInput::IsURL (const char * c_strng) [protected] β€” same situation, no cap: it's part of the TGS Inventor API, but it is not implemented in Coin. So if you're out here vibe-checking strings hoping for a TRUE/FALSE answer, the answer is... nothing. It's not there πŸ™ˆ.
  • void SoInput::setDirectories (SbStringList * dirs) [static], [protected] β€” this is the one that actually does something, and she's iconic πŸ‘‘. She sets up the directory search path directly using the list of directories you hand her in dirs.
⚠️ Big sisterly heads-up, bestie: . should be part of that directory list if you want files specified by a relative path to be handled. Like, if you forget the dot, don't come crying to me when your relative paths ghost you 😭. The dot is the moment. Put it in the list. Periodt.

🌸 Author 🌸

Generated automatically by Doxygen for Coin from the source code. Not a human, not a poet, just Doxygen doing her little autogenerated thing ✨. Respect the hustle 🫢.


And that's a wrap on SoInput(3), bestie!! πŸŽ€ You just read the whole thing β€” every flag, every default, every protected function that Coin politely pretends exists πŸ’…. This page is from Coin version 4.0.10, dated Thu Jun 25 2026 00:00:00, and honestly? A timestamp of exactly midnight is such main character energy ⭐. Go parse something cute, stay safe with your relative paths, and remember: if it says TGS Inventor API but not implemented in Coin, it's just lore, not a feature πŸŒˆπŸ’–. Byeee πŸ‘‘πŸ¦‹

πŸ“¦ where this page comes from