HoverRace  2.0
Public Member Functions | Static Public Attributes | Protected Member Functions | Private Attributes | List of all members
HoverRace::Player::Profile Class Referenceabstract

Base class for player profiles. More...

#include <Profile.h>

+ Inheritance diagram for HoverRace::Player::Profile:

Public Member Functions

 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 ()
 
virtual EditableProfileEdit ()
 Retrieve an editable view of this profile. More...
 
virtual RenamableProfileEditName ()
 Retrieve an renamable view of this profile. More...
 
virtual std::shared_ptr< Display::Res< Display::Texture > > GetAvatar () const
 Retrieve the user's avatar, if available. More...
 
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...
 

Static Public Attributes

static const size_t MAX_AVATAR_NAME_LENGTH = 16
 
static const size_t MAX_NAME_LENGTH = 30
 Maximum length for the name. More...
 

Protected Member Functions

AvatarGalleryGetAvatarGallery () const
 
void Rename (const std::string &name) override
 Attempt to rename the profile. More...
 
virtual void Save ()=0
 
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 Attributes

std::shared_ptr< AvatarGalleryavatarGallery
 
std::string avatarName
 
std::string name
 
Display::Color primaryColor
 
Display::Color secondaryColor
 
boost::uuids::uuid uid
 

Detailed Description

Base class for player profiles.

Author
Michael Imamura

Constructor & Destructor Documentation

HoverRace::Player::Profile::Profile ( std::shared_ptr< AvatarGallery avatarGallery = {})
HoverRace::Player::Profile::Profile ( std::shared_ptr< AvatarGallery avatarGallery,
const boost::uuids::uuid &  uid 
)
inline
HoverRace::Player::Profile::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 
)
inline
virtual HoverRace::Player::Profile::~Profile ( )
inlinevirtual

Member Function Documentation

virtual EditableProfile* HoverRace::Player::Profile::Edit ( )
inlinevirtual

Retrieve an editable view of this profile.

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

Reimplemented in HoverRace::Player::LocalProfile.

virtual RenamableProfile* HoverRace::Player::Profile::EditName ( )
inlinevirtual

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 in HoverRace::Player::LocalProfile.

std::shared_ptr< Display::Res< Display::Texture > > HoverRace::Player::Profile::GetAvatar ( ) const
virtual

Retrieve the user's avatar, if available.

Returns
The avatar resource (may be nullptr).

Reimplemented in HoverRace::Player::LocalProfile, and HoverRace::Player::DemoProfile.

AvatarGallery* HoverRace::Player::Profile::GetAvatarGallery ( ) const
inlineprotected
const std::string& HoverRace::Player::Profile::GetAvatarName ( ) const
inline
Display::Color HoverRace::Player::Profile::GetColor ( size_t  i) const

Retrieve the color by index.

Parameters
iThe color index (starts at zero).
Returns
The color at the index.
const std::string& HoverRace::Player::Profile::GetName ( ) const
inline

Retrieve the name of the player.

Returns
The name (never empty).
Display::Color HoverRace::Player::Profile::GetPrimaryColor ( ) const
inline
Display::Color HoverRace::Player::Profile::GetSecondaryColor ( ) const
inline
const boost::uuids::uuid& HoverRace::Player::Profile::GetUid ( ) const
inline

Retrieve the globally unique identifier for this profile.

Returns
The ID (may be nil if uninitialized).
const std::string HoverRace::Player::Profile::GetUidStr ( ) const

Retrieve the UID as a string.

Returns
The UID (never blank).
void HoverRace::Player::Profile::Rename ( const std::string &  name)
inlineoverrideprotectedvirtual

Attempt to rename the profile.

This implies saving the profile.

Parameters
nameThe new name (may not be blank).

Implements HoverRace::Player::RenamableProfile.

virtual void HoverRace::Player::Profile::Save ( )
protectedpure virtual
void HoverRace::Player::Profile::SetAvatarName ( const std::string &  avatarName)
overrideprotectedvirtual
void HoverRace::Player::Profile::SetColor ( size_t  i,
Display::Color  color 
)
overridevirtual

Set the color by index.

Parameters
iThe color index (starts at zero).
colorThe color to set.

Implements HoverRace::Player::EditableProfile.

void HoverRace::Player::Profile::SetName ( const std::string &  name)
protectedvirtual
void HoverRace::Player::Profile::SetPrimaryColor ( Display::Color  color)
overrideprotectedvirtual
void HoverRace::Player::Profile::SetSecondaryColor ( Display::Color  color)
overrideprotectedvirtual

Member Data Documentation

std::shared_ptr<AvatarGallery> HoverRace::Player::Profile::avatarGallery
private
std::string HoverRace::Player::Profile::avatarName
private
const size_t HoverRace::Player::Profile::MAX_AVATAR_NAME_LENGTH = 16
static
const size_t HoverRace::Player::Profile::MAX_NAME_LENGTH = 30
static

Maximum length for the name.

Length is in Unicode code points (not bytes!).

std::string HoverRace::Player::Profile::name
private
Display::Color HoverRace::Player::Profile::primaryColor
private
Display::Color HoverRace::Player::Profile::secondaryColor
private
boost::uuids::uuid HoverRace::Player::Profile::uid
private

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