Open Inventor Reference
|
Used to read Inventor data files. More...
#include <Inventor/SoInput.h>
Public Member Functions | |
SoInput () | |
Constructor and destructor. | |
~SoInput () | |
Constructor and destructor. | |
void | setFilePointer (FILE *newFP) |
Sets file pointer to read from. Clears the stack of input files if necessary. | |
bool | openFile (const char *fileName, bool okIfNotFound=FALSE) |
Opens named file, sets file pointer to result. | |
bool | pushFile (const char *fileName) |
Opens named file, pushing the resulting file pointer onto the stack. | |
void | closeFile () |
Closes all files on stack opened with openFile() or pushFile(). | |
bool | isValidFile () |
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 * | getCurFile () const |
Returns a pointer to the current file, or NULL if reading from a buffer. | |
const char * | getCurFileName () const |
Returns full name (including directory path) of current file, or NULL if reading from a buffer. | |
void | setBuffer (void *bufPointer, size_t bufSize) |
Sets an in-memory buffer to read from, along with its size. | |
size_t | getNumBytesRead () const |
Returns number of bytes read from buffer. | |
SbString | getHeader () |
Returns the header of the file being read. | |
float | getIVVersion () |
Returns the Inventor file version of the file being read (e.g. | |
bool | isBinary () |
Returns whether current file/buffer being read is binary. | |
bool | get (char &c) |
Reads next character from current file/buffer. | |
bool | getASCIIBuffer (char &c) |
Reads next ASCII character from current buffer. | |
bool | getASCIIFile (char &c) |
Reads next ASCII character from current file. | |
bool | readHex (uint32_t &l) |
Reads next ASCII format hex value from current file/buffer. | |
bool | read (char &c) |
Reads item of particular type from current file pointer/buffer. | |
bool | read (SbString &s) |
bool | read (SbName &n, bool validIdent=FALSE) |
bool | read (int &i) |
bool | read (unsigned int &i) |
bool | read (short &s) |
bool | read (unsigned short &s) |
bool | read (float &f) |
was ... C-api: name=readInt32 but typedef makes this redundant. | |
bool | read (double &d) |
bool | readBinaryArray (unsigned char *c, int length) |
bool | readBinaryArray (int32_t *l, int length) |
bool | readBinaryArray (float *f, int length) |
bool | readBinaryArray (double *d, int length) |
bool | eof () const |
Returns TRUE if current file/buffer is at EOF. | |
SoInput (SoInput *dictIn) | |
Constructor and destructor. | |
void | getLocationString (SbString &string) const |
Fills in passed string to contain description of current location in all open input files. | |
void | putBack (char c) |
Puts a just-read character or string back in input stream/buffer. | |
void | putBack (const char *string) |
void | addReference (const SbName &name, SoBase *base, bool addToGlobalDict=TRUE) |
Adds a reference to dictionary in current file. | |
void | removeReference (const SbName &name) |
Removes a reference to dictionary in current file. | |
SoBase * | findReference (const SbName &name) const |
Looks up a reference, returning the base pointer or NULL. | |
Static Public Member Functions | |
static void | addDirectoryFirst (const char *dirName) |
static void | addDirectoryLast (const char *dirName) |
static void | addEnvDirectoriesFirst (const char *envVarName) |
static void | addEnvDirectoriesLast (const char *envVarName) |
static void | removeDirectory (const char *dirName) |
Removes named directory from the list. | |
static void | clearDirectories () |
Clears the list of directories (including the current directory). | |
static const SbStringList & | getDirectories () |
Returns the list of directories as an SbStringList. | |
static void | init () |
Init function sets up global directory list. | |
Friends | |
class | SoBase |
class | SoDB |
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.
SoInput::SoInput | ( | ) |
SoInput::~SoInput | ( | ) |
SoInput::SoInput | ( | SoInput * | dictIn | ) |
|
static |
|
static |
|
static |
|
static |
This may also add a reference to the global dictionary if addToGlobalDict is TRUE (the default).
|
static |
void SoInput::closeFile | ( | ) |
bool SoInput::eof | ( | ) | const |
bool SoInput::get | ( | char & | c | ) |
Returns FALSE on EOF or error.
bool SoInput::getASCIIBuffer | ( | char & | c | ) |
Returns FALSE on EOF or error.
bool SoInput::getASCIIFile | ( | char & | c | ) |
Returns FALSE on EOF or error.
FILE * SoInput::getCurFile | ( | ) | const |
const char * SoInput::getCurFileName | ( | ) | const |
|
static |
SbString SoInput::getHeader | ( | ) |
|
inline |
2.1). If the file has a header registered through SoDB::registerHeader(), the returned version is the Inventor version registered with the header.
void SoInput::getLocationString | ( | SbString & | string | ) | const |
size_t SoInput::getNumBytesRead | ( | ) | const |
Returns 0 if not reading from a buffer.
|
static |
bool SoInput::isBinary | ( | ) |
bool SoInput::isValidFile | ( | ) |
bool SoInput::openFile | ( | const char * | fileName, |
bool | okIfNotFound = FALSE |
||
) |
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.
bool SoInput::pushFile | ( | const char * | fileName | ) |
Returns FALSE on error.
void SoInput::putBack | ( | char | c | ) |
void SoInput::putBack | ( | const char * | string | ) |
bool SoInput::read | ( | char & | c | ) |
All skip white space before reading and return FALSE on EOF or if item could not be read.
bool SoInput::read | ( | double & | d | ) |
bool SoInput::read | ( | float & | f | ) |
bool read(int32_t &l); was ... C-api: name=readUInt32 but typedef makes this redundant. bool read(uint32_t &l);
bool SoInput::read | ( | int & | i | ) |
bool SoInput::read | ( | SbString & | s | ) |
bool SoInput::read | ( | short & | s | ) |
bool SoInput::read | ( | unsigned int & | i | ) |
bool SoInput::read | ( | unsigned short & | s | ) |
bool SoInput::readBinaryArray | ( | double * | d, |
int | length | ||
) |
bool SoInput::readBinaryArray | ( | float * | f, |
int | length | ||
) |
bool SoInput::readBinaryArray | ( | int32_t * | l, |
int | length | ||
) |
bool SoInput::readBinaryArray | ( | unsigned char * | c, |
int | length | ||
) |
bool SoInput::readHex | ( | uint32_t & | l | ) |
Returns FALSE on EOF or error.
|
static |
void SoInput::removeReference | ( | const SbName & | name | ) |
This may also remove a reference from the global dictionary.
void SoInput::setBuffer | ( | void * | bufPointer, |
size_t | bufSize | ||
) |
void SoInput::setFilePointer | ( | FILE * | newFP | ) |