Application Class Reference

#include <application.h>

Detailed Description

Application wide functions. Implement this interface to be able to link against the kernel library.

Public Member Functions

 MAXON_OBSERVABLE_STATIC (Result< Bool >, ObservableApplicationMessage,(const Id &messageId, const DataDictionary &messageData), ObservableCombinerRunAllBoolUntilFalse)
 

Static Public Member Functions

static MAXON_FUNCTION Result< UrlGetUrl (APPLICATION_URLTYPE urlType, const Char *maxonModuleID=MAXON_MODULE_ID)
 
static MAXON_METHOD Result< UrlGetTempUrl (const Url &directory)
 
static MAXON_METHOD Result< BaseArray< Url > > GetModulePaths ()
 
static MAXON_METHOD Int GetCommandLineArgCount ()
 
static MAXON_METHOD String GetCommandLineArg (Int idx)
 
static MAXON_METHOD DataDictionary GetMachineInfo ()
 
static MAXON_METHOD APPLICATIONMODE GetApplicationMode ()
 
static MAXON_METHOD Bool SetApplicationMode (APPLICATIONMODE mode)
 
static MAXON_METHOD Bool GetFeature (APPLICATIONFEATURE feature)
 
static MAXON_METHOD void SetFeature (APPLICATIONFEATURE feature, Bool value)
 
static MAXON_METHOD Result< void > GetVersion (Int &version, String &buildID)
 
static MAXON_METHOD String FormatVersionString (Int rawVersionNumber)
 
static MAXON_METHOD Result< void > RegisterSystemUrlSchemeHandler (const Id &urlScheme, Bool reassignApplication, Delegate< void(const Url &)> &&callback)
 
static MAXON_METHOD Bool CheckSystemUrlSchemeHandlerIsCurrent (const Id &urlScheme)
 

Static Protected Member Functions

static MAXON_METHOD Result< UrlPrivateGetUrl (APPLICATION_URLTYPE urlType, const Char *maxonModuleID, const Binary &currentModule)
 

Private Member Functions

 MAXON_INTERFACE_NONVIRTUAL (Application, MAXON_REFERENCE_STATIC, "net.maxon.interface.application", MAXON_IMPLEMENTATION_MODULE("net.maxon.kernel"))
 

Member Function Documentation

◆ MAXON_INTERFACE_NONVIRTUAL()

MAXON_INTERFACE_NONVIRTUAL ( Application  ,
MAXON_REFERENCE_STATIC  ,
"net.maxon.interface.application"  ,
MAXON_IMPLEMENTATION_MODULE("net.maxon.kernel")   
)
private

◆ GetUrl()

static MAXON_FUNCTION Result<Url> GetUrl ( APPLICATION_URLTYPE  urlType,
const Char maxonModuleID = MAXON_MODULE_ID 
)
static

Returns the requested url.

Parameters
[in]urlTypeType of the url, see APPLICATION_URLTYPE.
Returns
Url containing the requested.

◆ GetTempUrl()

static MAXON_METHOD Result<Url> GetTempUrl ( const Url directory)
static

Returns a new unique url for a temporary file. A typical use for this is Url tempfile = Application::GetTempUrl(tempDirectory);

Parameters
[in]directoryDirectory url where the temporary file should be created in.
Returns
Url pointing to the temporary file.

◆ GetModulePaths()

static MAXON_METHOD Result<BaseArray<Url> > GetModulePaths ( )
static

Returns all module paths configured through g_modulePath, g_additionalModulePath and user preferences.

Returns
Array containing all paths that are searched for modules.

◆ GetCommandLineArgCount()

static MAXON_METHOD Int GetCommandLineArgCount ( )
static

Returns the number of command line arguments delivered to the app on startup.

Returns
Number of arguments to request via GetCommandLineArg().

◆ GetCommandLineArg()

static MAXON_METHOD String GetCommandLineArg ( Int  idx)
static

Returns a command line argument.

Parameters
[in]idxThe index of the argument. (0 >= idx < GetCommandLineArgCount()).
Returns
The requested argument.

◆ GetMachineInfo()

static MAXON_METHOD DataDictionary GetMachineInfo ( )
static

Returns information about the system and processor. See maxon::MACHINEINFO for DataDictionary properties.

◆ GetApplicationMode()

static MAXON_METHOD APPLICATIONMODE GetApplicationMode ( )
static

Retrieves the current application mode. This mode defines the behavior after the startup is done.

Returns
The current application mode.

◆ SetApplicationMode()

static MAXON_METHOD Bool SetApplicationMode ( APPLICATIONMODE  mode)
static

Sets a new application mode. This mode defines the behavior after the startup is done. Please note that it's only possible to raise the mode from APPLICATIONMODE::DONTWAIT to APPLICATIONMODE::KEEPRUNNING.

Parameters
[in]modeThe new mode to be set.
Returns
True if the function changed the mode successfully.

◆ GetFeature()

static MAXON_METHOD Bool GetFeature ( APPLICATIONFEATURE  feature)
static

◆ SetFeature()

static MAXON_METHOD void SetFeature ( APPLICATIONFEATURE  feature,
Bool  value 
)
static
Parameters
[in]featureThe feature to set or clear.
[in]valueThe value of the feature

◆ GetVersion()

static MAXON_METHOD Result<void> GetVersion ( Int version,
String buildID 
)
static

Gets the version number and build ID.

Parameters
[out]versionThe version number will be assigned to this value.
[out]buildIDVariable that will hold the buildID.

◆ FormatVersionString()

static MAXON_METHOD String FormatVersionString ( Int  rawVersionNumber)
static

Formats the Int version returned by GetVersion() into a string with the 2023 (and later) format

Parameters
[in]rawVersionNumberThe version to be formatted.
Returns
The formatted string.

◆ MAXON_OBSERVABLE_STATIC()

MAXON_OBSERVABLE_STATIC ( Result< Bool ,
ObservableApplicationMessage  ,
(const Id &messageId, const DataDictionary &messageData)  ,
ObservableCombinerRunAllBoolUntilFalse   
)

ObservableDatabaseRegistrationChange after a database was added or removed to the system. This can be used to update editors.

◆ RegisterSystemUrlSchemeHandler()

static MAXON_METHOD Result<void> RegisterSystemUrlSchemeHandler ( const Id urlScheme,
Bool  reassignApplication,
Delegate< void(const Url &)> &&  callback 
)
static

RegisterSystemUrlSchemeHandler description. Depending on the operating system you can specify if the current application is the receiving application (e.g. windows). OSX for instance handles this on it's own and the application is always the receiving application.

Parameters
[in]urlSchemeUrl scheme to register e.g. "c4d" to open all urls starting with "c4d://"
[in]reassignApplicationTrue if the application should be reassigned to the url scheme handler. False just register the handler in case the application is the receiving instance.
[in]callbackCallback which is triggered if the url protocol handler receives the url
Returns
OK on success.

◆ CheckSystemUrlSchemeHandlerIsCurrent()

static MAXON_METHOD Bool CheckSystemUrlSchemeHandlerIsCurrent ( const Id urlScheme)
static

Check if the current application is assigned to the system url scheme handler for the given url scheme.

Parameters
[in]urlSchemeUrl scheme to check e.g "c4d".
Returns
True if the current application is the system url scheme handler for the given url scheme

◆ PrivateGetUrl()

static MAXON_METHOD Result<Url> PrivateGetUrl ( APPLICATION_URLTYPE  urlType,
const Char maxonModuleID,
const Binary &  currentModule 
)
staticprotected