#include <c4d_file.h>
Represents a file for reading and writing.
Private Member Functions | |
BaseFile () | |
~BaseFile () | |
Alloc/Free | |
static BaseFile * | Alloc () |
static void | Free (BaseFile *&fl) |
Open/Close | |
Bool | Open (const Filename &name, FILEOPEN mode=FILEOPEN::READ, FILEDIALOG error_dialog=FILEDIALOG::IGNOREOPEN, BYTEORDER order=BYTEORDER::V_MOTOROLA, Int32 type='C4DC', Int32 creator='C4D1') |
Bool | Close () |
Read/Write Bytes | |
Int | ReadBytes (void *data, Int len, Bool just_try_it=false) |
Int | TryReadBytes (void *data, Int len) |
Bool | WriteBytes (const void *data, Int len) |
File Pointer/Information/Error | |
Bool | Seek (Int64 pos, FILESEEK mode=FILESEEK::RELATIVE_) |
Int64 | GetPosition () |
Int64 | GetLength () |
LOCATION | GetLocation () const |
FILEERROR | GetError () const |
void | SetError (FILEERROR error) |
void | SetOrder (BYTEORDER order) |
Read | |
Bool | ReadChar (Char *v) |
Bool | ReadUChar (UChar *v) |
Bool | ReadInt16 (Int16 *v) |
Bool | ReadUInt16 (UInt16 *v) |
Bool | ReadInt32 (Int32 *v) |
Bool | ReadUInt32 (UInt32 *v) |
Bool | ReadFloat32 (Float32 *v) |
Bool | ReadFloat64 (Float64 *v) |
Bool | ReadInt64 (Int64 *v) |
Bool | ReadUInt64 (UInt64 *v) |
Bool | ReadFilename (Filename *v) |
Bool | ReadBool (Bool *v) |
Bool | ReadString (maxon::String *v) |
Bool | ReadVector32 (Vector32 *v) |
Bool | ReadVector64 (Vector64 *v) |
Bool | ReadMatrix32 (Matrix32 *v) |
Bool | ReadMatrix64 (Matrix64 *v) |
Write | |
Bool | WriteChar (Char v) |
Bool | WriteUChar (UChar v) |
Bool | WriteInt16 (Int16 v) |
Bool | WriteUInt16 (UInt16 v) |
Bool | WriteInt32 (Int32 v) |
Bool | WriteUInt32 (UInt32 v) |
Bool | WriteFloat32 (Float32 v) |
Bool | WriteFloat64 (Float64 v) |
Bool | WriteInt64 (Int64 v) |
Bool | WriteUInt64 (UInt64 v) |
Bool | WriteFilename (const Filename &v) |
Bool | WriteBool (Bool v) |
Bool | WriteString (const maxon::String &v) |
Bool | WriteVector32 (const Vector32 &v) |
Bool | WriteVector64 (const Vector64 &v) |
Bool | WriteMatrix32 (const Matrix32 &v) |
Bool | WriteMatrix64 (const Matrix64 &v) |
|
private |
|
private |
|
static |
|
static |
Bool Open | ( | const Filename & | name, |
FILEOPEN | mode = FILEOPEN::READ , |
||
FILEDIALOG | error_dialog = FILEDIALOG::IGNOREOPEN , |
||
BYTEORDER | order = BYTEORDER::V_MOTOROLA , |
||
Int32 | type = 'C4DC' , |
||
Int32 | creator = 'C4D1' |
||
) |
Opens a file.
[in] | name | The name of the file to open. |
[in] | mode | The file access mode: FILEOPEN |
[in] | error_dialog | Set the type of error reporting that should happen while opening the file: FILEDIALOG |
[in] | order | The type of byte order in the file: BYTEORDER |
[in] | type | The type of file, only applies to Mac: MACTYPE_CINEMA. |
[in] | creator | The application that wrote the file, for example 'ttxt' (SimpleText) or 'C4D1' for Cinema 4D, Only relevant to Mac: MACCREATOR_CINEMA. |
Bool Close | ( | ) |
Closes the file.
Automatically called when a BaseFile object is destroyed.
Reads a block of bytes from the file.
[in] | data | The memory buffer to fill with the bytes from the file. The caller owns the pointed buffer. |
[in] | len | The number of bytes to read from the file. |
[in] | just_try_it | If true and the data retrieved from the file is less than requested, no error will be generated. |
Reads a block of bytes from the file.
If the end of the file is reached then only the remaining bytes will be read.
[out] | data | The memory buffer to fill with the bytes from the file. The caller owns the pointed buffer. |
[in] | len | The number of bytes to try and read from the file. |
Writes a block of bytes to the file.
[in] | data | The memory buffer with the data to write to the file. The caller owns the pointed buffer. |
[in] | len | The number of bytes to write to the file. |
Bool Seek | ( | Int64 | pos, |
FILESEEK | mode = FILESEEK::RELATIVE_ |
||
) |
Sets the file pointer within the file.
[in] | pos | The position within the file to place the file pointer. |
[in] | mode | Sets how the position relates to the file. |
Int64 GetPosition | ( | ) |
Gets the file pointer.
Int64 GetLength | ( | ) |
Gets the length of the file in bytes.
FILEERROR GetError | ( | ) | const |
Gets the last error during read or write.
void SetOrder | ( | BYTEORDER | order | ) |
Sets the byte order of the data in the file.
[in] | order | The byte order: BYTEORDER |
Bool ReadString | ( | maxon::String * | v | ) |
Reads a Vector32 from the file.
[out] | v | Assigned the read value. The caller owns the pointed Vector32. |
Reads a Vector64 from the file.
[out] | v | Assigned the read value. The caller owns the pointed Vector64. |
Reads a Matrix32 from the file.
[out] | v | Assigned the read value. The caller owns the pointed Matrix32. |
Reads a Matrix64 from the file.
[out] | v | Assigned the read value. The caller owns the pointed Matrix64. |
Writes a Char to the file.
[in] | v | The value to write to the file. |
Writes a UChar to the file.
[in] | v | The value to write to the file. |
Writes a Int16 to the file.
[in] | v | The value to write to the file. |
Writes a UInt16 to the file.
[in] | v | The value to write to the file. |
Writes a Int32 to the file.
[in] | v | The value to write to the file. |
Writes a UInt32 to the file.
[in] | v | The value to write to the file. |
Writes a Float32 to the file.
[in] | v | The value to write to the file. |
Writes a Float64 to the file.
[in] | v | The value to write to the file. |
Writes a Int64 to the file.
[in] | v | The value to write to the file. |
Writes a UInt64 to the file.
[in] | v | The value to write to the file. |
Writes a Filename to the file.
[in] | v | The value to write to the file. |
Writes a Bool to the file.
[in] | v | The value to write to the file. |
Bool WriteString | ( | const maxon::String & | v | ) |
Writes a String to the file.
[in] | v | The value to write to the file. |
Writes a Vector32 to the file.
[in] | v | The value to write to the file. |
Writes a Vector64 to the file.
[in] | v | The value to write to the file. |
Writes a Matrix32 to the file.
[in] | v | The value to write to the file. |