stmm-games-doc  0.32.0
Public Member Functions | List of all members
stmg::XmlPreferencesLoader Class Reference
Inheritance diagram for stmg::XmlPreferencesLoader:
Inheritance graph
[legend]

Public Member Functions

 XmlPreferencesLoader (const shared_ptr< StdConfig > &refStdConfig, const shared_ptr< XmlGameFiles > &refXmlGameFiles)
 
shared_ptr< AllPreferencesgetPreferences () const noexcept override
 Load or create a new (or recycled) AllPreferences instance. More...
 
shared_ptr< AllPreferencesgetPreferencesCopy (const shared_ptr< AllPreferences > &refAllPreferences) const noexcept override
 Create a copy of an AllPreferences instance. More...
 
bool updatePreferences (const shared_ptr< AllPreferences > &refAllPreferences) noexcept override
 Persist an AllPreferences instance. More...
 
- Public Member Functions inherited from stmg::AllPreferencesLoader
virtual ~AllPreferencesLoader () noexcept=default
 

Constructor & Destructor Documentation

◆ XmlPreferencesLoader()

stmg::XmlPreferencesLoader::XmlPreferencesLoader ( const shared_ptr< StdConfig > &  refStdConfig,
const shared_ptr< XmlGameFiles > &  refXmlGameFiles 
)

Member Function Documentation

◆ getPreferences()

shared_ptr<AllPreferences> stmg::XmlPreferencesLoader::getPreferences ( ) const
overridevirtualnoexcept

Load or create a new (or recycled) AllPreferences instance.

If there is a persisted instance it is loaded, otherwise it is created with default values.

Returns
The instance. Is not null.

Implements stmg::AllPreferencesLoader.

◆ getPreferencesCopy()

shared_ptr<AllPreferences> stmg::XmlPreferencesLoader::getPreferencesCopy ( const shared_ptr< AllPreferences > &  refAllPreferences) const
overridevirtualnoexcept

Create a copy of an AllPreferences instance.

This function should be preferred over just using the copy constructor of the instance because it allows the loader to possibly recycle another instance.

Parameters
refAllPreferencesThe instance to copy from. Cannot be null.
Returns
The copy. Is not null.

Implements stmg::AllPreferencesLoader.

◆ updatePreferences()

bool stmg::XmlPreferencesLoader::updatePreferences ( const shared_ptr< AllPreferences > &  refAllPreferences)
overridevirtualnoexcept

Persist an AllPreferences instance.

Parameters
refAllPreferencesThe instance to persist. Cannot be null.
Returns
Whether the instance could be persisted.

Implements stmg::AllPreferencesLoader.