Public Member Functions | Static Public Member Functions

KFbxFile Class Reference

Search for all occurrences

Detailed Description

Generic utility class to manipulate files on different file systems similarly.

Used internally by different readers(KFbxReader) and writer (KFbxWriter) objects. SDK users can also use this class to manipulate files in the file system.

Definition at line 217 of file kfbxutilities.h.

#include <kfbxutilities.h>

List of all members.

Public Member Functions

  KFbxFile ()
  Default constructor.
virtual  ~KFbxFile ()
  Destructor.
bool  Open (const char *pFileName, eFileMode pMode, bool pText)
  Open file.
bool  Open (const char *pFileName, const char *pMode)
  Open file.
bool  IsOpened ()
  Return the status that if the file is opened.
bool  Close ()
  Close the file.
size_t  Read (void *pBuffer, size_t pSize)
  Reads a number of bytes into a block of memory.
char *  ReadString (char *pBuffer, int pMaxSize, bool pStopAtFirstWhiteSpace=false)
  Read a block of text into a buffer up to the first new-line up to the specified maximum size.
kInt32  ReadInt32 (kInt32 *pBuffer, bool pSwab=false)
  Read 32-bit integer.
kUInt32  ReadUInt32 (kUInt32 *pBuffer, bool pSwab=false)
  Read unsigned 32-bit integer.
kInt16  ReadInt16 (kInt16 *pBuffer, bool pSwab=false)
  Read 16-bit integer.
kUInt16  ReadUInt16 (kUInt16 *pBuffer, bool pSwab=false)
  Read unsigned 16-bit integer.
char  ReadChar (char *pBuffer)
  Read a char.
kUChar  ReadUChar (kUChar *pBuffer)
  Read unsigned char.
size_t  Write (const void *pBuffer, size_t pSize)
  Write file.
void  Seek (eSeekPos pSeekPosition, long pOffset)
  Set the file cursor position.
long  GetPosition ()
  Get file cursor's position.
void  SetPosition (long pPosition)
  Set file cursor's position.
bool  EndOfFile ()
  Returns true if the end of the file has been reached.
char *  GetFullFileName ()
  Returns the file name and full path.
eFileMode  GetFileMode ()
  Returns the mode used to open the file.
int  GetError ()
  Get last error.
void  ClearError ()
  Clear error.
void  Format (const char *pFormat,...)
  Outputs the files content to the standard output stream using a printf-style formatting string.
int  Truncate (size_t pSize)
  Truncates file to a specified size.

Static Public Member Functions

static int  Remove (const char *pFileName)
  Deletes the file.
static int  Rename (const char *pFileName, const char *pNewName)
  Rename file.

Constructor & Destructor Documentation

KFbxFile ( )

Default constructor.

virtual ~KFbxFile ( ) [virtual]

Destructor.


Member Function Documentation

bool Open ( const char *  pFileName,
eFileMode  pMode,
bool  pText 
)

Open file.

Parameters:
pFileName const char* The file name.
pMode eFileMode The file open mode. KFBX_READ / KFBX_WRITE / KFBX_READWRITE / KFBX_APPEND
pText bool The file is text or binary.
Returns:
Open status.
bool Open ( const char *  pFileName,
const char *  pMode 
)

Open file.

Parameters:
pFileName const char * The file name.
pMode const char * The file open mode.
Returns:
Open status.
bool IsOpened ( )

Return the status that if the file is opened.

Returns:
Open status.
bool Close ( )

Close the file.

Returns:
Close status.
size_t Read ( void *  pBuffer,
size_t  pSize 
)

Reads a number of bytes into a block of memory.

Parameters:
pBuffer Pointer to a block of memory.
pSize Bytes count to read.
Returns:
The bytes count read.
char* ReadString ( char *  pBuffer,
int  pMaxSize,
bool  pStopAtFirstWhiteSpace = false 
)

Read a block of text into a buffer up to the first new-line up to the specified maximum size.

