DataDescription Manual

内容表

关于

A DataDescription contains settings that describe the attributes of a data type. While a maxon::DataDescriptionDefinitionInterface contains the "raw" definition the maxon::DataDescriptionInterface includes the complete, resolved description.

描述

The data in a DataDescription is stored as a DataDictionary.

General information ( maxon::DESCRIPTION::DATA::INFO ) is accessed with:

The various attribute descriptions in the description are stored as DataDictionaries:

// This example loads the description of the given data type and prints the attributes to the console.

// data type ID const maxon::Id dataType { "net.maxonexample.class.descriptionElement" };

// load description data maxon::Id category = maxon::DATADESCRIPTION_CATEGORY_DATA ; const maxon::DataDescription descriptionData = maxon::DataDescriptionDatabaseInterface::LoadDescription (category, maxon::LanguageRef(), dataType) iferr_return ;

// load description string data category = maxon::DATADESCRIPTION_CATEGORY_STRING ; const maxon::LanguageRef language = maxon::Resource::GetDefaultLanguage (); const maxon::DataDescription descriptionStrings = maxon::DataDescriptionDatabaseInterface::LoadDescription (category, language, dataType) iferr_return ;

// list all attributes

const auto attributes = descriptionData.GetEntries() iferr_return ;
for ( const maxon::DataDictionary& attribute : attributes) { // get attribute settings const maxon::InternedId ID = attribute. Get (maxon::DESCRIPTION::BASE::IDENTIFIER) iferr_return ; const maxon::Id attributeDataType = attribute. Get (maxon::DESCRIPTION::DATA::BASE::DATATYPE) iferr_return ; const maxon::Data defaultData = attribute. Get ( maxon::DESCRIPTION::DATA::BASE::DEFAULTVALUE ) iferr_return ; DiagnosticOutput ( "Attribute \"@\" of type @. Default value: @" , ID, attributeDataType, defaultData);

// get localized attribute name ifnoerr ( const maxon::DataDictionary attributeString = descriptionStrings.GetEntry(ID)) { const maxon::String translatedString = attributeString.Get(maxon::DESCRIPTION::STRING::BASE::TRANSLATEDSTRING) iferr_return ; DiagnosticOutput ( "Name: \"@\" (@)" , translatedString, language.GetName()); } }

It is possible to compare two descriptions with:

数据库

The data descriptions are stored in the maxon::DataDescriptionDatabaseInterface database.

// This example lists all registered data descriptions and the number of defined attributes.

// get all registered descriptions const maxon::Id category = maxon::DATADESCRIPTION_CATEGORY_DATA ; const maxon::Id descriptionID { "net.maxonexample.class.descriptionElement" };

// load description const maxon::DataDescription description = maxon::DataDescriptionDatabaseInterface::LoadDescription (category, maxon::LanguageRef(), descriptionID) iferr_return ;

// get number of attributes const maxon::Int count = description.GetEntryCount(); DiagnosticOutput ( "Data type @ has @ attributes." , descriptionID, count);

延伸阅读

maxon::DataDescriptionDatabaseInterface::LoadDescription
static MAXON_METHOD Result< DataDescription > LoadDescription(const Id &category, const LanguageRef &language, const Id &dataType)
maxon::Resource::GetDefaultLanguage
static MAXON_METHOD LanguageRef GetDefaultLanguage()
ifnoerr
#define ifnoerr(...)
The opposite of iferr.
定义: errorbase.h:385
maxon::String
定义: string.h:1197
maxon::Data
定义: datatypebase.h:1143
maxon::Id
定义: apibaseid.h:250
iferr_return
#define iferr_return
定义: resultbase.h:1434
maxon::Data::Get
Result< typename std::conditional< GetCollectionKind< T >::value==COLLECTION_KIND::ARRAY, T, typename ByValueParam< T >::type >::type > Get() const
定义: datatypebase.h:1352
DiagnosticOutput
#define DiagnosticOutput(formatString,...)
定义: debugdiagnostics.h:166
maxon::DATADESCRIPTION_CATEGORY_DATA
const Id DATADESCRIPTION_CATEGORY_DATA
定义: datadescriptiondatabase.h:17
maxon::DATADESCRIPTION_CATEGORY_STRING
const Id DATADESCRIPTION_CATEGORY_STRING
定义: datadescriptiondatabase.h:19
maxon::Int
Int64 Int
signed 32/64 bit int, size depends on the platform
定义: apibase.h:184
maxon::InternedId
定义: datatypelib.h:26
DEFAULTVALUE
@ DEFAULTVALUE
Dummy value for the default value GeData constructor.
定义: c4d_gedata.h:65
maxon::InternedId::Get
const Id & Get() const
定义: datatypelib.h:138
maxon::LiteralId::Get
const Id & Get() const
定义: apibaseid.h:183

Copyright  © 2014-2025 乐数软件    

工业和信息化部: 粤ICP备14079481号-1