HoverRace  2.0
Public Types | Public Member Functions | Private Types | Private Attributes | List of all members
HoverRace::Client::RulebookLibrary Class Reference

The collection of all registered rulebooks. More...

#include <RulebookLibrary.h>

Public Types

using const_iterator = sorted_t::const_iterator
 
using value_type = sorted_t::value_type
 

Public Member Functions

 RulebookLibrary (Script::Core &scripting)
 
void Add (std::shared_ptr< Rulebook > &rulebook)
 
const_iterator begin () const
 
const_iterator cbegin () const
 
const_iterator cend () const
 
const_iterator end () const
 
std::shared_ptr< const RulebookFind (const std::string &name)
 Search for the Rulebook with the given name. More...
 
std::shared_ptr< const RulebookGetDefault () const
 Retrieve the default rulebook. More...
 
void Reload ()
 Run all rulebook scripts to re-populate the rulebook library. More...
 

Private Types

using sorted_t = std::set< std::shared_ptr< const Rulebook >, boost::less_pointees_t< std::shared_ptr< const Rulebook >>>
 

Private Attributes

std::shared_ptr< RulebookdefaultRulebook
 
std::map< std::string, std::shared_ptr< Rulebook > > library
 
Script::Corescripting
 
sorted_t sorted
 

Detailed Description

The collection of all registered rulebooks.

Author
Michael Imamura

Member Typedef Documentation

using HoverRace::Client::RulebookLibrary::const_iterator = sorted_t::const_iterator
using HoverRace::Client::RulebookLibrary::sorted_t = std::set< std::shared_ptr<const Rulebook>, boost::less_pointees_t<std::shared_ptr<const Rulebook>>>
private
using HoverRace::Client::RulebookLibrary::value_type = sorted_t::value_type

Constructor & Destructor Documentation

HoverRace::Client::RulebookLibrary::RulebookLibrary ( Script::Core scripting)

Member Function Documentation

void HoverRace::Client::RulebookLibrary::Add ( std::shared_ptr< Rulebook > &  rulebook)
const_iterator HoverRace::Client::RulebookLibrary::begin ( ) const
inline
const_iterator HoverRace::Client::RulebookLibrary::cbegin ( ) const
inline
const_iterator HoverRace::Client::RulebookLibrary::cend ( ) const
inline
const_iterator HoverRace::Client::RulebookLibrary::end ( ) const
inline
std::shared_ptr< const Rulebook > HoverRace::Client::RulebookLibrary::Find ( const std::string &  name)

Search for the Rulebook with the given name.

Parameters
nameThe name to search for (case-sensitive).
Returns
The requested Rulebook, or nullptr if there is no Rulebook with that name.
std::shared_ptr< const Rulebook > HoverRace::Client::RulebookLibrary::GetDefault ( ) const

Retrieve the default rulebook.

This is normally the "Race" rulebook, but if it's not defined, then the first rulebook in sorted order is returned instead. If no rulebooks are loaded, then a dummy rulebook will be returned.

Returns
The default rulebook (never null).
void HoverRace::Client::RulebookLibrary::Reload ( )

Run all rulebook scripts to re-populate the rulebook library.

Member Data Documentation

std::shared_ptr<Rulebook> HoverRace::Client::RulebookLibrary::defaultRulebook
private
std::map<std::string, std::shared_ptr<Rulebook> > HoverRace::Client::RulebookLibrary::library
private
Script::Core& HoverRace::Client::RulebookLibrary::scripting
private
sorted_t HoverRace::Client::RulebookLibrary::sorted
private

The documentation for this class was generated from the following files: