Loading Data Descriptions

About

Data descriptions list the attributes of MAXON API component. Such a description is created using the Resource Editor and saved to a *.json file.

To use the description, a plugin must load tihs file on program start.

Loading Descriptions

A description can be loaded and freed using MAXON_INITIALIZATION(). The description file can be stored in the plugins "res" folder which can be obtaind using maxon::Application::GetUrl().

The description is then loaded using maxon::DataDescriptionDefinitionDatabaseInterface::RegisterDatabaseWithUrl(). At the end, the description is freed using maxon::DataDescriptionDefinitionDatabaseInterface::UnregisterDatabase().

// This exampe shows how to load a description database.
static maxon::Id g_pluginDatabase = maxon::Id { "net.maxonexample.plugin.database" };
// loads resources in the beginning
static maxon::Result<void> LoadResources()
{
{
err.DiagOutput();
err.CritStop();
return err;
};
// get plugin res folder
// register database
return maxon::OK;
}
// frees resources at the end
static void FreeResources()
{
{
err.DiagOutput();
err.CritStop();
return;
};
// Unregister all descriptions.
}
MAXON_INITIALIZATION(LoadResources, FreeResources);
static MAXON_FUNCTION Result< Url > GetUrl(APPLICATION_URLTYPE urlType)
static MAXON_METHOD Result< void > RegisterDatabaseWithUrl(const Id &databaseId, const Url &url, const CString &version=CString::NullValue())
static MAXON_METHOD Result< void > UnregisterDatabase(const Id &databaseId)
Definition: apibaseid.h:253
Definition: url.h:952
return OK
Definition: apibase.h:2690
#define MAXON_INITIALIZATION(...)
Definition: module.h:795
@ CURRENT_MODULE_RESOURCE_DIR
Resource directory of the module that invoked this call.
#define iferr_scope_handler
Definition: resultbase.h:1402
#define iferr_return
Definition: resultbase.h:1519

Further Reading