Resource Class Reference

#include <stringresource.h>

Detailed Description

Class that handles resources.

Public Member Functions

 MAXON_OBSERVABLE_STATIC (void, ObservableLanguageChanged,(const LanguageRef &oldLanguage, const LanguageRef &newLanguage), ObservableCombinerRunAllComponent)
 

Static Public Member Functions

static MAXON_METHOD LanguageRef GetDefaultLanguage ()
 
static MAXON_METHOD LanguageRef GetCurrentLanguage ()
 
static MAXON_METHOD LanguageRef FindLanguage (const Id &identifier)
 
static MAXON_METHOD Result< void > SetCurrentLanguage (const LanguageRef &language)
 
static MAXON_METHOD Result< BaseArray< LanguageRef > > GetAllLanguages ()
 
static MAXON_METHOD String LoadResourceString (const Id &scope, const InternedId &keyValue)
 
static MAXON_METHOD Result< void > WriteLanguagePrf (const LanguageRef &language)
 

Private Member Functions

 MAXON_INTERFACE_NONVIRTUAL (Resource, MAXON_REFERENCE_STATIC, "net.maxon.interface.resource", MAXON_IMPLEMENTATION_MODULE("net.maxon.kernel"))
 

Member Function Documentation

◆ MAXON_INTERFACE_NONVIRTUAL()

MAXON_INTERFACE_NONVIRTUAL ( Resource  ,
MAXON_REFERENCE_STATIC  ,
"net.maxon.interface.resource"  ,
MAXON_IMPLEMENTATION_MODULE("net.maxon.kernel")   
)
private

◆ GetDefaultLanguage()

static MAXON_METHOD LanguageRef GetDefaultLanguage ( )
static

Returns the default language (normally english).

Returns
The language.

◆ GetCurrentLanguage()

static MAXON_METHOD LanguageRef GetCurrentLanguage ( )
static

Returns the language that is currently used.

Returns
The language.

◆ FindLanguage()

static MAXON_METHOD LanguageRef FindLanguage ( const Id identifier)
static

Finds for a given identifier (e.g. en-US) the language.

Parameters
[in]identifierThe language Id.
Returns
The language.

◆ SetCurrentLanguage()

static MAXON_METHOD Result<void> SetCurrentLanguage ( const LanguageRef &  language)
static

Sets the current language.

Parameters
[in]languageThe language.
Returns
OK on success.

◆ GetAllLanguages()

static MAXON_METHOD Result<BaseArray<LanguageRef> > GetAllLanguages ( )
static

Retrieves an array of all available languages.

Returns
Array with all languages on success.

◆ LoadResourceString()

static MAXON_METHOD String LoadResourceString ( const Id scope,
const InternedId keyValue 
)
static

Loads a string from the resource. Other than the member of LanguageRef this routine tries to load it from the current language first and -if that fails- from the default language.

Parameters
[in]scopeThe resource scope of a resource symbol.
[in]keyValueThe value of a resource symbol.
Returns
String.

◆ WriteLanguagePrf()

static MAXON_METHOD Result<void> WriteLanguagePrf ( const LanguageRef &  language)
static

Writes the language preference file.

Parameters
[in]languageThe language.
Returns
OK on success.

◆ MAXON_OBSERVABLE_STATIC()

MAXON_OBSERVABLE_STATIC ( void  ,
ObservableLanguageChanged  ,
(const LanguageRef &oldLanguage, const LanguageRef &newLanguage)  ,
ObservableCombinerRunAllComponent   
)