AtomArray Class Reference

#include <c4d_baselist.h>

详细描述

An array of C4DAtom 对象。

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

私有成员函数

  AtomArray ()
  ~AtomArray ()

Alloc/Free

static AtomArray Alloc ()
static void  Free ( AtomArray *&obj)

杂项

Int32   GetCount () const
Int32   GetCount ( Int32 type, Int32 instance) const
C4DAtom GetIndex ( Int32 idx) const
Bool   Append ( C4DAtom *obj)
void  Flush ()
Bool   移除 ( C4DAtom *obj)
C4DAtom GetPreferred () const
void  SetPreferred ( C4DAtom *t_preferred)
void  FilterObject ( Int32 type, Int32 instance, Bool generators=false)
void  FilterObjectChildren ()
Bool   Append (const AtomArray *src)
Int32   Find ( C4DAtom *obj)
Bool   比较 (const AtomArray *cmp) const

拷贝

Bool   CopyTo ( AtomArray *dest) const
Bool   CopyToFilter ( AtomArray *dest, Int32 type, Int32 instance, Int32 generators=1) const

User ID and Data

Int32   GetUserID () const
void  SetUserID ( Int32 t_userid)
void *  GetUserData () const
void  SetUserData (void *t_userdata)

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

◆  AtomArray()

AtomArray () private

◆  ~AtomArray()

~ AtomArray () private

成员函数文档编制

◆  Alloc()

static AtomArray * Alloc ( )
static

Allocates an atom array. Destroy the allocated atom array with Free() 。使用 AutoAlloc to automate the allocation and destruction based on scope.

返回
The allocated atom array, or nullptr if the allocation failed.

◆  Free()

static void Free ( AtomArray *&  obj )
static

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

参数
[in,out] obj The atom array to destruct. If the pointer is nullptr nothing happens. The pointer is assigned nullptr afterwards.

◆  GetCount() [1/2]

Int32 GetCount ( ) const

Gets the number of atoms in the array.

返回
The atom count.

◆  GetCount() [2/2]

Int32 GetCount ( Int32   type ,
Int32   instance  
) const

Checks how many elements in the array match type and/or instance .

参数
[in] type Checked against C4DAtom::GetType() . Pass NOTOK to ignore this test.
[in] instance Checked against C4DAtom::IsInstanceOf() . Pass NOTOK to ignore this test.
返回
The number of matches.

◆  GetIndex()

C4DAtom * GetIndex ( Int32   idx ) const

Gets the atom at the position idx in the array.

参数
[in] idx The index. Must be between 0 and GetCount() .
返回
The idx -th atom in the array. The atom array owns the pointed object.

◆  Append() [1/2]

Bool Append ( C4DAtom obj )

Appends obj to the array.

参数
[in] obj The atom to append to the array. Only the pointer is stored; the actual ownership remains with the caller.
返回
true if the atom was appended, otherwise false .

◆  Flush()

void Flush ( )

Clears the atom array.

◆  Remove()

Bool 移除 ( C4DAtom obj )

Removes obj from the array.

参数
[in] obj The atom to remove from the array. Only the pointer is removed; the object is not freed.
返回
true if successful, otherwise false .

◆  CopyTo()

Bool CopyTo ( AtomArray dest ) const

Copies all atoms in *this to *dest .

参数
[out] dest The destination array. The caller owns the pointed object.
返回
true if the atom array was copied, otherwise false .

◆  CopyToFilter()

Bool CopyToFilter ( AtomArray dest ,
Int32   type ,
Int32   instance ,
Int32   generators = 1  
) const

Copies all atoms in *this to *dest filtered by type and/or instance .

参数
[out] dest The destination array. The caller owns the pointed object.
[in] type Checked against C4DAtom::GetType() . Pass NOTOK to ignore this test.
[in] instance Checked against C4DAtom::IsInstanceOf() . Pass NOTOK to ignore this test.
[in] generators Used to filter generators.
返回
true if the atom array was copied, otherwise false .

◆  GetUserID()

Int32 GetUserID ( ) const

Gets the user ID of the array.

返回
This array's user ID.

◆  SetUserID()

void SetUserID ( Int32   t_userid )

Sets the user ID of the array to t_userid .

参数
[in] t_userid The new user ID.

◆  GetUserData()

void* GetUserData ( ) const

Gets the user data pointer stored with the array.

返回
The user data pointer. Not managed by the atom array.

◆  SetUserData()

void SetUserData ( void *  t_userdata )

Store a user data pointer with the array.

参数
[in] t_userdata The new user data pointer. Not manager by the atom array.

◆  GetPreferred()

C4DAtom * GetPreferred ( ) const

The preferred object is the one to use for operations that require a single object.
For example, if the user drags many objects to a link field this is used.

注意
This is not always set. In that case for example use the first object.
返回
The preferred object to use for single object actions. The array owns the pointed object..

◆  SetPreferred()

void SetPreferred ( C4DAtom t_preferred )

Sets the preferred object.

另请参阅
GetPreferred()
参数
[in] t_preferred The new preferred object. Must already be in the array.

◆  FilterObject()

void FilterObject ( Int32   type ,
Int32   instance ,
Bool   generators = false  
)

Removes objects that do not match the filter given by type and instance .

参数
[in] type Checked against C4DAtom::GetType() . Pass NOTOK to ignore this test.
[in] instance Checked against C4DAtom::IsInstanceOf() . Pass NOTOK to ignore this test.
[in] generators Used to filter generators.

◆  FilterObjectChildren()

void FilterObjectChildren ( )

Removes all objects that has a parent (or ancestor) in the array.

◆  Append() [2/2]

Bool Append ( const AtomArray src )

Appends all objects in src to the array.

参数
[in] src The source array to append. The caller owns the pointed object.
返回
true if successful, otherwise false .

◆  Find()

Int32 Find ( C4DAtom obj )

Finds the index of obj in the array.

参数
[in] obj The atom to search for.
返回
The index, or NOTOK if not found.

◆  Compare()

Bool 比较 ( const AtomArray cmp ) const

Compares the array with cmp .

参数
[in] cmp The atom array to compare with. The caller owns the pointed object.
返回
true if both arrays are identical, otherwise false .