SoInput(3)

πŸ“¦ version 3.1.3, in fedora 43, fedora 44

πŸ‘‘ SoInput β€” the SoInput(3) page, Library Functions Manual edition

okay bestie, sit down, hydrate, because this is THE file-reading glow-up of the century πŸ’–


πŸ’– NAME

SoInput β€” the class that's basically the abstract vibe of "importing files" in Coin. It's the abstraction layer over file import functionality. Periodt.


✨ 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 (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

SoInput is the abstraction of file import functionality. Like, that IS the job description.

This class handles most of the chores of doing data import in Coin. It slaps a whole layer of abstraction over the read operations so the rest of the Coin code literally cannot tell whether it's reading from a file, from a memory buffer, or from stdin. Iconic behavior honestly 🫢

SoInput also handles checking file validity, plus it keeps track of information about features in the various file formats that are supported.

Example usage, bestie, look how clean:

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 need you to actually hear me: 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 MSWindows DLL, because passing FILE* instances back or forth to DLLs is dangerous and will most likely cause a crash. This is an intrinsic limitation for MSWindows DLLs. Not a skill issue, just a Windows DLL thing πŸ’€

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's 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 filepointer is set, input will be read from stdin. yes girl, it'll just vibe with stdin ✨

SoInput::SoInput (SoInput * dictIn)

A constructor which copies the reference mappings from dictIn upon initialization.

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.

Since

Coin 2.3

void SoInput::addProto (SoProto * proto)

Adds a 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 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.

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.

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 /a fromnode's \fromfield, to tonode's tofield. This makes it possible to defines ROUTEs in files before the fromnode or tonode is parsed.

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 occured 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 it's file pointer is the library user's responsibility. yes, YOUR responsibility, bestie πŸ™ˆ

Important note: do not use this method when the Coin library has been compiled as an MSWindows 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 MSWindows DLLs.

Note that it is not allowed to pass a FILE* to a gzip-compressed file under Mac OS X. nope. not happening. 🚫

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 me about it 😭

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.

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

See also

openFile()


okay that's the whole first part, don't go anywhere πŸ’–

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

okay so this one straight-up removes all files from the internal stack. Any files that got opened by openFile() or pushFile() will also be closed β€” but not the files coming from setFilePointer(), because those are the responsibility of the caller. You opened 'em, you close 'em, bestie. πŸ’…

The way that you usually don't need to call this method explicitly is... it gets triggered automatically by the SoInput destructor to close any open files when the SoInput instance goes out of scope. So it literally just handles it for you. Iconic behaviour, honestly.

See also: setFilePointer(), openFile(), pushFile()


πŸ¦‹ SbBool SoInput::isValidFile (void ) [virtual]

Checks whether the current file is a valid file that the Coin library can actually read. Vibe check on the file, basically. ✨

When you're reading files through stuff like SoDB::readAll(), this is automatically checked for you already, so your application code should usually not need to use this method. It's giving "built-in, you're covered". 🫢


πŸŽ€ SbBool SoInput::isValidBuffer (void ) [virtual]

Returns TRUE if the current text buffer represents a valid iv-file that the Coin library can read. Same vibe check, but for a buffer instead of a file. 🧚

And same as above: when you read files through e.g. SoDB::readAll(), it's automatically checked for you, so application code should usually not need to use this method. Lowkey you can just forget it exists. πŸ™ˆ


πŸ’œ FILE * SoInput::getCurFile (void ) const [virtual]

Returns the file pointer of the file sitting on top of the input stack. But if the "file" is actually a memory buffer, it returns NULL. No file, no pointer. πŸ’€

⚠️ Important note, and I mean it: do not use this method when the Coin library has been compiled as an MSWindows DLL. Passing FILE* instances back or forth to DLLs is dangerous and will most likely cause a crash. This is an intrinsic limitation for MSWindows DLLs. fr fr, don't do it.

See also: getCurFileName()


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

Returns the name of the file on top of the input stack. And NULL will be returned if the toplevel "file" is a memory buffer. Same energy as the last one, just the name instead of the pointer. 🌟

See also: getCurFile()


πŸ“ void SoInput::setBuffer (void * bufpointer, size_t bufsize) [virtual]

Sets up the input stream for reading from a memory buffer. And heads up β€” it closes all open files in the file stack first. Clean slate, periodt. ✨

ngl the type of the first argument of this method would have been better designed as const char *, but this is how the original SGI Inventor API is, and we duplicate the method signature for compatibility reasons. Blame history, not us. 😭


πŸ¦„ void SoInput::setStringArray (const char * strings[])

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

The rationale for this function is that there's 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. Problem: solved. πŸ’…

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 the number of bytes read so far from the current file or memory buffer. But listen β€” you can only use this method while you're reading the file. Once the reading has finished, the current file is popped off the file stack, and a more or less random number gets returned. πŸ’€ Not a vibe.

So if you want the size of a file, you should use the stat() system call (or fseek() and ftell()). iykyk.


🌸 SbString SoInput::getHeader (void ) [virtual]

Returns the header of the current file. That's it, that's the whole thing. Short and sweet. ✨


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

Returns the library version needed to read a file with the given header. And if the header of the current file is not valid, this method returns 0.0f. So like, zero means "nope, invalid header". 🫢


πŸ¦‹ SbBool SoInput::isBinary (void ) [virtual]

Returns TRUE if the current file is in binary format. Simple as that. ⭐


πŸŽ€ SbBool SoInput::get (char & c) [virtual]

Gets the next character in the current stream. Returns FALSE on end of file. 🌈

See also: read()


πŸ’œ SbBool SoInput::getASCIIBuffer (char & c) [virtual]

Returns the next character in the current stream. But 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 included for compatibility reasons. Legacy behaviour, no cap. πŸ™ˆ


πŸ“ SbBool SoInput::getASCIIFile (char & c) [virtual]

Returns the next character in the current stream. And again β€” don't use this method. SoInput is supposed to hide whether or not you're reading from a file or a memory buffer, and it's only included for compatibility reasons. Same energy as the last one. πŸ’…


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

Reads an unsigned integer in hexidecimal format from the current stream. And heads up: no error checking is done to see if it actually is a hex format value. It just trusts you. 😭

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. Returns FALSE if it encounters end of file. ✨


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

Reads the next character in the input stream, returns FALSE if it encounters end of file. And if skip is TRUE, it skips whitespace before reading a character. Your choice, bestie. 🫢


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

Skips whitespace and extracts a string. A string can be placed within quotes, and in that case we return all characters between the quotes β€” including spaces, tabs, newlines, etc. A quote character (i.e. "'') can also be part of the string, but must then be preceded by a \'' character.

A string not contained in quotes is terminated by the first following whitespace character.

Returns FALSE upon encountering end of file (EOF) before the string is fully parsed, or any other error.

⚠️ Note, and this one is important: this function does not return FALSE when encountering 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 encountered, the parsing stops and the read string along with TRUE is returned. 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. Do not skip this step, fr fr. πŸ’€

πŸ’– SbBool SoInput::read (SbName & n, SbBool validIdent = FALSE) [virtual]

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

But like, 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 an SbName field that isn't any of the above β€” and at least when the string might be quoted β€” then you should most likely use SoInput::read(SbString &) instead. Pick the right tool, bestie. πŸ’…

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. Subtle, but lowkey crucial. ✨


πŸŽ€ SbBool SoInput::read (int & i) [virtual]

Read an integer from the current file or buffer position and place it in i. Returns FALSE if we hit end of file prematurely. 🫢


πŸ¦‹ SbBool SoInput::read (unsigned int & i) [virtual]

Read an unsigned integer from the current file or buffer position and place it in i. Returns FALSE if we hit end of file prematurely.


πŸ’œ SbBool SoInput::read (short & s) [virtual]

Read a short integer from the current file or buffer position and place it in s. Returns FALSE if we hit end of file prematurely.


πŸ“ SbBool SoInput::read (unsigned short & s) [virtual]

Read an unsigned short integer from the current file or buffer position and place it in s. Returns FALSE if we hit end of file prematurely.


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

Read a float value from the current file or buffer position and place it in f. Returns FALSE if we hit end of file prematurely.


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

Read a double value from the current file or buffer position and place it in d. Returns FALSE if we hit end of file prematurely.


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

Read a signed byte integer from the current file or buffer position and place it in b. Returns FALSE if we hit end of file prematurely.


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

Read an unsigned byte integer from the current file or buffer position and place it in 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. The end. Literally. πŸ’€


🌟 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. That's the whole description, bestie β€” it's giving "retired, do not use". πŸ™ˆ


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

Places the current line number location and file name in a string which is to be used in the output upon read errors. Basically it's the "where did it break" helper. 🫢


πŸ’– void SoInput::putBack (const char c) [virtual]

Insert character c in the stream at the current position. Little rewind move, very main character energy. πŸ’…

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

okay so imagine you read something and immediately regretted it πŸ’€ β€” this is the fix. It takes str and inserts it back into the stream at the current position. that's it, that's the whole function. tiny, iconic, does its one job. ✨

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

bestie this one adds a name <-> SoBase mapping to our dictionary. so next time somebody yells that name at us, we know exactly which SoBase they mean. it's giving "saving their contact in your phone" energy 🫢

See also: findReference(), removeReference()

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

the opposite of a save β€” it removes a name <-> SoBase mapping from our dictionary. blocked, unfollowed, deleted from the group chat πŸ™ˆ

See also: findReference(), addReference()

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

okay so this is the glow-up where we find an SoBase-derived object that got mapped to name earlier during the import process. the way that it works is lowkey specific tho:

by default, the Coin library only searches through the previously loaded nodes from the same file. but if you set the environment variable COIN_SOINPUT_SEARCH_GLOBAL_DICT to "1", you can force the import process to search for USE-references through all nodes that has been loaded or otherwise instantiated. global mode unlocked fr fr 🌈

See also: addReference(), removeReference()


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

Add a directory to the search list, and this one gets to cut the line β€” the added directory will be searched before any of the other directories in the list. main character placement, no cap πŸ‘‘

See also: addDirectoryLast(), addEnvDirectoriesFirst(), addEnvDirectoriesLast()

removeDirectory(), clearDirectories()

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

same thing but it goes to the back of the line 😭 β€” add a directory to the search list, and it'll be searched after any of the other directories in the list. patient. humble. still valid.

See also: addDirectoryFirst(), addEnvDirectoriesFirst(), addEnvDirectoriesLast()

removeDirectory(), clearDirectories()

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

Add in front of the list all directories in the environment variable envVarName. the separator string should contain all the characters that get interpreted as separators in the environment variable string list. and the default separators? ':', tab, and space. so like, the classics πŸ’…

See also: addDirectoryFirst(), addDirectoryLast()

addEnvDirectoriesLast()

removeDirectory(), clearDirectories()

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

literally the same energy as the last one but add at the end of the list all directories in the environment variable envVarName instead. the separator string holds all the characters interpreted as separators in the env var string list, and the defaults are ':', tab, and space. πŸŽ€

See also: addDirectoryFirst(), addDirectoryLast()

addEnvDirectoriesFirst()

removeDirectory(), clearDirectories()

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

Remove the given directory from the directory search list. okay but here's the tea β€” the search list is scanned from last to first for the directory name, so directories can easily be "stacked" by pushing with addDirectoryLast() and then removed with this method. stack behavior, slay πŸ’…

See also: addDirectoryFirst(), addDirectoryLast()

addEnvDirectoriesFirst(), addEnvDirectoriesLast()

clearDirectories()

void SoInput::clearDirectories (void ) [static]

nukes the whole thing β€” remove all entries from the directory search list. zero survivors. clean slate. fresh start energy ✨

See also: addDirectoryFirst(), addDirectoryLast()

addEnvDirectoriesFirst(), addEnvDirectoriesLast()

removeDirectory()

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

returns the list of directories which'll be searched upon loading Coin and VRML format files. and when does that searching even happen? whenever any external references appears in a file β€” for instance to texture images. so yes bestie, this is why your textures can find themselves πŸ¦‹

void SoInput::init (void ) [static]

Initialize static variables in class. gets called from SoDB::init(). behind-the-scenes setup moment, very demure πŸŽ€

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

finds and returns the part of the given filename that is the directory path name. it's giving "who's your parent folder" 🌸

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

same vibe, different input β€” finds and returns the part of the given s that is the directory path name. overloaded and thriving πŸ’œ

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 name, no entourage ✨

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

yep, the SbString version too β€” finds and returns the part of the given s that is the base name, meaning the filename without the leading directory path. consistency, we love to see it 🫢

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

okay this one's a real one. give it a basename for a file plus an array of directories to search, and it returns the full name of the file found. πŸ”₯

and not just the roots β€” in addition to looking at the root of each directory in directories, all subdirectories is also searched for each item in directories. deep dive behavior, we stan.

if no file matching basename could be found in any of the directories, it returns an empty string. sad but honest 😭

heads up bestie: this method is a Coin extension, not part of the original Inventor API. so like, iykyk πŸ“Œ

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

Pop the topmost file off the stack. returns FALSE if there was no files on the stack to pop. and psst β€” a file is only popped when there is more than one file on the stack. safety first, we don't empty the whole stack here πŸ’…

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. just the top one. the others stay unbothered ✨

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. πŸ™ˆ

return the currently active stream.

scan through the include directories in order and try to find a file with the given basename in any one of them. if the file is found, put the full name with complete path from the current directory of the process into fullname, open the file, and return the file pointer. 🌸

if the file could either not be found or not opened for reading, it returns NULL.

⚠️ Important note: do not use this method when the Coin library has been compiled as an MSWindows 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 MSWindows DLLs. πŸ’€ like seriously, don't.

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

this function has been obsoleted in Coin. retired. legacy. it's giving "they don't make 'em like this anymore" πŸ‘‘

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. πŸŽ€

and if bValidateBufferHeader is TRUE, the returned flag will also be FALSE if the file stream header was not of a supported file format type. so like, extra strict mode ✨

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. simple little vibe check πŸ¦‹

SbBool SoInput::skipWhiteSpace (void ) [protected]

Move the file pointer past whitespace in the current file or buffer. returns FALSE if end of file is encountered. bye bye blank space πŸ‘‹

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

this function has been obsoleted in Coin. another one for the museum πŸ›οΈ

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. rude of the file honestly 😭

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. same energy, unsigned era πŸ’œ

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. double the precision, double the standards πŸ’…

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. fair enough bestie ✨

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

Read decimal base digits from the current input stream into str and returns the number of characters read. count 'em up πŸ”’

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

Read hexadecimal base digits from the current input stream into str and returns the number of characters read. hex edition, very hacker chic πŸ’œ

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

Reads the next character in stream and compares it to charToRead. returns 1 on success, 0 on failure. and failure may come from either end of file, or from the next character in the stream being different than charToRead. strict match, no substitutions πŸ”₯

SbBool SoInput::makeRoomInBuf (size_t nBytes) [protected]

this function has been obsoleted in Coin. gone but not forgotten πŸŽ€


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

Convert 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 gets put at the s pointer. endianness glow-up ✨

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

Convert 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 gets put at the l pointer. 🌸

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

Convert 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 gets put at the f pointer. πŸ¦‹

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

Convert 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 gets put at the d pointer. πŸ’œ

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

Convert a block of short numbers in network format to native format. bulk mode, we love efficiency πŸ’…

See also: convertShort()

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

Convert a block of 32-bit integer numbers in network format to native format. same deal, 32-bit flavor ✨

See also: convertInt32()

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

Convert a block of single-precision floating point numbers in network format to native format. whole squad converted at once πŸ”₯

See also: convertFloat()

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

Convert a block of double-precision floating point numbers in network format to native format. double-precision in bulk, iconic behavior πŸ‘‘

See also: convertDouble()


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

okay so this function is part of the TGS Inventor API, but it is not implemented in Coin. so it's giving "invited to the party but didn't show up" 😭

char * SoInput::URLToFile (char * out_buf, const char * in_buf) [protected]

same situation bestie β€” part of the TGS Inventor API, but not implemented in Coin. we keep it in the docs for the lore 🫢

SbBool SoInput::IsURL (const char * c_strng) β€” protected πŸ”’

SbBool SoInput::IsURL (const char * c_strng)

okay so real talk bestie, this one is part of the TGS Inventor API, but it is not implemented in Coin. like, it's on the guest list, its name is on the poster, and it is absolutely not showing up to the party πŸ’€ no cap. so don't come crying to me when it doesn't do the thing β€” it was never gonna do the thing πŸ™ˆ


void SoInput::setDirectories (SbStringList * dirs) β€” static, protected πŸ”’

void SoInput::setDirectories (SbStringList * dirs)

this is the one that actually handles business πŸ’… it sets up the directory search path directly, using the list of directories sitting in dirs. like you're just telling it where to look, straight up, no games.

🚨 important bestie, listen: "." should be part of that directory list if you want to handle files specified by a relative path. forget the "." and your relative paths are gonna be giving nothing, nowhere, not found 😭 it's giving ghosted fr fr.

πŸŽ€ AUTHOR πŸŽ€

Generated automatically by Doxygen for Coin from the source code. the robots wrote it, I just gave it ✨personality✨ 🫢


and that's a wrap on SoInput(3) bestie πŸ’– this whole thing came to you courtesy of Coin, Version 3.1.3, with the page dated as SoInput(3) β€” slay, iconic, no notes πŸ‘‘ stay hydrated, read your man pages, and may your include paths always resolve on the first try πŸŒˆπŸ§šπŸ’œ

πŸ“¦ where this page comes from