数据

描述 Categories and Keys

内容表

关于

Data descriptions are separated into three different categories:

The information of a data description is stored as a maxon::DataDictionary. The settings stored in these dictionaries is accessed with pre-defined resource IDs (see Resource IDs ).

// 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()); } }

Categories

数据

The resource IDs for basic data description settings are define in these namespaces:

For convenience one can use maxon::GetDefaultValueKey() to get the ID of maxon::DESCRIPTION::DATA::BASE::DEFAULTVALUE

String

String resource IDs are in defined in maxon::DESCRIPTION::STRING::BASE :

UI

UI resource IDs are in defined in these namespaces:

延伸阅读

static MAXON_METHOD Result< DataDescription > LoadDescription(const Id &category, const LanguageRef &language, const Id &dataType)
static MAXON_METHOD LanguageRef GetDefaultLanguage()
#define ifnoerr(...)
The opposite of iferr.
定义: errorbase.h:385
定义: string.h:1197
定义: datatypebase.h:1143
定义: apibaseid.h:250
#define iferr_return
定义: resultbase.h:1434
Result< typename std::conditional< GetCollectionKind< T >::value==COLLECTION_KIND::ARRAY, T, typename ByValueParam< T >::type >::type > Get() const
定义: datatypebase.h:1352
#define DiagnosticOutput(formatString,...)
定义: debugdiagnostics.h:166
const Id DATADESCRIPTION_CATEGORY_DATA
定义: datadescriptiondatabase.h:17
const Id DATADESCRIPTION_CATEGORY_STRING
定义: datadescriptiondatabase.h:19
定义: datatypelib.h:26
@ DEFAULTVALUE
Dummy value for the default value GeData constructor.
定义: c4d_gedata.h:65
const Id & Get() const
定义: datatypelib.h:138
const Id & Get() const
定义: apibaseid.h:183

Copyright  © 2014-2025 乐数软件    

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