FBX C++ API Reference
|
#include <fbxfile.h>
Class for interfacing with files, providing a similar interface for files independant of the OS or filesystem.
Public Types | |
enum | EMode { eNone, eReadOnly, eReadWrite, eCreateWriteOnly, eCreateReadWrite, eCreateAppend } |
enum | ESeekPos { eBegin, eCurrent, eEnd } |
Public Member Functions | |
FbxFile () | |
virtual | ~FbxFile () |
virtual bool | Open (const char *pFileName_UTF8, const EMode pMode=eCreateReadWrite, const bool pBinary=true) |
Opens a file on disk using the specified read/write mode. More... | |
virtual bool | Open (FbxStream *pStream, void *pStreamData, const char *pMode) |
Opens a file from a data stream using the specified read/write mode. More... | |
virtual bool | Close () |
Closes a file, freeing its handle. More... | |
virtual void | Seek (const FbxInt64 pOffset, const ESeekPos pSeekPos=eBegin) |
Seek to a specific position in the file, starting from either beginning, current position or end. More... | |
virtual FbxInt64 | Tell () const |
Returns the position at which the file cursor currently is. More... | |
virtual size_t | Read (void *pDstBuf, const size_t pSize) |
Read a part of the file into a buffer. More... | |
virtual char * | ReadString (char *pDstBuf, const size_t pDstSize, bool pStopAtFirstWhiteSpace=false) |
Read a part of the file as a string into a buffer. More... | |
virtual size_t | Write (const void *pSrcBuf, const size_t pSize) |
Write a buffer to an opened file. More... | |
virtual bool | WriteFormat (const char *pFormat,...) |
Write a formatted string to an opened file. More... | |
virtual bool | Truncate (const FbxInt64 pSize) |
Modify the size of a file. More... | |
virtual bool | EndOfFile () const |
Checks whether the current file cursor position is at the end of file. More... | |
virtual FbxInt64 | GetSize () |
Gets the size of the currently opened file. More... | |
virtual void | GetMemoryFileInfo (void **pMemPtr, size_t pSize) |
Unused function in this default implementation. More... | |
bool | IsOpen () const |
Checks whether the file is currently opened. More... | |
bool | IsStream () const |
Checks whether the file is currently opened with a user-provided streaming interface instead of just the file name. More... | |
const char * | GetFilePathName () const |
Returns the full file path name, as provided when opening it. More... | |
EMode | GetFileMode () const |
Returns the mode with which the file was opened, when calling the Open() method. More... | |
int | GetLastError () |
Returns last encountered error when performing any operation on the file. More... | |
void | ClearError () |
Resets the current error code and the end of file indicator of the opened file. More... | |
Protected Attributes | |
FILE * | mFilePtr |
FbxStream * | mStreamPtr |
bool | mIsOpen |
bool | mIsStream |
EMode | mMode |
FbxString | mFileName |
enum EMode |
Enumerator | |
---|---|
eNone | |
eReadOnly | |
eReadWrite | |
eCreateWriteOnly | |
eCreateReadWrite | |
eCreateAppend |
Definition at line 30 of file fbxfile.h.
enum ESeekPos |
Enumerator | |
---|---|
eBegin | |
eCurrent | |
eEnd |
FbxFile | ( | ) |
|
virtual |
|
virtual |
Opens a file on disk using the specified read/write mode.
pFileName_UTF8 | Filename in UTF8 (compatible with ASCII) |
pMode | Mode in which to open the file, e.g. eReadOnly, eCreateReadWrite, etc. |
pBinary | Whether the file is to be opened in binary or text mode. |
|
virtual |
Opens a file from a data stream using the specified read/write mode.
pStream | Stream instance with which the file will be read/written |
pStreamData | User-defined data to pass as a parameter to the stream's Open() method. |
pMode | Deprecated/Unused. |
|
virtual |
Closes a file, freeing its handle.
Seek to a specific position in the file, starting from either beginning, current position or end.
pOffset | Offset to seek to (advance the file position cursor) starting from pSeekPos |
pSeekPos | Starting position from which to seek to. Beginning, current position or end. |
|
virtual |
Returns the position at which the file cursor currently is.
For example, will be ==0 for beginning and ==FileSize for end.
|
virtual |
Read a part of the file into a buffer.
pDstBuf | Pre-allocated buffer in which to read data |
pSize | Size of the data chunk to be read in bytes |
|
virtual |
Read a part of the file as a string into a buffer.
pDstBuf | Pre-allocated buffer in which to read the string |
pDstSize | Size of the data chunk to be read in characters |
pStopAtFirstWhiteSpace | If true, will stop reading at first white space, otherwise it will stop at the first line feed ( ) |
|
virtual |
Write a buffer to an opened file.
pSrcBuf | Pre-allocated buffer from which to write data |
pSize | Size of the data chunk to be written in bytes |
|
virtual |
Write a formatted string to an opened file.
pFormat | Pre-allocated format buffer from which to write data |
... | Variable number of arguments describing the values in the previous parameter. |
|
virtual |
Modify the size of a file.
Null characters ('\0') are appended if the file is extended. If the file is truncated, all data from the end of the shortened file to the original length of the file is lost. Please note that this function considers the current file cursor as the beginning of the file. It is therefore required to use Seek(0) prior to calling it if we want the size specified by the pSize parameter to be absolute.
pSize | New desired file size |
|
virtual |
Checks whether the current file cursor position is at the end of file.
|
virtual |
Gets the size of the currently opened file.
|
virtual |
Unused function in this default implementation.
Must be implemented by memory files.
pMemPtr | Unused |
pSize | Unused |
bool IsOpen | ( | ) | const |
Checks whether the file is currently opened.
bool IsStream | ( | ) | const |
Checks whether the file is currently opened with a user-provided streaming interface instead of just the file name.
const char* GetFilePathName | ( | ) | const |
Returns the full file path name, as provided when opening it.
EMode GetFileMode | ( | ) | const |
Returns the mode with which the file was opened, when calling the Open() method.
int GetLastError | ( | ) |
Returns last encountered error when performing any operation on the file.
void ClearError | ( | ) |
Resets the current error code and the end of file indicator of the opened file.