Pacman Torben Petré
Loading...
Searching...
No Matches
logic::ScoreEntry Struct Reference

#include <Score.h>

Public Member Functions

 ScoreEntry ()
 Default constructor initiates an empty object.
 ScoreEntry (std::string username, const int score)
 Constructs a new ScoreEntry object, populated with the provided values.
bool operator< (const ScoreEntry &other) const
 Accesses the score member variables and compares them.

Public Attributes

std::string username
int score

Detailed Description

Helper struct which links a username with a score. Also implements an override for the less than operator which is used to sort Highscore objects based on the score they hold.

Constructor & Destructor Documentation

◆ ScoreEntry() [1/2]

logic::ScoreEntry::ScoreEntry ( )
inline

Default constructor initiates an empty object.

◆ ScoreEntry() [2/2]

logic::ScoreEntry::ScoreEntry ( std::string username,
const int score )
inline

Constructs a new ScoreEntry object, populated with the provided values.

Parameters
usernameUsername of person with score
scoreScore

Member Function Documentation

◆ operator<()

bool logic::ScoreEntry::operator< ( const ScoreEntry & other) const
inline

Accesses the score member variables and compares them.

Parameters
otherOther ScoreEntry object for comparison
Returns
Whether the score of this is smaller than other

Member Data Documentation

◆ score

int logic::ScoreEntry::score

◆ username

std::string logic::ScoreEntry::username

The documentation for this struct was generated from the following file: