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

Classes

struct  GameInfo
 

Public Member Functions

virtual ~GameLoader () noexcept=default
 
virtual const std::string & getDefaultGameName () const noexcept=0
 The default game name. More...
 
virtual const std::vector< std::string > & getGameNames () noexcept=0
 The game names supported by this loader. More...
 
virtual std::vector< std::string > getGameNames (const AppPreferences &oAppPreferences) noexcept=0
 The game names supported by this loader that satisfy the preferences. More...
 
virtual const GameInfogetGameInfo (const std::string &sGameName) noexcept=0
 The game information by name. More...
 
virtual std::pair< shared_ptr< Game >, bool > getNewGame (const std::string &sGameName, GameOwner &oGameOwner, const shared_ptr< AppPreferences > &refAppPreferences, const Named &oThemeNamed, const shared_ptr< Highscore > &refHighscore) noexcept=0
 Get a new game. More...
 

Constructor & Destructor Documentation

◆ ~GameLoader()

virtual stmg::GameLoader::~GameLoader ( )
virtualdefaultnoexcept

Member Function Documentation

◆ getDefaultGameName()

virtual const std::string& stmg::GameLoader::getDefaultGameName ( ) const
pure virtualnoexcept

The default game name.

Returns
The default game name. Can be empty.

Implemented in stmg::XmlGameLoader.

◆ getGameInfo()

virtual const GameInfo& stmg::GameLoader::getGameInfo ( const std::string &  sGameName)
pure virtualnoexcept

The game information by name.

Parameters
sGameNameThe name. The game must exist. Cannot be empty.
Returns
The game information.

Implemented in stmg::XmlGameLoader.

◆ getGameNames() [1/2]

virtual const std::vector<std::string>& stmg::GameLoader::getGameNames ( )
pure virtualnoexcept

The game names supported by this loader.

Returns
The (unique) non-empty names of the games.

Implemented in stmg::XmlGameLoader.

◆ getGameNames() [2/2]

virtual std::vector<std::string> stmg::GameLoader::getGameNames ( const AppPreferences oAppPreferences)
pure virtualnoexcept

The game names supported by this loader that satisfy the preferences.

Parameters
oAppPreferencesThe preferences.
Returns
The (unique) non-empty names of the games.

Implemented in stmg::XmlGameLoader.

◆ getNewGame()

virtual std::pair<shared_ptr<Game>, bool> stmg::GameLoader::getNewGame ( const std::string &  sGameName,
GameOwner oGameOwner,
const shared_ptr< AppPreferences > &  refAppPreferences,
const Named oThemeNamed,
const shared_ptr< Highscore > &  refHighscore 
)
pure virtualnoexcept

Get a new game.

If null is returned and error string in GameInfo is empty, it means the game is not compatible with the given preferences.

If parameter refHighscore is not null, it must have been created by the GameInfo::m_refHighscoresDefinition of the game.

Parameters
sGameNameThe name of the game (which must exist) or empty if loader should choose.
oGameOwnerThe owner of the game.
refAppPreferencesThe preferences. Cannot be null.
oThemeNamedThe theme named from which game makes a copy.
refHighscoreThe highscores for the game (and current preferences). Can be null,
Returns
The game and whether the highscores were ignored or null if could not load.

Implemented in stmg::XmlGameLoader.