Parameters:
pBuffer Pointer to a block of memory.
pMaxSize size of the pBuffer allocated.
pStopAtFirstWhiteSpace If this parameter is true, the function will have the same behavior as fscanf: characters are read until pMaxSize or a space character is reached.
Returns:
The string.
kInt32 ReadInt32 ( kInt32 pBuffer,
bool  pSwab = false 
)

Read 32-bit integer.

Parameters:
pBuffer Pointer to a block of memory.
pSwab indicate if a bytes swap is required (big-endian/little-endian)
Returns:
The integer read.
kUInt32 ReadUInt32 ( kUInt32 pBuffer,
bool  pSwab = false 
)

Read unsigned 32-bit integer.

Parameters:
pBuffer Pointer to a block of memory.
pSwab indicate if a bytes swap is required (big-endian/little-endian)
Returns:
The unsigned integer read.
kInt16 ReadInt16 ( kInt16 pBuffer,
bool  pSwab = false 
)

Read 16-bit integer.

Parameters:
pBuffer Pointer to a block of memory.
pSwab indicate if a bytes swap is required (big-endian/little-endian)
Returns:
The integer read.
kUInt16 ReadUInt16 ( kUInt16 pBuffer,
bool  pSwab = false 
)

Read unsigned 16-bit integer.

Parameters:
pBuffer Pointer to a block of memory.
pSwab indicate if a bytes swap is required (big-endian/little-endian)
Returns:
The unsigned integer read.
char ReadChar ( char *  pBuffer )

Read a char.

Parameters:
pBuffer Pointer to a block of memory.
Returns:
The char read.
kUChar ReadUChar ( kUChar pBuffer )

Read unsigned char.

Parameters:
pBuffer Pointer to a block of memory.
Returns:
The unsigned char read.
size_t Write ( const void *  pBuffer,
size_t  pSize 
)

Write file.

Parameters:
pBuffer Pointer to a block of memory to be written.
pSize number of bytes to be written.
Returns:
The byte count written.
void Seek ( eSeekPos  pSeekPosition,
long  pOffset 
)

Set the file cursor position.

Parameters:
pSeekPosition like KFBX_BEGIN/KFBX_CURRENT/KFBX_END
pOffset offset value from the seek position
long GetPosition ( )

Get file cursor's position.

Returns:
the current file position
void SetPosition ( long  pPosition )

Set file cursor's position.

Parameters:
pPosition the new position
bool EndOfFile ( )

Returns true if the end of the file has been reached.

Returns:
true if at the end, false otherwise.
char* GetFullFileName ( )

Returns the file name and full path.

Returns:
the full file name
eFileMode GetFileMode ( )

Returns the mode used to open the file.

Returns:
The file mode KFBX_READ/KFBX_WRITE/KFBX_READWRITE/KFBX_APPEND.
int GetError ( )

Get last error.

Returns:
The last error no.
void ClearError ( )
void Format ( const char *  pFormat,
  ... 
)

Outputs the files content to the standard output stream using a printf-style formatting string.

Parameters:
pFormat Pointer to a string memory buffer.
... variable parameters list
int Truncate ( size_t  pSize )

Truncates file to a specified size.

Parameters:
pSize number of bytes to truncate to.
Returns:
The new size.
static int Remove ( const char *  pFileName ) [static]

Deletes the file.

Parameters:
pFileName name of the file to remove
Returns:
0 if success, -1 otherwise.
static int Rename ( const char *  pFileName,
const char *  pNewName 
) [static]

Rename file.

Parameters:
pFileName Current file to rename.
pNewName New name of the file.
Returns:
0 if success, an error code otherwise.

The documentation for this class was generated from the following file:

KFbxFile KFbxFile KFbxFile KFbxFile KFbxFile KFbxFile KFbxFile KFbxFile KFbxFile KFbxFile
KFbxFile KFbxFile KFbxFile KFbxFile KFbxFile KFbxFile KFbxFile KFbxFile KFbxFile KFbxFile