SoInput(3IV)NAMESoInput (SoIn) - used to read Inventor data files
INHERITS FROMSoInputSYNOPSIS
#include <Inventor_c/SoInput.h>
typedef SoInput SoIn
Functions from class SoInput:
SoInput * SoInCreate()
void SoInDelete(SoIn *this)
void SoInAddDirFirst(const char *dirName)
void SoInAddDirLast(const char *dirName)
void SoInAddEnvDirsFirst(const char *envVarName)
void SoInAddEnvDirsLast(const char *envVarName)
void SoInRemoveDir(const char *dirName)
void SoInClearDirs()
const SbStringList * SoInGetDirs()
void SoInSetFilePtr(SoIn *this, FILE *newFP)
SbBool SoInOpenFile(SoIn *this, const char *fileName,
SbBool okIfNotFound = FALSE)
SbBool SoInPushFile(SoIn *this, const char *fileName)
SoInCloseFile(SoIn *this)
SbBool SoInIsValidFile(SoIn *this)
FILE * SoInGetCurFile(const SoIn *this)
const char * SoInGetCurFileName(const SoIn *this)
void SoInSetBuf(SoIn *this, void *bufPointer, size_t
bufSize)
SbString SoInGetHeader(SoIn *this)
float SoInGetIVVersion(SoIn *this)
DESCRIPTION
This class is used by the SoDB reading routines when reading Inventor
data files. It supports both ASCII (default) and binary Inventor formats.
Users can also register additional valid file headers. When reading,
SoInput skips over Inventor comments (from '#' to end of line) and can
stack input files. When EOF is reached, the stack is popped. This class
can also be used to read from a buffer in memory.
FUNCTIONSSoInput * SoInCreate()
void SoInDelete(SoIn *this)
Constructor and destructor. The default SoInput reads from stdin.
The destructor closes any files opened by the SoInput.
void SoInAddDirFirst(const char *dirName)
Page 1SoInput(3IV)
void SoInAddDirLast(const char *dirName)
void SoInAddEnvDirsFirst(const char *envVarName)
void SoInAddEnvDirsLast(const char *envVarName)
The SoInput class maintains a global list of directories that is
searched to find files when opening them. Directories are searched
in order. Each of these routines adds directories to the list,
either at the beginning ("First") or the end ("Last"). The last two
routines add directories named in the value of the given environment
variable. Directories may be separated by colons or whitespace in
the variable's value.
void SoInRemoveDir(const char *dirName)
Removes named directory from the list.
void SoInClearDirs()
Clears the list of directories (including the current directory).
const SbStringList * SoInGetDirs()
Returns the list of directories as an SbStringList.
void SoInSetFilePtr(SoIn *this, FILE *newFP)
Sets file pointer to read from. Clears the stack of input files if
necessary.
SbBool SoInOpenFile(SoIn *this, const char *fileName,
SbBool okIfNotFound = FALSE)
Opens named file, sets file pointer to result. Clears the stack of
input files if necessary. This returns FALSE on error; if
okIfNotFound is FALSE (the default), this prints an error message if
the file could not be found.
SbBool SoInPushFile(SoIn *this, const char *fileName)
Opens named file, pushing the resulting file pointer onto the stack.
Returns FALSE on error.
SoInCloseFile(SoIn *this)
Closes all files on stack opened with SoInOpenFile() or
SoInPushFile().
SbBool SoInIsValidFile(SoIn *this)
Returns TRUE if the currently open file is a valid Inventor file;
that is, it begins with a valid Inventor header, or one that has
been registered with SoDB::registerHeader.
FILE * SoInGetCurFile(const SoIn *this)
Returns a pointer to the current file, or NULL if reading from a
buffer.
const char * SoInGetCurFileName(const SoIn *this)
Returns full name (including directory path) of current file, or
NULL if reading from a buffer.
Page 2SoInput(3IV)
void SoInSetBuf(SoIn *this, void *bufPointer, size_t
bufSize)
Sets an in-memory buffer to read from, along with its size.
SbString SoInGetHeader(SoIn *this)
Returns the header of the file being read.
float SoInGetIVVersion(SoIn *this)
Returns the Inventor file version of the file being read (e.g. 2.1).
If the file has a header registered through SoDB::registerHeader(),
the returned version is the Inventor version registered with the
header.
SEE ALSO
SoDB, SoOutput, SoTranReceiver
Page 3