-
首页
-
C4D R23.110 C++ SDK
#include <datatypebase.h>
详细描述
一般
数据
class. An object of this class can store every type of data as long as that type has been registered (see
DataType
).
-
另请参阅
-
$ref datatype_data
公共成员函数
|
|
数据
()=default
|
Result
< void >
|
Init
(const
DataType
&type)
|
|
~Data
()
|
Bool
|
IsEmpty
() const
|
Bool
|
IsPopulated
() const
|
const
DataType
&
|
GetType
() const
|
void
|
重置
()
|
template<typename T >
|
|
数据
(T &&data, typename std::enable_if< !
STD_IS_REPLACEMENT
(same, typename std::decay< T >::type,
数据
), DummyParamType * >::type=(DummyParamType *) nullptr)
|
|
数据
(
数据
&&
src
)
|
数据
&
|
operator=
(
数据
&&
src
)
|
Result
<
数据
>
|
GetCopy
() const
|
Result
< void >
|
CopyFrom
(const
数据
&
src
)
|
Result
< void >
|
CopyFrom
(const
ConstDataPtr
&
src
)
|
Result
< void >
|
MoveFrom
(
MoveDataPtr
&&
src
)
|
Result
< void >
|
CopyFrom
(
ForwardingDataPtr
&&
src
)
|
template<typename T >
|
Result
< void >
|
Set
(T &&data)
|
template<typename T >
|
Result
< typename std::conditional<
GetCollectionKind
< T >::value==
COLLECTION_KIND::ARRAY
, T, typename
ByValueParam
< T >::type >::type >
|
Get
() const
|
template<typename T >
|
Result
< typename std::conditional<
STD_IS_REPLACEMENT
(void, T)||(
GetCollectionKind
< T >::value==
COLLECTION_KIND::ARRAY
), T, T & >::type >
|
Get
()
|
template<typename T >
|
ByValueParam
< T >::type
|
GetOrNull
() const
|
template<typename T >
|
T
|
Get
(const T &defaultValue) const
|
template<typename T >
|
Result
< T >
|
转换
() const
|
template<typename T >
|
T
|
ConvertOrNull
() const
|
template<typename T >
|
T
|
转换
(const T &defaultValue) const
|
Result
<
数据
>
|
ConvertData
(const
DataType
&destType) const
|
template<typename T >
|
T *
|
GetPtr
()
|
template<typename T >
|
const T *
|
GetPtr
() const
|
Generic *
|
GetPtr
(const
DataType
&type)
|
const Generic *
|
GetPtr
(const
DataType
&type) const
|
const Generic *
|
PrivateGetPtr
() const
|
const Generic *
|
PrivateGetPtr
(const
DataType
&type) const
|
TupleValue
*
|
GetTuple
()
|
const
TupleValue
*
|
GetTuple
() const
|
String
|
ToString
(const
FormatStatement
*formatStatement=nullptr) const
|
COMPARERESULT
|
比较
(const
数据
&c) const
|
HashInt
|
GetHashCode
() const
|
Bool
|
IsEqual
(const
数据
&other,
EQUALITY
equality=
EQUALITY::DEEP
) const
|
Bool
|
operator==
(const
数据
&other) const
|
Bool
|
operator!=
(const
数据
&other) const
|
Bool
|
operator<
(const
数据
&other) const
|
Bool
|
operator<=
(const
数据
&other) const
|
Bool
|
operator>
(const
数据
&other) const
|
Bool
|
operator>=
(const
数据
&other) const
|
ConstDataPtr
|
ToConstDataPtr
(const
DataType
&expectedType) const
|
template<>
|
void
|
InitSet
(
数据
&&data)
|
template<>
|
数据
*
|
GetPtr
()
|
template<>
|
Result
< void >
|
Get
() const
|
template<>
|
Result
< void >
|
Set
(const
数据
&value)
|
template<>
|
Result
< void >
|
Set
(
数据
&value)
|
template<>
|
Result
< void >
|
Set
(
数据
&&value)
|
template<>
|
void
|
InitSet
(
HTTPREQUESTTYPE
&&d)
|
静态公共成员函数
|
template<typename T >
|
static
Result
<
数据
>
|
创建
()
|
私有成员函数
|
|
MAXON_DISALLOW_COPY_AND_ASSIGN
(
数据
)
|
template<typename DEST , typename SRC >
|
Result
< void >
|
SetImpl
(SRC &&data,
OverloadRank0
)
|
template<typename DEST >
|
Result
< void >
|
SetImpl
(const
数据
&data,
OverloadRank1
)
|
template<typename DEST >
|
Result
< void >
|
SetImpl
(
数据
&data,
OverloadRank1
)
|
template<typename DEST >
|
Result
< void >
|
SetImpl
(
数据
&&data,
OverloadRank1
)
|
template<typename DEST , typename SRC >
|
std::enable_if<
GetCollectionKind
< SRC >::value==
COLLECTION_KIND::ARRAY
,
Result
< void > >::type
|
SetImpl
(SRC &&data,
OverloadRank1
)
|
template<typename T >
|
Result
< typename
ByValueParam
< T >::type >
|
GetImpl
(
OverloadRank0
) const
|
template<typename T >
|
std::enable_if<
GetCollectionKind
< T >::value==
COLLECTION_KIND::ARRAY
,
Result
< T > >::type
|
GetImpl
(
OverloadRank1
) const
|
template<typename T >
|
Result
< typename std::conditional<
STD_IS_REPLACEMENT
(void, T), void, T & >::type >
|
GetImpl
(
OverloadRank0
)
|
template<typename T >
|
std::enable_if<
GetCollectionKind
< T >::value==
COLLECTION_KIND::ARRAY
,
Result
< T > >::type
|
GetImpl
(
OverloadRank1
)
|
template<typename T >
|
SFINAEHelper
<
Result
< T >, typename T::IsBlock >::type
|
GetImpl
(
OverloadRank2
)
|
template<typename T >
|
SFINAEHelper
<
Result
< T >, typename T::IsBlock >::type
|
GetImpl
(
OverloadRank2
) const
|
template<typename T >
|
void
|
InitSet
(T &&data)
|
构造函数 & 析构函数文档编制
◆
Data()
[1/3]
constructor initializes the data with an nullptr type.
◆
~Data()
◆
Data()
[2/3]
数据
|
(
|
T &&
|
data
,
|
|
|
typename std::enable_if< !
STD_IS_REPLACEMENT
(same, typename std::decay< T >::type,
数据
), DummyParamType * >::type
|
=
(DummyParamType*)nullptr
|
|
)
|
|
|
|
explicit
|
Template class to construct a
数据
object from a value. The value has to fit in
DataMemBlock
, i.e., this constructor can only be used when
SIZEOF(T)
<=
SIZEOF(DataMemBlock)
. Otherwise, you have to use Set which might return an error.
-
Template Parameters
-
-
参数
-
[in]
|
data
|
数据
to copy into the
数据
.
|
◆
Data()
[3/3]
Template class to move
数据
from every specialized data type. e.g. Int32,
Url
etc.
-
参数
-
[in,out]
|
src
|
数据
to move to this.
|
成员函数文档编制
◆
MAXON_DISALLOW_COPY_AND_ASSIGN()
MAXON_DISALLOW_COPY_AND_ASSIGN
|
(
|
数据
|
|
)
|
|
|
private
|
◆
Init()
Initializes this data to the given type. If this data already has the given type, nothing happens, i.e., the value is not reset. Otherwise, the current value is freed, and the data is initialized with a new default value of the given type.
-
参数
-
[in]
|
type
|
Type to which this data shall be set.
|
-
返回
-
False if the initialization failed.
◆
IsEmpty()
Checks if a
数据
is empty.
-
返回
-
True if it doesn't contain any data.
◆
IsPopulated()
Bool
IsPopulated
|
(
|
|
)
|
const
|
Checks if a
数据
contains anything.
-
返回
-
True if it contains data.
◆
GetType()
Returns the
DataType
的
数据
. you can compare this value to
GetDataType<Int32>()
or
GetDataType<String>()
.
-
返回
-
DataType
pointer of this.
◆
Reset()
Frees the wrapped data and resetd the
数据
object to its initial state.
◆
operator=()
数据
& operator=
|
(
|
数据
&&
|
src
|
)
|
|
Assignment move operator to move
数据
, (e.g. Swap uses this)
-
参数
-
[in]
|
src
|
数据
to move to this.
|
◆
CopyFrom()
[1/3]
Result
<void> CopyFrom
|
(
|
const
数据
&
|
src
|
)
|
|
Makes this @CLASS a copy of
src
by copying the contents of
src
into this @CLASS.
-
参数
-
[in]
|
src
|
Another @CLASS to be used as source for the copy operation.
|
-
返回
-
OK on success.
◆
CopyFrom()
[2/3]
Copies data described by a
ConstDataPtr
.
-
参数
-
-
返回
-
OK on success.
◆
MoveFrom()
Moves data described by a
MoveDataPtr
.
-
参数
-
-
返回
-
OK on success.
◆
CopyFrom()
[3/3]
Copies or moves data described by a
ForwardingDataPtr
.
-
参数
-
-
返回
-
OK on success.
◆
Set()
Result
<void> Set
|
(
|
T &&
|
data
|
)
|
|
Set or move a value into a
数据
.
-
参数
-
[in]
|
data
|
New value for this
数据
对象。
|
◆
Get()
[1/3]
Returns the value of type T of this
数据
.
-
Template Parameters
-
T
|
The expected type of the value.
|
-
返回
-
The value stored in this
数据
, or an error if this
数据
doesn't store a value of type T.
◆
Get()
[2/3]
◆
GetOrNull()
Returns the value of type T of this
数据
.
-
Template Parameters
-
T
|
The expected type of the value.
|
-
返回
-
The value stored in this
数据
, or a null value if this
数据
doesn't store a value of type T.
◆
Get()
[3/3]
T Get
|
(
|
const T &
|
defaultValue
|
)
|
const
|
Returns the value of type T of this
数据
.
-
参数
-
[in]
|
defaultValue
|
If this
数据
doesn't store a value of type T, the default value will be returned.
|
-
Template Parameters
-
T
|
The expected type of the value.
|
-
返回
-
The value stored in this
数据
, or defaultValue if this
数据
doesn't store a value of type T.
◆
Convert()
[1/2]
Returns the value of this
数据
, converted to T.
-
Template Parameters
-
T
|
The type to convert to.
|
-
返回
-
The value stored in this
数据
, converted to T, or an error if this
数据
doesn't store a value or the value cannot be converted to T.
-
另请参阅
-
DataType::Convert
◆
ConvertOrNull()
T ConvertOrNull
|
(
|
|
)
|
const
|
Returns the value of this
数据
, converted to T.
-
Template Parameters
-
T
|
The type to convert to.
|
-
返回
-
The value stored in this
数据
, converted to T, or T() if this
数据
doesn't store a value or the value cannot be converted to T.
-
另请参阅
-
DataType::Convert
◆
Convert()
[2/2]
T Convert
|
(
|
const T &
|
defaultValue
|
)
|
const
|
Returns the value of this
数据
, converted to T.
-
参数
-
[in]
|
defaultValue
|
If this
数据
doesn't store a value or the value cannot converted to T, the default value will be returned.
|
-
Template Parameters
-
T
|
The type to convert to.
|
-
返回
-
The value stored in this
数据
, converted to T, or defaultValue if this
数据
doesn't store a value or the value cannot be converted to T.
-
另请参阅
-
DataType::Convert
◆
ConvertData()
Returns the value of this
数据
, converted to destType.
-
参数
-
[in]
|
destType
|
The type to convert to.
|
-
返回
-
The value stored in this
数据
, converted to destType, or an error if this
数据
doesn't store a value or the value cannot be converted to dataType.
-
另请参阅
-
DataType::Convert
◆
GetPtr()
[1/3]
const T* GetPtr
|
(
|
|
)
|
const
|
Returns the pointer of the native data if its type matches the given type T, otherwise nullptr.
-
Template Parameters
-
-
返回
-
Pointer to the data in native format.
◆
GetPtr()
[2/3]
Generic* GetPtr
|
(
|
const
DataType
&
|
type
|
)
|
|
Returns the pointer of the native data if its type matches the given #type, otherwise nullptr.
-
参数
-
[in]
|
type
|
The desired type.
|
-
返回
-
Pointer to the data in native format.
◆
GetPtr()
[3/3]
const Generic* GetPtr
|
(
|
const
DataType
&
|
type
|
)
|
const
|
◆
PrivateGetPtr()
[1/2]
const Generic* PrivateGetPtr
|
(
|
|
)
|
const
|
Returns the pointer to the native data.
-
返回
-
Pointer to the data in native format.
◆
PrivateGetPtr()
[2/2]
const Generic* PrivateGetPtr
|
(
|
const
DataType
&
|
type
|
)
|
const
|
Returns the pointer to the native data. It is not checked if its type matches the given #type, the only purpose of the parameter is to enable a special behavior when #type is the type
数据
: Then a pointer to this
数据
object itself is returned.
-
参数
-
[in]
|
type
|
The desired type.
|
-
返回
-
Pointer to the data in native format.
◆
GetTuple()
[1/2]
Returns the value of this
数据
object as a
TupleValue
. If this object doesn't hold a tuple value, nullptr is returned.
-
返回
-
Pointer to the
TupleValue
stored in this object, or nullptr if no tuple value is stored.
◆
GetTuple()
[2/2]
Returns the value of this
数据
object as a
TupleValue
. If this object doesn't hold a tuple value, nullptr is returned.
-
返回
-
Pointer to the
TupleValue
stored in this object, or nullptr if no tuple value is stored.
◆
ToString()
Returns a readable string of the content.
-
参数
-
-
返回
-
The converted result.
◆
Compare()
Returns a readable string of the content.
-
返回
-
String
that represents the content of
数据
.
◆
GetHashCode()
Returns the hash code of the wrapped object. If the object's type doesn't provide a hash code function, this function returns 0.
-
返回
-
Hash code of this
数据
.
◆
IsEqual()
Returns true if the wrapped object of this
数据
equals that of the #other
数据
.
-
参数
-
[in]
|
other
|
Another
数据
object to compare.
|
[in]
|
equality
|
The equality mode, by default
EQUALITY::DEEP
.
|
-
返回
-
True if both
数据
objects are equal, false otherwise.
◆
operator==()
Bool
operator==
|
(
|
const
数据
&
|
other
|
)
|
const
|
==
==
◆
operator!=()
Bool
operator!=
|
(
|
const
数据
&
|
other
|
)
|
const
|
!=
!=
◆
operator<()
Bool
operator<
|
(
|
const
数据
&
|
other
|
)
|
const
|
<
<
◆
operator<=()
Bool
operator<=
|
(
|
const
数据
&
|
other
|
)
|
const
|
<=
<=
◆
operator>()
Bool
operator>
|
(
|
const
数据
&
|
other
|
)
|
const
|
>
>
◆
operator>=()
Bool
operator>=
|
(
|
const
数据
&
|
other
|
)
|
const
|
>=
>=
◆
ToConstDataPtr()
◆
CheckInstanceOf()
[1/2]
◆
CheckInstanceOf()
[2/2]
static const ObjectRef* CheckInstanceOf
|
(
|
const ObjectRef *
|
obj
,
|
|
|
const
DataType
&
|
type
|
|
)
|
|
|
|
static
private
|
◆
SetImpl()
◆
GetImpl()
[1/6]
◆
GetImpl()
[2/6]
◆
GetImpl()
[3/6]
◆
GetImpl()
[4/6]
◆
GetImpl()
[5/6]
◆
GetImpl()
[6/6]
◆
InitSet()
Friends And Related Function Documentation
◆
DataDictionaryInterface
◆
DataDictionaryObjectInterface
◆
ConstDataPtr
Member Data Documentation
◆
_typeInfo
pointer to the
DataType
structure
◆
_memBlock
placeholder for embedded data. this size must stay for compatibility reasons.