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

Public Member Functions

 XmlHighscoresLoader (const shared_ptr< AppConfig > &refAppConfig, const shared_ptr< XmlGameFiles > &refXmlGameFiles)
 
shared_ptr< HighscoregetHighscore (const std::string &sGameName, const AppPreferences &oPreferences, const shared_ptr< HighscoresDefinition > &refHighscoresDefinition) const noexcept override
 Get the highscore for the game (prefs) and the highscores definition. More...
 
bool updateHighscore (const std::string &sGameName, const AppPreferences &oPreferences, const Highscore &oHighscore) noexcept override
 Persist the highscores for a game. More...
 
std::vector< shared_ptr< Highscore > > getHighscores (const std::string &sGameName, const shared_ptr< HighscoresDefinition > &refHighscoresDefinition) const noexcept override
 Get all the currently available highscores for a game. More...
 
- Public Member Functions inherited from stmg::HighscoresLoader
virtual ~HighscoresLoader () noexcept=default
 

Constructor & Destructor Documentation

◆ XmlHighscoresLoader()

stmg::XmlHighscoresLoader::XmlHighscoresLoader ( const shared_ptr< AppConfig > &  refAppConfig,
const shared_ptr< XmlGameFiles > &  refXmlGameFiles 
)

Member Function Documentation

◆ getHighscore()

shared_ptr<Highscore> stmg::XmlHighscoresLoader::getHighscore ( const std::string &  sGameName,
const AppPreferences oPreferences,
const shared_ptr< HighscoresDefinition > &  refHighscoresDefinition 
) const
overridevirtualnoexcept

Get the highscore for the game (prefs) and the highscores definition.

Parameters
sGameNameThe game name. Cannot be empty.
oPreferencesThe preferences.
refHighscoresDefinitionThe highscores definition. Cannot be null.
Returns
The highscores or null if there's no highscore for the game (type).

Implements stmg::HighscoresLoader.

◆ getHighscores()

std::vector<shared_ptr<Highscore> > stmg::XmlHighscoresLoader::getHighscores ( const std::string &  sGameName,
const shared_ptr< HighscoresDefinition > &  refHighscoresDefinition 
) const
overridevirtualnoexcept

Get all the currently available highscores for a game.

Parameters
sGameNameThe game name. Cannot be empty.
refHighscoresDefinitionThe highscores definition. Cannot be null.
Returns
The highscores for the game.

Implements stmg::HighscoresLoader.

◆ updateHighscore()

bool stmg::XmlHighscoresLoader::updateHighscore ( const std::string &  sGameName,
const AppPreferences oPreferences,
const Highscore oHighscore 
)
overridevirtualnoexcept

Persist the highscores for a game.

Parameters
sGameNameThe game name. Cannot be empty.
oPreferencesThe preferences.
oHighscoreThe highscore.
Returns
Whether the update was successful.

Implements stmg::HighscoresLoader.