HoverRace  2.0
Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
HoverRace::Player::LocalProfile Class Reference

A profile that is stored on the local filesystem. More...

#include <LocalProfile.h>

+ Inheritance diagram for HoverRace::Player::LocalProfile:

Public Member Functions

 LocalProfile ()=delete
 
 LocalProfile (std::shared_ptr< AvatarGallery > avatarGallery)
 Constructor for a new local profile. More...
 
 LocalProfile (std::shared_ptr< AvatarGallery > avatarGallery, const boost::uuids::uuid &uid)
 Load a profile from the local filesystem. More...
 
virtual ~LocalProfile ()
 
EditableProfileEdit () override
 Retrieve an editable view of this profile. More...
 
RenamableProfileEditName () override
 Retrieve an renamable view of this profile. More...
 
std::shared_ptr< Display::Res< Display::Texture > > GetAvatar () const override
 Retrieve the user's avatar, if available. More...
 
bool isLoaded () const
 
- Public Member Functions inherited from HoverRace::Player::Profile
 Profile (std::shared_ptr< AvatarGallery > avatarGallery={})
 
 Profile (std::shared_ptr< AvatarGallery > avatarGallery, const boost::uuids::uuid &uid)
 
 Profile (std::shared_ptr< AvatarGallery > avatarGallery, const boost::uuids::uuid &uid, const std::string &name, const std::string &avatarName, Display::Color primaryColor, Display::Color secondaryColor)
 
virtual ~Profile ()
 
const std::string & GetAvatarName () const
 
Display::Color GetColor (size_t i) const
 Retrieve the color by index. More...
 
const std::string & GetName () const
 Retrieve the name of the player. More...
 
Display::Color GetPrimaryColor () const
 
Display::Color GetSecondaryColor () const
 
const boost::uuids::uuid & GetUid () const
 Retrieve the globally unique identifier for this profile. More...
 
const std::string GetUidStr () const
 Retrieve the UID as a string. More...
 
void SetColor (size_t i, Display::Color color) override
 Set the color by index. More...
 

Protected Member Functions

void Save () override
 
- Protected Member Functions inherited from HoverRace::Player::Profile
AvatarGalleryGetAvatarGallery () const
 
void Rename (const std::string &name) override
 Attempt to rename the profile. More...
 
void SetAvatarName (const std::string &avatarName) override
 
virtual void SetName (const std::string &name)
 
void SetPrimaryColor (Display::Color color) override
 
void SetSecondaryColor (Display::Color color) override
 

Private Types

using SUPER = Profile
 

Private Member Functions

void Load (Util::yaml::MapNode *root, const std::string &filename)
 

Private Attributes

bool loaded
 

Additional Inherited Members

- Static Public Attributes inherited from HoverRace::Player::Profile
static const size_t MAX_AVATAR_NAME_LENGTH = 16
 
static const size_t MAX_NAME_LENGTH = 30
 Maximum length for the name. More...
 

Detailed Description

A profile that is stored on the local filesystem.

Author
Michael Imamura

Member Typedef Documentation

Constructor & Destructor Documentation

HoverRace::Player::LocalProfile::LocalProfile ( )
delete
HoverRace::Player::LocalProfile::LocalProfile ( std::shared_ptr< AvatarGallery avatarGallery)

Constructor for a new local profile.

The new profile will be assigned a new unique UID.

Parameters
avatarGalleryThe source for built-in avatars (may be nullptr).
HoverRace::Player::LocalProfile::LocalProfile ( std::shared_ptr< AvatarGallery avatarGallery,
const boost::uuids::uuid &  uid 
)

Load a profile from the local filesystem.

Parameters
avatarGalleryThe source for built-in avatars (may be nullptr).
uidThe player UID.
Exceptions
ProfileExnThe profile could not be loaded.
virtual HoverRace::Player::LocalProfile::~LocalProfile ( )
inlinevirtual

Member Function Documentation

EditableProfile* HoverRace::Player::LocalProfile::Edit ( )
inlineoverridevirtual

Retrieve an editable view of this profile.

Returns
An editable profile backed by this profile, or nullptr if this profile cannot be edited.

Reimplemented from HoverRace::Player::Profile.

RenamableProfile* HoverRace::Player::LocalProfile::EditName ( )
inlineoverridevirtual

Retrieve an renamable view of this profile.

Returns
An editable profile backed by this profile, or nullptr if this profile cannot change the name.

Reimplemented from HoverRace::Player::Profile.

std::shared_ptr< Display::Res< Display::Texture > > HoverRace::Player::LocalProfile::GetAvatar ( ) const
overridevirtual

Retrieve the user's avatar, if available.

Returns
The avatar resource (may be nullptr).

Reimplemented from HoverRace::Player::Profile.

bool HoverRace::Player::LocalProfile::isLoaded ( ) const
inline
void HoverRace::Player::LocalProfile::Load ( Util::yaml::MapNode root,
const std::string &  filename 
)
private
void HoverRace::Player::LocalProfile::Save ( )
overrideprotectedvirtual

Member Data Documentation

bool HoverRace::Player::LocalProfile::loaded
private

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