HyperFile Class Reference

#include <c4d_file.h>

详细描述

Hyper files are used to save plugin data that cannot be stored in a BaseContainer .
Cinema 4D creates it and pass it to dedicated Load and Save overrides when needed (see NodeData and CustomDataTypeClass ).
Access to the hyper file's data is like a FIFO (first in, first out) buffer; the values must be written and read in the same order.

注意
Has to be created with Alloc() and destroyed with Free() 。使用 AutoAlloc to automate the allocation and destruction based on scope.

私有成员函数

  HyperFile ()
  ~HyperFile ()

Alloc/Free

static HyperFile Alloc (void)
static void  Free ( HyperFile *&fl)

Open/Close

Bool   Open ( Int32 ident, const Filename &filename, FILEOPEN 模式, FILEDIALOG error_dialog)
Bool   关闭 ()

读取

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   ReadInt64 ( Int64 *v)
Bool   ReadUInt64 ( UInt64 *v)
Bool   ReadFloat ( Float *v)
Bool   ReadFloat32 ( Float32 *v)
Bool   ReadFloat64 ( Float64 *v)
Bool   ReadBool ( Bool *v)
Bool   ReadTime ( BaseTime *v)
Bool   ReadVector ( 向量 *v)
Bool   ReadVector32 ( Vector32 *v)
Bool   ReadVector64 ( Vector64 *v)
Bool   ReadMatrix ( 矩阵 *v)
Bool   ReadMatrix32 ( Matrix32 *v)
Bool   ReadMatrix64 ( Matrix64 *v)
Bool   ReadString ( maxon::String *v)
Bool   ReadFilename ( Filename *v)
Bool   ReadImage ( BaseBitmap *v)
Bool   ReadGeData ( GeData *v)
Bool   ReadContainer ( BaseContainer *v, Bool flush)
Bool   ReadMemory (void **data, Int *size)
Bool   ReadChannelConvert ( GeListNode *node, Int32 link_id)
Bool   ReadArray (void *data, HYPERFILEARRAY type, Int32 structure_increment, Int32 count)
Bool   ReadUuid ( C4DUuid *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   WriteInt64 ( Int64 v)
Bool   WriteUInt64 ( UInt64 v)
Bool   WriteFloat ( Float v)
Bool   WriteFloat32 ( Float32 v)
Bool   WriteFloat64 ( Float64 v)
Bool   WriteBool ( Bool v)
Bool   WriteTime (const BaseTime &v)
Bool   WriteVector (const 向量 &v)
Bool   WriteVector32 (const Vector32 &v)
Bool   WriteVector64 (const Vector64 &v)
Bool   WriteMatrix (const 矩阵 &v)
Bool   WriteMatrix32 (const Matrix32 &v)
Bool   WriteMatrix64 (const Matrix64 &v)
Bool   WriteString (const maxon::String &v)
Bool   WriteFilename (const Filename &v)
Bool   WriteImage ( BaseBitmap *bmp, Int32 format, BaseContainer *data, SAVEBIT savebits= SAVEBIT::ALPHA )
Bool   WriteGeData (const GeData &v)
Bool   WriteContainer (const BaseContainer &v)
Bool   WriteMemory (const void *data, Int count)
Bool   WriteArray (const void *data, HYPERFILEARRAY datatype, Int32 structure_increment, Int32 count)
Bool   WriteUuid (const C4DUuid &v)

Error

FILEERROR   GetError () const
void  SetError ( FILEERROR err)

HyperFile Value

Bool   ReadValueHeader ( HYPERFILEVALUE *h)
Bool   SkipValue ( HYPERFILEVALUE h)

Chunk Start/End

Bool   WriteChunkStart ( Int32 id, Int32 level)
Bool   WriteChunkEnd (void)
Bool   ReadChunkStart ( Int32 *id, Int32 *level)
Bool   ReadChunkEnd (void)
Bool   SkipToEndChunk (void)

文件版本

Int32   GetFileVersion () const
void  SetFileVersion ( Int32 val)

杂项

BaseDocument GetDocument () const
LOCATION   GetLocation (void) const
SCENEFILTER   GetFilterFlags () const

构造函数 & 析构函数文档编制

◆  HyperFile()

HyperFile () private

◆  ~HyperFile()

~ HyperFile () private

成员函数文档编制

◆  Alloc()

static HyperFile * Alloc ( void  )
static

Allocates a hyper file. Destroy the allocated hyper file with Free() 。使用 AutoAlloc to automate the allocation and destruction based on scope.

返回
The allocated hyper file, or nullptr if the allocation failed.

◆  Free()

static void Free ( HyperFile *&  fl )
static

Destructs hyper files allocated with Alloc() 。使用 AutoAlloc to automate the allocation and destruction based on scope.

参数
[in,out] fl The hyper file to destruct. If the pointer is nullptr nothing happens. The pointer is assigned nullptr afterwards.

◆  Open()

Bool Open ( Int32   ident ,
const Filename filename ,
FILEOPEN   mode ,
FILEDIALOG   error_dialog  
)

Opens the hyper file.

参数
[in] ident The file identification.
[in] filename The name of the file to open.
[in] mode The file mode: FILEOPEN
[in] error_dialog The file error dialog: FILEDIALOG
返回
true if the hyper file could be opened, otherwise false .

◆  Close()

Bool 关闭 ( )

Closes the hyper file.

返回
true if the hyper file could be closed, otherwise false .

◆  ReadChar()

Bool ReadChar ( Char v )

Reads a Char value from the hyper file.

参数
[out] v Assigned the value read from the hyper file.
返回
Success of reading the value.

◆  ReadUChar()

Bool ReadUChar ( UChar v )

Reads a UChar value from the hyper file.

参数
[out] v Assigned the value read from the hyper file.
返回
Success of reading the value.

◆  ReadInt16()

Bool ReadInt16 ( Int16 v )

Reads a Int16 value from the hyper file.

参数
[out] v Assigned the value read from the hyper file.
返回
Success of reading the value.

◆  ReadUInt16()

Bool ReadUInt16 ( UInt16 v )

Reads a UInt16 value from the hyper file.

参数
[out] v Assigned the value read from the hyper file.
返回
Success of reading the value.

◆  ReadInt32()

Bool ReadInt32 ( Int32 v )

Reads a Int32 value from the hyper file.

参数
[out] v Assigned the value read from the hyper file.
返回
Success of reading the value.

◆  ReadUInt32()

Bool ReadUInt32 ( UInt32 v )

Reads a UInt32 value from the hyper file.

参数
[out] v Assigned the value read from the hyper file.
返回
Success of reading the value.

◆  ReadInt64()

Bool ReadInt64 ( Int64 v )

Reads a Int64 value from the hyper file.

参数
[out] v Assigned the value read from the hyper file.
返回
Success of reading the value.

◆  ReadUInt64()

Bool ReadUInt64 ( UInt64 v )

Reads a UInt64 value from the hyper file.

参数
[out] v Assigned the value read from the hyper file.
返回
Success of reading the value.

◆  ReadFloat()

Bool ReadFloat ( Float v )

Reads a Float value from the hyper file.

参数
[out] v Assigned the value read from the hyper file.
返回
Success of reading the value.

◆  ReadFloat32()

Bool ReadFloat32 ( Float32 v )

Reads a Float32 value from the hyper file.

参数
[out] v Assigned the value read from the hyper file.
返回
Success of reading the value.

◆  ReadFloat64()

Bool ReadFloat64 ( Float64 v )

Reads a Float64 value from the hyper file.

参数
[out] v Assigned the value read from the hyper file.
返回
Success of reading the value.

◆  ReadBool()

Bool ReadBool ( Bool v )

Reads a Bool value from the hyper file.

参数
[out] v Assigned the value read from the hyper file.
返回
Success of reading the value.

◆  ReadTime()

Bool ReadTime ( BaseTime v )

Reads a BaseTime value from the hyper file.

参数
[out] v Assigned the value read from the hyper file.
返回
Success of reading the value.

◆  ReadVector()

Bool ReadVector ( 向量 v )

Reads a 向量 value from the hyper file.

参数
[out] v Assigned the value read from the hyper file.
返回
Success of reading the value.

◆  ReadVector32()

Bool ReadVector32 ( Vector32 v )

Reads a Vector32 value from the hyper file.

参数
[out] v Assigned the value read from the hyper file.
返回
Success of reading the value.

◆  ReadVector64()

Bool ReadVector64 ( Vector64 v )

Reads a Vector64 value from the hyper file.

参数
[out] v Assigned the value read from the hyper file.
返回
Success of reading the value.

◆  ReadMatrix()

Bool ReadMatrix ( 矩阵 v )

Reads a 矩阵 value from the hyper file.

参数
[out] v Assigned the value read from the hyper file.
返回
Success of reading the value.

◆  ReadMatrix32()

Bool ReadMatrix32 ( Matrix32 v )

Reads a Matrix32 value from the hyper file.

参数
[out] v Assigned the value read from the hyper file.
返回
Success of reading the value.

◆  ReadMatrix64()

Bool ReadMatrix64 ( Matrix64 v )

Reads a Matrix64 value from the hyper file.

参数
[out] v Assigned the value read from the hyper file.
返回
Success of reading the value.

◆  ReadString()

Bool ReadString ( maxon::String v )

Reads a String value from the hyper file.

参数
[out] v Assigned the value read from the hyper file.
返回
Success of reading the value.

◆  ReadFilename()

Bool ReadFilename ( Filename v )

Reads a Filename value from the hyper file.

参数
[out] v Assigned the value read from the hyper file.
返回
Success of reading the value.

◆  ReadImage()

Bool ReadImage ( BaseBitmap v )

Reads a BaseBitmap value from the hyper file.

参数
[out] v Assigned the value read from the hyper file.
返回
Success of reading the value.

◆  ReadGeData()

Bool ReadGeData ( GeData v )

Reads a GeData value from the hyper file.

参数
[out] v Assigned the value read from the hyper file.
返回
Success of reading the value.

◆  ReadContainer()

Bool ReadContainer ( BaseContainer v ,
Bool   flush  
)

Reads a container from the hyper file.

参数
[out] v Assigned the value read from the hyper file.
[in] flush Specify if the container should be cleared before reading the new values.
Passing false will merge the container with the one read from the file.
返回
Success of reading the container.

◆  ReadMemory()

Bool ReadMemory ( void **  data ,
Int size  
)

Reads a block of memory from the hyper file.

注意
Only use when really needed. Be aware that the byte sequences will not be platform independent. 范例: Int32 size; void * data = nullptr ; Bool ok = ReadMemory (&data, &size); DeleteMem (data);
参数
[out] data A pointer to the start of the memory block to read.
[out] size Assigned the byte size of the memory data read.
返回
Success of reading the memory block.

◆  ReadChannelConvert()

Bool ReadChannelConvert ( GeListNode node ,
Int32   link_id  
)

Deprecated .

◆  ReadArray()

Bool ReadArray ( void *  data ,
HYPERFILEARRAY   type ,
Int32   structure_increment ,
Int32   count  
)

Reads an array of the specified type from the hyper file.

参数
[out] data A pointer to an array to be filled. The caller owns the pointed array.
[in] type The data type: HYPERFILEARRAY
[in] structure_increment The size of the data type ( sizeof() ).
[in] count The umber of elements in data .
返回
Success of reading the array.

◆  ReadUuid()

Bool ReadUuid ( C4DUuid v )

Reads a C4DUuid value from the hyper file.

参数
[out] v Assigned the value read from the hyper file.
返回
Success of reading the value.

◆  WriteChar()

Bool WriteChar ( Char   v )

Writes a Char value to the hyper file.

参数
[in] v The value to write to the hyper file.
返回
Success of writing the value.

◆  WriteUChar()

Bool WriteUChar ( UChar   v )

Writes a UChar value to the hyper file.

参数
[in] v The value to write to the hyper file.
返回
Success of writing the value.

◆  WriteInt16()

Bool WriteInt16 ( Int16   v )

Writes a Int16 value to the hyper file.

参数
[in] v The value to write to the hyper file.
返回
Success of writing the value.

◆  WriteUInt16()

Bool WriteUInt16 ( UInt16   v )

Writes a UInt16 value to the hyper file.

参数
[in] v The value to write to the hyper file.
返回
Success of writing the value.

◆  WriteInt32()

Bool WriteInt32 ( Int32   v )

Writes a Int32 value to the hyper file.

参数
[in] v The value to write to the hyper file.
返回
Success of writing the value.

◆  WriteUInt32()

Bool WriteUInt32 ( UInt32   v )

Writes a UInt32 value to the hyper file.

参数
[in] v The value to write to the hyper file.
返回
Success of writing the value.

◆  WriteInt64()

Bool WriteInt64 ( Int64   v )

Writes a Int64 value to the hyper file.

参数
[in] v The value to write to the hyper file.
返回
Success of writing the value.

◆  WriteUInt64()

Bool WriteUInt64 ( UInt64   v )

Writes a UInt64 value to the hyper file.

参数
[in] v The value to write to the hyper file.
返回
Success of writing the value.

◆  WriteFloat()

Bool WriteFloat ( Float   v )

Writes a Float value to the hyper file.

参数
[in] v The value to write to the hyper file.
返回
Success of writing the value.

◆  WriteFloat32()

Bool WriteFloat32 ( Float32   v )

Writes a Float32 value to the hyper file.

参数
[in] v The value to write to the hyper file.
返回
Success of writing the value.

◆  WriteFloat64()

Bool WriteFloat64 ( Float64   v )

Writes a Float64 value to the hyper file.

参数
[in] v The value to write to the hyper file.
返回
Success of writing the value.

◆  WriteBool()

Bool WriteBool ( Bool   v )

Writes a Bool value to the hyper file.

参数
[in] v The value to write to the hyper file.
返回
Success of writing the value.

◆  WriteTime()

Bool WriteTime ( const BaseTime v )

Writes a BaseTime value to the hyper file.

参数
[in] v The value to write to the hyper file.
返回
Success of writing the value.

◆  WriteVector()

Bool WriteVector ( const 向量 v )

Writes a 向量 value to the hyper file.

参数
[in] v The value to write to the hyper file.
返回
Success of writing the value.

◆  WriteVector32()

Bool WriteVector32 ( const Vector32 v )

Writes a Vector32 value to the hyper file.

参数
[in] v The value to write to the hyper file.
返回
Success of writing the value.

◆  WriteVector64()

Bool WriteVector64 ( const Vector64 v )

Writes a Vector64 value to the hyper file.

参数
[in] v The value to write to the hyper file.
返回
Success of writing the value.

◆  WriteMatrix()

Bool WriteMatrix ( const 矩阵 v )

Writes a 矩阵 value to the hyper file.

参数
[in] v The value to write to the hyper file.
返回
Success of writing the value.

◆  WriteMatrix32()

Bool WriteMatrix32 ( const Matrix32 v )

Writes a Matrix32 value to the hyper file.

参数
[in] v The value to write to the hyper file.
返回
Success of writing the value.

◆  WriteMatrix64()

Bool WriteMatrix64 ( const Matrix64 v )

Writes a Matrix64 value to the hyper file.

参数
[in] v The value to write to the hyper file.
返回
Success of writing the value.

◆  WriteString()

Bool WriteString ( const maxon::String v )

Writes a String value to the hyper file.

参数
[in] v The value to write to the hyper file.
返回
Success of writing the value.

◆  WriteFilename()

Bool WriteFilename ( const Filename v )

Writes a Filename value to the hyper file.

参数
[in] v The value to write to the hyper file.
返回
Success of writing the value.

◆  WriteImage()

Bool WriteImage ( BaseBitmap bmp ,
Int32   format ,
BaseContainer data ,
SAVEBIT   savebits = SAVEBIT::ALPHA  
)

Writes an image to the hyper file.

参数
[in] bmp The bitmap to write to the hyperfile. The caller owns the pointed bitmap.
[in] format The image format: FILTER
[in] data A container with additional format settings, or nullptr .
[in] savebits The save bits: SAVEBIT
返回
Success of writing the image.

◆  WriteGeData()

Bool WriteGeData ( const GeData v )

Writes a Char value to the hyper file.

参数
[in] v The value to write to the hyper file.
返回
Success of writing the value.

◆  WriteContainer()

Bool WriteContainer ( const BaseContainer v )

Writes a container to the hyper file.

参数
[in] v The container to write to the hyper file.
返回
Success of writing the container.

◆  WriteMemory()

Bool WriteMemory ( const void *  data ,
Int   count  
)

Writes a block of memory to the hyper file.

注意
Only use when really needed. Be aware that the byte sequences will not be platform independent.
参数
[in] data The start of the memory block to write to the hyper file.
[in] count The size in bytes of the memory data to write.
返回
Success of writing the memory block.

◆  WriteArray()

Bool WriteArray ( const void *  data ,
HYPERFILEARRAY   datatype ,
Int32   structure_increment ,
Int32   count  
)

Writes an array of the specified datatype to the hyper file.

参数
[in] data The pointer to the array. The caller owns the pointed array.
[in] datatype The array data type: HYPERFILEARRAY
[in] structure_increment Size of the data type ( sizeof() ).
[in] count The number of elements in data .
返回
Success of writing the array.

◆  WriteUuid()

Bool WriteUuid ( const C4DUuid v )

Writes a C4DUuid value to the hyper file.

参数
[in] v The value to write to the hyper file.
返回
Success of writing the value.

◆  GetError()

FILEERROR GetError ( ) const

Gets the error from the last hyper file operation.

返回
The error: FILEERROR

◆  SetError()

void SetError ( FILEERROR   err )

Sets the error for the hyper file.

参数
[in] err The error to set: FILEERROR

◆  ReadValueHeader()

Bool ReadValueHeader ( HYPERFILEVALUE h )

Reads the value header from the hyper file.
This is only necessary in combination with loops.
例如:

static Bool ReadSettings( BaseObject *op, HyperFile *hf, Int32 level) { Int32 id, level, v; String test; HYPERFILEVALUE h; while (hf-> ReadValueHeader (&h) && h== HYPERFILEVALUE::START ) { if (!hf-> ReadChunkStart (& id , &level)) return false ; if ( id ==2) { hf-> ReadInt32 (&v); hf-> ReadInt32 (&v); } else if ( id ==3) { hf-> ReadInt32 (&v); hf-> ReadInt32 (&v); hf-> ReadInt32 (&v); } hf-> SkipToEndChunk (); // Never forget this at the end if ( id ==0) break ; // Chunk ID 0 is end chunk } hf-> ReadString (test); return true ; }
参数
[in] h A pointer to a HYPERFILEVALUE to take the header value: HYPERFILEVALUE
返回
true if the header was read successfully, otherwise false .

◆  SkipValue()

Bool SkipValue ( HYPERFILEVALUE   h )

Skips a given type of value.

参数
[in] h The hyper file value to skip: HYPERFILEVALUE
返回
true if the value was of the given header type and it was skipped, otherwise false .

◆  WriteChunkStart()

Bool WriteChunkStart ( Int32   id ,
Int32   level  
)

Writes a chunk marker into the file indicating the beginning of a new chunk of data.

参数
[in] id The ID for the chunk.
[in] level To write additional information, increase this level to save/read new values.
返回
true if the chunk identification was written successfully, otherwise false .

◆  WriteChunkEnd()

Bool WriteChunkEnd ( void  )

Writes a chunk ending marker into the hyper file.

返回
true if the chunk end was written successfully, otherwise false .

◆  ReadChunkStart()

Bool ReadChunkStart ( Int32 id ,
Int32 level  
)

Reads a chunks identification from the hyper file.

参数
[out] id Assigned the chunk ID.
[out] level Assigned the chunk level.
返回
true if the chunk start was read successfully, otherwise false .

◆  ReadChunkEnd()

Bool ReadChunkEnd ( void  )

Reads a chunk end marker from the hyper file.

返回
true if the chunk end was read successfully, otherwise false .

◆  SkipToEndChunk()

Bool SkipToEndChunk ( void  )

Moves the file pointer to the end of the chunk.

注意
Should always be called after having finished reading values from the current chunk.
返回
true if the end of the chunk was found and skipped to, otherwise false .

◆  GetFileVersion()

Int32 GetFileVersion ( ) const

Gets the version of Cinema 4D that wrote the file. (Only valid while reading a Cinema 4D scene, object, material etc.)

返回
The file version.

◆  SetFileVersion()

void SetFileVersion ( Int32   val )

Private .

◆  GetDocument()

BaseDocument * GetDocument ( ) const

Gets the active document for the hyper file operation.
Can be nullptr , for instance when saving layouts.

返回
The document for the hyper file operation. Cinema 4D owns the pointed document.

◆  GetLocation()

LOCATION GetLocation ( void  ) const

Gets the hyper file location.

返回
The hyper file location: LOCATION

◆  GetFilterFlags()

SCENEFILTER GetFilterFlags ( ) const

Gets the filter flags, the value is valid only during a Load or a Merge.

返回
The filter flags: SCENEFILTER
HYPERFILEVALUE
HYPERFILEVALUE
定义: ge_prepass.h:3846
BaseObject
定义: c4d_baseobject.h:224
HYPERFILEVALUE::START
@ START
Marks the start of a chunk.
String
定义: c4d_string.h:38
HyperFile::ReadInt32
Bool ReadInt32(Int32 *v)
HyperFile::ReadValueHeader
Bool ReadValueHeader(HYPERFILEVALUE *h)
HyperFile::ReadMemory
Bool ReadMemory(void **data, Int *size)
maxon::DeleteMem
void DeleteMem(T *&p)
定义: defaultallocator.h:258
HyperFile::SkipToEndChunk
Bool SkipToEndChunk(void)
Int32
maxon::Int32 Int32
定义: ge_sys_math.h:58
HyperFile::ReadString
Bool ReadString(maxon::String *v)
HyperFile
定义: c4d_file.h:1069
HyperFile::ReadChunkStart
Bool ReadChunkStart(Int32 *id, Int32 *level)
Bool
maxon::Bool Bool
定义: ge_sys_math.h:53