This reference page is linked to from the following overview topics: FBX SDK 2013.
#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. |
|
| virtual bool | Open (FbxStream *pStream, void *pStreamData, const char *pMode) |
| Opens a file from a data stream using the
specified read/write mode. |
|
| virtual bool | Close () |
| Closes a file, freeing its handle. |
|
| 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. |
|
| virtual FbxInt64 | Tell () const |
| Returns the position at which the file
cursor currently is. |
|
| virtual size_t | Read (void *pDstBuf, const size_t pSize) |
| Read a part of the file into a buffer.
|
|
| virtual char * | ReadString (char *pDstBuf, const size_t pDstSize, bool pStopAtFirstWhiteSpace=false) |
| Read a part of the file as a string into a
buffer. |
|
| virtual size_t | Write (const void *pSrcBuf, const size_t pSize) |
| Write a buffer to an opened file. |
|
| virtual bool | WriteFormat (const char *pFormat,...) |
| Write a formatted string to an opened file.
|
|
| virtual bool | Truncate (const FbxInt64 pSize) |
| Modify the size of a file. |
|
| virtual bool | EndOfFile () const |
| Checks whether the current file cursor
position is at the end of file. |
|
| virtual FbxInt64 | GetSize () |
| Gets the size of the currently opened file.
|
|
| virtual void | GetMemoryFileInfo (void **pMemPtr, size_t pSize) |
| Unused function in this default
implementation. |
|
| 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. |
|
Protected Attributes |
|
| FILE * | mFilePtr |
| FbxStream * | mStreamPtr |
| bool | mIsOpen |
| bool | mIsStream |
| EMode | mMode |
| FbxString | mFileName |
| enum EMode |
| enum ESeekPos |
| FbxFile | ( | ) |
| virtual ~FbxFile | ( | ) | [virtual] |
| virtual bool Open | ( | const char * | pFileName_UTF8, |
| const EMode | pMode =
eCreateReadWrite, |
||
| const bool | pBinary =
true |
||
| ) | [virtual] |
Opens a file on disk using the specified read/write mode.
| pFileName | 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 bool Open | ( | FbxStream * | pStream, |
| void * | pStreamData, | ||
| const char * | pMode | ||
| ) | [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 bool Close | ( | ) | [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 FbxInt64 Tell | ( | ) | const [virtual] |
Returns the position at which the file cursor currently is.
For example, will be ==0 for beginning and ==FileSize for end.
| virtual size_t Read | ( | void * | pDstBuf, |
| const size_t | pSize | ||
| ) | [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 char* ReadString | ( | char * | pDstBuf, |
| const size_t | pDstSize, | ||
| bool | pStopAtFirstWhiteSpace =
false |
||
| ) | [virtual] |
Read a part of the file as a string into a buffer.
| pDstBuf | Pre-allocated buffer in which to read the string |
| pSize | 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 size_t Write | ( | const void * | pSrcBuf, |
| const size_t | pSize | ||
| ) | [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 bool WriteFormat | ( | const char * | pFormat, |
| ... | |||
| ) | [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 bool Truncate | ( | const FbxInt64 | pSize | ) | [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 bool EndOfFile | ( | ) | const [virtual] |
Checks whether the current file cursor position is at the end of file.
| virtual FbxInt64 GetSize | ( | ) | [virtual] |
| virtual void GetMemoryFileInfo | ( | void ** | pMemPtr, |
| size_t | pSize | ||
| ) | [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.
FILE* mFilePtr
[protected] |
FbxStream* mStreamPtr
[protected] |
bool mIsOpen
[protected] |
bool mIsStream
[protected] |