gpg::Player

#include <player.h>

A data structure that allows you to access data about a specific player.

Summary

Constructors and Destructors

Player()
Player(std::shared_ptr< const PlayerImpl > impl)
Constructs a Player from a shared_ptr to a PlayerImpl.
Player(const Player & copy_from)
Creates a copy of an existing Player.
Player(Player && move_from)
Moves an existing Player into a new one.
~Player()

Public functions

AvatarUrl(ImageResolution resolution) const
const std::string &
Returns the URL where the image of this Player's avatar resides.
CurrentLevel() const
const PlayerLevel &
Retrieves the current level data for this player, if known.
CurrentXP() const
uint64_t
Retrieves the player's current XP total.
HasLevelInfo() const
bool
Returns whether or not this player has level information available.
Id() const
const std::string &
Returns the Id of the currently signed-in player.
LastLevelUpTime() const
Retrieves the timestamp at which this player last leveled up.
Name() const
const std::string &
Returns the Google+ name of the currently signed-in player.
NextLevel() const
const PlayerLevel &
Retrieves the next level data for this player, if known.
Title() const
const std::string &
Retrieves the title of the player.
Valid() const
bool
Returns true when the returned player is populated with data and is accompanied by a successful response status; false for an unpopulated user-created player or for a populated one accompanied by an unsuccessful response status.
operator=(const Player & copy_from)
Player &
Assigns this Player by copying from another one.
operator=(Player && move_from)
Player &
Assigns this Player value by moving another one into it.

Public functions

AvatarUrl

const std::string & AvatarUrl(
  ImageResolution resolution
) const 

Returns the URL where the image of this Player's avatar resides.

The ImageResolution parameter specifies the resolution of the image. Player::Valid() must return true for this function to be usable.

CurrentLevel

const PlayerLevel & CurrentLevel() const 

Retrieves the current level data for this player, if known.

If HasLevelInfo() returns false, this will return a PlayerLevel object for which Valid() also returns false.

CurrentXP

uint64_t CurrentXP() const 

Retrieves the player's current XP total.

If HasLevelInfo() returns false, this will return zero. If HasLevelInfo() returns true, the player's current XP total will be in the range CurrentLevel().MinimumXP to CurrentLevel().MaximumXP.

HasLevelInfo

bool HasLevelInfo() const 

Returns whether or not this player has level information available.

If it returns false, CurrentLevel() and NextLevel() return PlayerLevel objects that are not valid.

Id

const std::string & Id() const 

Returns the Id of the currently signed-in player.

Player::Valid() must return true for this function to be usable.

LastLevelUpTime

Timestamp LastLevelUpTime() const 

Retrieves the timestamp at which this player last leveled up.

If HasLevelInfo() returns false, or if the player has never leveled up, this will return zero (the epoch).

Name

const std::string & Name() const 

Returns the Google+ name of the currently signed-in player.

Player::Valid() must return true for this function to be usable.

NextLevel

const PlayerLevel & NextLevel() const 

Retrieves the next level data for this player, if known.

If HasLevelInfo() returns false, this will return a PlayerLevel object for which Valid() also returns false. This is the level that the player is currently working towards. If the player is already at the maximum level they can reach, CurrentLevel() and NextLevel() will return identical values.

Player

 Player()

Player

 Player(
  std::shared_ptr< const PlayerImpl > impl
)

Constructs a Player from a shared_ptr to a PlayerImpl.

Intended for internal use by the API.

Player

 Player(
  const Player & copy_from
)

Creates a copy of an existing Player.

Player

 Player(
  Player && move_from
)

Moves an existing Player into a new one.

Title

const std::string & Title() const 

Retrieves the title of the player.

This is based on actions the player has taken across the Google Play games ecosystem. Note that not all players have titles, and that a player's title may change over time. If a player does not have a title, Title() will return an empty string.

Valid

bool Valid() const 

Returns true when the returned player is populated with data and is accompanied by a successful response status; false for an unpopulated user-created player or for a populated one accompanied by an unsuccessful response status.

It must return true for the getter functions on this object to be usable.

operator=

Player & operator=(
  const Player & copy_from
)

Assigns this Player by copying from another one.

operator=

Player & operator=(
  Player && move_from
)

Assigns this Player value by moving another one into it.

~Player

 ~Player()