SoInput(3)
π¦ SoInput(3) β Library Functions Manual π¦
okay so bestie, you're about to read the SoInput(3) page and it's giving file import abstraction realness. no cap. let's go π
β¨ NAME β¨
SoInput β 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) constvoid 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=0)virtual SbBool pushFile (const char *fileName)virtual void closeFile (void)virtual SbBool isValidFile (void)virtual SbBool isValidBuffer (void)virtual FILE * getCurFile (void) constvirtual const char * getCurFileName (void) constvirtual void setBuffer (void *bufpointer, size_t bufsize)void setStringArray (const char *strings[])virtual size_t getNumBytesRead (void) constvirtual 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=0)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 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)SbBool readByte (int8_t &b)SbBool readByte (uint8_t &b)virtual SbBool eof (void) constSbBool isFileVRML1 (void)SbBool isFileVRML2 (void)virtual void resetFilePointer (FILE *fptr)virtual void getLocationString (SbString &string) constvirtual void putBack (const char c)virtual void putBack (const char *str)virtual void addReference (const SbName &name, SoBase *base, SbBool addToGlobalDict=1)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=(SbDict *) NULL)SbBool checkHeader (SbBool bValidateBufferHeader=0)SbBool fromBuffer (void) constSbBool skipWhiteSpace (void)size_t freeBytesInBuf (void) constSbBool 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)
π«Ά Friends π«Ά
class SoDBclass SoInputP
π Detailed Description π
The SoInput class is an abstraction of file import functionality.
This class takes care of most of the chores of doing data import in Coin. It puts a layer of abstraction over the read operations to make it transparent for the rest of the Coin code whether or not we're reading from a file, from a memory buffer or from stdin.
SoInput also takes care of checking file validity, aswell as handling information about features in the various file formats which 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: there are several public and protected methods which makes it possible to pass in or get returnedFILE*structures in this class. Do not use these methods when the Coin library has been compiled as an MSWindows DLL, as passingFILE*instances back or forth to DLLs is dangerous and will most likely cause a crash. This is an intrinsic limitation for MSWindows DLLs.
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.
Referenced by getLocationString(), and SoInput().
SoInput::SoInput (SoInput *dictIn)
A constructor which copies the reference mappings from dictIn upon initialization.
References SoInput().
SoInput::~SoInput (void ) [virtual]
Destructor. Runs SoInput::closeFile() to close any open files.
References closeFile(), SbPList::getLength(), and SbPList::truncate().
π 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
Referenced by SoFieldData::read().
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
Referenced by addReference(), checkISReference(), findReference(), SoBase::readRoute(), and removeReference().
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
Referenced by SoBase::readRoute().
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
References getCurrentProto(), SbString::getString(), SoBase::isOfType(), putBack(), and read().
Referenced by SoField::read(), SoFieldData::read(), and SoFieldData::readFieldDescriptions().
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.
β οΈ 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.
See also: openFile(), closeFile()
References closeFile().
SbBool SoInput::openFile (const char * fileName, SbBool okIfNotFound = 0) [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.
heads up bestie: even if ur file-opening attempt flops, thisSoInputis not gonna quietly fall back to reading fromstdinonce you've called this method. no sneaky default for u π
See also: setFilePointer(), pushFile(), closeFile()
References: addDirectoryFirst(), closeFile(), findFile(), getPathname(), SbString::getString(), and SoReadError::post().
Referenced by: SoInteractionKit::readDefaultParts().
π SbBool SoInput::pushFile (const char * filename) [virtual] π
Pushes a brand-new file on top of the stack, like stacking another pancake on the pile π₯β¨. Every read operation from now on happens with the new file until it hits end-of-file β and the second that happens, the file gets popped off the stack and we go right back to continuing with the next file underneath. it's giving stack energy, lowkey iconic.
Returns TRUE if the file could actually be opened for reading, FALSE otherwise.
See also: openFile()
References: addDirectoryFirst(), closeFile(), findFile(), getPathname(), SbString::getString(), and SoReadError::post().
Referenced by: SoFile::readNamedFile().
π¦ void SoInput::closeFile (void ) [virtual] π¦
Removes all files from the internal stack. Any files opened by openFile() or pushFile() also get closed β but not the ones coming from setFilePointer(), because those are the caller's responsibility, not ours. not me taking care of ur files for u π
You usually don't need to call this yourself, bestie β it gets automatically triggered by the SoInput destructor, which closes any open files when the SoInput instance goes out of scope. it just handles it. periodt.
See also: setFilePointer(), openFile(), pushFile()
References: fromBuffer(), getCurFile(), SbString::getLength(), getPathname(), SbString::getString(), and removeDirectory().
Referenced by: openFile(), pushFile(), setBuffer(), setFilePointer(), and ~SoInput().
πΈ SbBool SoInput::isValidFile (void ) [virtual] πΈ
Checks whether the current file is a valid file that the Coin library can actually read. vibe check for ur file πβ¨
When you're reading files through stuff like SoDB::readAll(), this is checked for you automatically, so app code should usually not need to touch this method at all. it's already handled, bestie.
References: getIVVersion(), and isValidBuffer().
Referenced by: isValidBuffer(), and SoDB::read().
β SbBool SoInput::isValidBuffer (void ) [virtual] β
Returns TRUE if the current text buffer represents a valid iv-file that the Coin library can read.
When you're reading files through e.g. SoDB::readAll(), this is automatically checked for you, so application code should usually not need to use this method.
References: checkHeader(), and isValidFile().
Referenced by: isValidFile().
π₯ FILE * SoInput::getCurFile (void ) const [virtual] π₯
Returns the file pointer of the file on top of the input stack. But if the "file" is actually a memory buffer, it returns NULL.
Important note, fr fr: do not use this method when the Coin library has been compiled as an MSWindows DLL. Passing FILE* instances back and forth to DLLs is dangerous and will most likely cause a crash. This is an intrinsic limitation for MSWindows DLLs. π
See also: getCurFileName()
Referenced by: closeFile().
π const char * SoInput::getCurFileName (void ) const [virtual] π
Returns the name of the file on top of the input stack. NULL gets returned if the toplevel "file" is a memory buffer.
See also: getCurFile()
Referenced by: getLocationString(), and SoFile::readNamedFile().
π void SoInput::setBuffer (void * bufpointer, size_t bufsize) [virtual] π
Sets up the input stream for reading from a memory buffer. Closes all open files in the file stack first. out with the old, in with the new π§
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. we don't make the rules, we just inherit them π
References: closeFile(), and SoDebugError::postWarning().
Referenced by: SoInteractionKit::readDefaultParts(), SoBaseKit::set(), SoBaseKit::set(), SoField::set(), SoFieldContainer::set(), SoMField::set1(), and setStringArray().
π 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. cute, efficient, obsessed.
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, 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
References: setBuffer().
π«Ά size_t SoInput::getNumBytesRead (void ) const [virtual] π«Ά
Returns the number of bytes read so far from the current file or memory buffer. You can only use this method while you're actively reading the file. Once the reading has finished, the current file gets popped off the file stack and a more-or-less random number is returned π (not a vibe). You should use the stat() system call to find the size of a file (or fseek() and ftell()).
Referenced by: SoBaseKit::set().
π SbString SoInput::getHeader (void ) [virtual] π
Returns the header of the current file.
References: checkHeader().
π
float SoInput::getIVVersion (void ) [virtual] π
Returns the library version needed to read a file with the given header. If the header of the current file isn't valid, this method returns 0.0f.
Referenced by: isValidFile(), and SoGroup::readInstance().
π¦ SbBool SoInput::isBinary (void ) [virtual] π¦
Returns TRUE if the current file is in binary format. binary baddie behavior π
References: checkHeader().
Referenced by: getLocationString(), SoField::read(), SoFieldData::read(), SoGroup::readChildren(), SoField::readConnection(), SoFieldData::readFieldDescriptions(), readHex(), and SoGroup::readInstance().
πΈ SbBool SoInput::get (char & c) [virtual] πΈ
Gets the next character in the current stream. Returns FALSE on end of file.
See also: read()
References: checkHeader().
Referenced by: getASCIIBuffer(), getASCIIFile(), and SoFile::readNamedFile().
β SbBool SoInput::getASCIIBuffer (char & c) [virtual] β
Returns the next character in the current stream. 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. (iykyk, legacy stuff π)
References: get().
π SbBool SoInput::getASCIIFile (char & c) [virtual] π
Returns the next character in the current stream. 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.
References: get().
π SbBool SoInput::readHex (uint32_t & l) [virtual] π
Reads an unsigned integer in hexidecimal format from the current stream. Heads up: no error checking is done to see if it actually is a hex format value. it's trusting u, bestie π
A number in hexadecimal format must have the "0x" prefix.
Returns FALSE if end of file is encountered.
References: isBinary(), readChar(), and readHexDigits().
π 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.
References: checkHeader().
Referenced by: checkISReference(), SoBase::read(), SoField::read(), SoFieldData::read(), read(), read(), SoGroup::readChildren(), SoField::readConnection(), SoFieldData::readFieldDescriptions(), SoFile::readNamedFile(), and SoBase::readRoute().
π₯ SbBool SoInput::read (char & c, SbBool skip) [virtual] π₯
Reads the next character in the input stream, returns FALSE if it encounters end of file. If skip is TRUE, it skips whitespace before reading a character.
References: checkHeader().
π§ SbBool SoInput::read (SbString & s) [virtual] π§
Skips whitespace and extracts a string. A string can be placed within quotes, in which case we'll 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's important: This function does not returnFALSEwhen 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 withTRUEis 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 returningFALSEbetween the files (though it might in certain circumstances). The solution to this is to test for end of file after each successive read operation. fr fr, don't get caught out π
References: checkHeader(), isFileVRML2(), SbString::makeEmpty(), SoReadError::post(), and read().
π SbBool SoInput::read (SbName & n, SbBool validIdent = 0) [virtual] π
Read a name from the current stream and place 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. If your goal is to read the value of a 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.
References: checkHeader(), SbString::getLength(), SbString::getString(), SoDebugError::postInfo(), and read().
πΈ 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.
References: readBinaryArray().
β 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.
References: readBinaryArray().
SbBool SoInput::read (short & s)<span style="color:hotpink">[virtual]</span> β grabs a short integer from wherever the cursor is right now (file or buffer) and yeets it intos. If we hit EOF before it's done? ReturnsFALSE, bestie, we ran out of bytes. π- References
readBinaryArray().
- References
SbBool SoInput::read (unsigned short & s)<span style="color:hotpink">[virtual]</span> β same vibe, but unsigned. Reads an unsigned short from the current file/buffer position, drops it ins.FALSEif EOF sneaks up on us prematurely. π- References
readBinaryArray().
- References
SbBool SoInput::read (float & f)<span style="color:hotpink">[virtual]</span> β pulls a float value from the current spot and tucks it intof. EOF too soon =FALSE, no cap.- References
SoReadError::post(), andreadBinaryArray().
- References
SbBool SoInput::read (double & d)<span style="color:hotpink">[virtual]</span> β double the precision, double the slay β¨ reads a double from the current file/buffer position intod.FALSEif the stream ends early.- References
SoReadError::post(), andreadBinaryArray().
- References
SbBool SoInput::readBinaryArray (unsigned char * c, int length)<span style="color:hotpink">[virtual]</span> β readslengthcharacters from the current stream straight intoc. ReturnsFALSEif the end of file shows up before we got all those bytes. Rude of it tbh.- References
checkHeader(). - Referenced by
read(),read(),read(),read(),read(),read(),readByte(), andreadByte().
- References
SbBool SoInput::readBinaryArray (int32_t * l, int length)<span style="color:hotpink">[virtual]</span> β readslength32-bit integers from the current stream intol.FALSEif EOF crashes the party before all the integers could be read. π- References
checkHeader(), andconvertInt32Array().
- References
SbBool SoInput::readBinaryArray (float * f, int length)<span style="color:hotpink">[virtual]</span> β readslengthfloats from the current stream intof.FALSEif end of file hits before all those binary float values made it through.- References
checkHeader(), andconvertFloatArray().
- References
SbBool SoInput::readBinaryArray (double * d, int length)<span style="color:hotpink">[virtual]</span> β readslengthdouble floats from the current stream intod.FALSEif EOF interrupts before the full set of binary double float values could be read. π¦- References
checkHeader(), andconvertDoubleArray().
- References
SbBool SoInput::readByte (int8_t & b)β reads a signed byte integer from the current file or buffer position and places it inb.FALSEif we hit end of file prematurely. π- > Heads up bestie: this function is not virtual in Coin 2.* for ABI reasons.
- References
readBinaryArray().
SbBool SoInput::readByte (uint8_t & b)β reads a signed byte integer from the current file or buffer position and places it inb.FALSEif we hit EOF prematurely.- > Same warning, same energy: this function is not virtual in Coin 2.* for ABI reasons.
- References
readBinaryArray().
SbBool SoInput::eof (void ) const<span style="color:hotpink">[virtual]</span> β returnsTRUEif we're chillin' at the end of the current stream, otherwiseFALSE. Simple. Iconic. π- Referenced by
SoGroup::readChildren(), andSoFile::readNamedFile().
- Referenced by
SbBool SoInput::isFileVRML1 (void )β returnsTRUEif 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.
- References
checkHeader(). - Referenced by
SoNode::readInstance().
SbBool SoInput::isFileVRML2 (void )β returnsTRUEif the current file is a VRML 2 / VRML97 file. β¨- > Also a Coin extension, not available in the original SGI Open Inventor v2.1 API.
- References
checkHeader(). - Referenced by
SoFieldData::read(),read(), andSoNode::readInstance().
void SoInput::resetFilePointer (FILE * fptr)<span style="color:hotpink">[virtual]</span> β this function has been obsoleted in Coin. It's giving legacy, it's giving deprecated. Do not use. πvoid SoInput::getLocationString (SbString & str) const<span style="color:hotpink">[virtual]</span> β puts the current line number location and file name into a string, so it can be used in output when read errors pop off. Basically it tells you where things went wrong. π«Ά- References
getCurFileName(),isBinary(),SoInput(), andSbString::sprintf(). - Referenced by
SoReadError::post().
- References
void SoInput::putBack (const char c)<span style="color:hotpink">[virtual]</span> β inserts charactercback into the stream at the current position. Rewind era. βͺ- Referenced by
checkISReference(),SoField::read(),SoFieldData::read(),SoFieldData::readFieldDescriptions(), andSoFile::readNamedFile().
- Referenced by
void SoInput::putBack (const char * str)<span style="color:hotpink">[virtual]</span> β inserts stringstrback into the stream at the current position.void SoInput::addReference (const SbName & name, SoBase * base, SbBool addToGlobalDict = 1)<span style="color:hotpink">[virtual]</span> β adds aname<->SoBasemapping to our dictionary. π- See also:
findReference(),removeReference() - References
getCurrentProto(), andSbName::getString().
- See also:
void SoInput::removeReference (const SbName & name)<span style="color:hotpink">[virtual]</span> β removes aname<->SoBasemapping from our dictionary. Bye bestie. π- See also:
findReference(),addReference() - References
getCurrentProto(), andSbName::getString().
- See also:
SoBase * SoInput::findReference (const SbName & name) const<span style="color:hotpink">[virtual]</span> β finds anSoBase-derived object that got mapped tonameearlier during the import process. π- 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_DICTto"1", you can force the import process to search forUSE-references through all nodes that have been loaded or otherwise instantiated. Big mood. - See also:
addReference(),removeReference() - References
getCurrentProto(),SoBase::getNamedBase(), andSbName::getString().
- By default, the Coin library only searches through the previously loaded nodes from the same file. But if you set the environment variable
β¨ Directory Search List Things β¨
void SoInput::addDirectoryFirst (const char * dirName)<span style="color:cyan">[static]</span> β adds a directory to the search list. This one gets searched before any of the other directories in the list. First in line, main character energy. π- See also:
addDirectoryLast(),addEnvDirectoriesFirst(),addEnvDirectoriesLast(),removeDirectory(),clearDirectories() - Referenced by
init(),openFile(), andpushFile().
- See also:
void SoInput::addDirectoryLast (const char * dirName)<span style="color:cyan">[static]</span> β adds a directory to the search list. This one gets searched after any of the other directories in the list. Fashionably late. π¦- See also:
addDirectoryFirst(),addEnvDirectoriesFirst(),addEnvDirectoriesLast(),removeDirectory(),clearDirectories()
- See also:
void SoInput::addEnvDirectoriesFirst (const char * envVarName, const char * separator = ': ')<span style="color:cyan">[static]</span> β adds in front of the list all the directories found in the environment variableenvVarName. Theseparatorstring should contain every character to be interpreted as a separator in that environment variable string list. The default separators are':', tab and space. π- See also:
addDirectoryFirst(),addDirectoryLast(),addEnvDirectoriesLast(),removeDirectory(),clearDirectories()
- See also:
void SoInput::addEnvDirectoriesLast (const char * envVarName, const char * separator = ': ')<span style="color:cyan">[static]</span> β adds at the end of the list all the directories found in the environment variableenvVarName. Theseparatorstring should contain every character to be interpreted as a separator in that environment variable string list. The default separators are':', tab and space. β¨- See also:
addDirectoryFirst(),addDirectoryLast(),addEnvDirectoriesFirst(),removeDirectory(),clearDirectories()
- See also:
void SoInput::removeDirectory (const char * dirName)<span style="color:cyan">[static]</span> β 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" by pushing with
addDirectoryLast()and then removed with this method. Stack 'em, pop 'em, periodt. - See also:
addDirectoryFirst(),addDirectoryLast(),addEnvDirectoriesFirst(),addEnvDirectoriesLast(),clearDirectories() - References
SbPList::getLength(),SoDebugError::postWarning(), andSbPList::remove(). - Referenced by
closeFile(), andpopFile().
- The search list gets scanned from last to first for the directory name, so directories can easily be "stacked" by pushing with
void SoInput::clearDirectories (void )<span style="color:cyan">[static]</span> β removes all entries from the directory search list. Total reset, fresh start. π§Ή- See also:
addDirectoryFirst(),addDirectoryLast(),addEnvDirectoriesFirst(),addEnvDirectoriesLast(),removeDirectory()
- See also:
const SbStringList & SoInput::getDirectories (void )<span style="color:cyan">[static]</span> β returns the list of directories that'll be searched when loading Coin and VRML format files. Directory searches happen whenever any external references appear in a file β for instance, to texture images. πΌοΈ- Referenced by
findFile(),SoShaderObject::readInstance(), andSoVRMLImageTexture::readInstance().
- Referenced by
void SoInput::init (void )<span style="color:cyan">[static]</span> β initializes static variables in the class. Called fromSoDB::init().- References
addDirectoryFirst(). - Referenced by
SoDB::init().
- References
SbString SoInput::getPathname (const char *const filename)<span style="color:cyan">[static]</span> β finds and returns the part of the given filename that is the directory path name. π- References
SbString::getSubString(). - Referenced by
closeFile(),getPathname(),openFile(),popFile(), andpushFile().
- References
SbString SoInput::getPathname (const SbString & s)<span style="color:cyan">[static]</span> β finds and returns the part of the given filename that is the directory path name.- References
getPathname(), andSbString::getString().
- References
SbString SoInput::getBasename (const char *const filename)<span style="color:cyan">[static]</span> β finds and returns the part of the given filename that is the base name (i.e. the filename without the leading directory path). π- References
SbString::getSubString(). - Referenced by
getBasename().
- References
SbString SoInput::getBasename (const SbString & s)<span style="color:cyan">[static]</span> β finds and returns the part of the given filename that is the base name (i.e. the filename without the leading directory path).- References
getBasename(), andSbString::getString().
- References
SbString SoInput::searchForFile (const SbString & basename, const SbStringList & directories, const SbStringList & subdirectories)<span style="color:cyan">[static]</span> β given abasenamefor a file and an array ofdirectoriesto search, returns the full name of the file found. π- On top of looking at the root of each directory in
directories, all ofsubdirectoriesis also searched for each item indirectories. - If no file matching
basenamecould be found in any of the directories, it returns an empty string. π - > This method is a Coin extension, not part of the original Inventor API.
- References
SbPList::getLength(),SbString::getLength(),SbString::getString(),SbString::getSubString(), andSbString::sprintf(). - Referenced by
SbImage::searchForFile().
- On top of looking at the root of each directory in
β¨ Protected Members β¨
SbBool SoInput::popFile (void )<span style="color:purple">[protected]</span>, <span style="color:hotpink">[virtual]</span> β pops the topmost file off the stack. ReturnsFALSEif there were no files on the stack to pop. A file is only actually popped when there's more than one file on the stack. π₯- See also:
pushFile(),openFile(),closeFile() - References
SbString::getLength(),getPathname(),SbString::getString(), andremoveDirectory().
- See also:
void SoInput::setIVVersion (float version)<span style="color:purple">[protected]</span> β changes the file format version number for the stream at the top of the stack.FILE * SoInput::findFile (const char * basename, SbString & fullname)<span style="color:purple">[protected]</span> β this API member is considered internal to the library, as it is not likely to be of interest to the application programmer. iykyk π€«- Return the currently active stream.
Okay bestie, last stretch β we're in the protected-member zone now, the backstage area where the real parsing happens. π
Scan through the include directories in order and try to find a file with the given name in any one of them. If the file is found, put the full name with the 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 be opened for reading, return NULL.
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. π No workaround, no vibes, just don't.
References: getDirectories(), SbPList::getLength(), SbString::getLength(), SbString::getString(), SbStringList::insert(), SoDebugError::post(), SoDebugError::postInfo(), and SbString::sprintf().
Referenced by: openFile(), and pushFile().
β¨ void SoInput::initFile (FILE * newFP, const char * fileName, SbString * fullName, SbBool openedHere, SbDict * refDict = (SbDict *) NULL) [protected] β¨
This function has been obsoleted in Coin. π« She's retired, bestie, we don't call her anymore.
β¨ SbBool SoInput::checkHeader (SbBool bValidateBufferHeader = 0) [protected] β¨
Returns TRUE if the current stream has had it's 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. So like, wrong vibe in the header = hard no. π
References: SoDebugError::post().
Referenced by: get(), getHeader(), isBinary(), isFileVRML1(), isFileVRML2(), isValidBuffer(), read(), read(), read(), read(), readBinaryArray(), readBinaryArray(), readBinaryArray(), readBinaryArray(), and skipWhiteSpace().
β¨ 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. Memory-girlie or file-girlie, that's the question. πΈ
Referenced by: closeFile().
β¨ 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. π¦
References: checkHeader(), and skipWhiteSpace().
Referenced by: skipWhiteSpace().
Yeah, she calls herself and gets called by herself β recursion stays winning, no cap.
β¨ size_t SoInput::freeBytesInBuf (void ) const [protected] β¨
This function has been obsoleted in Coin. π
β¨ 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. Two ways to fumble, lowkey tragic. π₯²
β¨ 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] β¨
Read decimal base digits from the current input stream into str and returns the number of characters read. β
β¨ int SoInput::readHexDigits (char * str) [protected] β¨
Read hexadecimal base digits from the current input stream into str and returns the number of characters read. π₯
Referenced by: readHex().
β¨ 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. π
Referenced by: readHex().
β¨ SbBool SoInput::makeRoomInBuf (size_t nBytes) [protected] β¨
This function has been obsoleted in Coin. π«
β¨ 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 is put at the s pointer. π
Referenced by: convertShortArray().
β¨ 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 is put at the l pointer. π
Referenced by: convertInt32Array().
β¨ 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 is put at the f pointer. π
Referenced by: convertFloatArray().
β¨ 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 is put at the d pointer. π¦
Referenced by: convertDoubleArray().
β¨ void SoInput::convertShortArray (char * from, short * to, int len) [protected] β¨
Convert a block of short numbers in network format to native format. Wholesale conversion, we love a bulk order. ποΈ
See also: convertShort()
References: 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.
See also: convertInt32()
References: convertInt32().
Referenced by: readBinaryArray().
β¨ 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.
See also: convertFloat()
References: convertFloat().
Referenced by: readBinaryArray().
β¨ 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.
See also: convertDouble()
References: convertDouble().
Referenced by: readBinaryArray().
β¨ SbBool SoInput::isFileURL (const char * url) [protected] β¨
This function is part of the TGS Inventor API, but is not implemented in Coin. π«
β¨ char * SoInput::URLToFile (char * out_buf, const char * in_buf) [protected] β¨
This function is part of the TGS Inventor API, but is not implemented in Coin. π«
β¨ SbBool SoInput::IsURL (const char * c_strng) [protected] β¨
This function is part of the TGS Inventor API, but is not implemented in Coin. π«
Three TGS Inventor API functions, all sitting there unimplemented in Coin like guests who never showed up to the party. π
β¨ void SoInput::setDirectories (SbStringList * dirs) [static], [protected] β¨
Set up the directory search path directly with the list of directories in dirs. Note that "." should be part of the directory list if you want to handle files specified by a relative path. πβ¨
fr fr, if "." isn't in there, your relative paths are just gonna ghost you. π«Ά
π Author π
Generated automatically by Doxygen for Coin from the source code. Not me writing love letters by hand β the machine did it. π€π
And that's the whole page, bestie!! π₯³ This lil' icon is from Coin Version 2.5.0, dated alongside the SoInput(3) page itself β so if you're reading this in the terminal, congrats, you made it to the very last line. π
β¨ Go parse something cute. π¦πΈ
π¦ where this page comes from
- fedora 43: Coin2-devel 2.5.0-52.fc43 Β· GPL-2.0-only
- fedora 43: Coin2-devel 2.5.0-52.fc43 Β· GPL-2.0-only
- fedora 44: Coin2-devel 2.5.0-54.fc44 Β· GPL-2.0-only
- fedora 44: Coin2-devel 2.5.0-54.fc44 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms