Player12
An open source football management simulator
Loading...
Searching...
No Matches
roles.h File Reference
#include <cstdint>
#include <string_view>
#include <unordered_map>

Go to the source code of this file.

Enumerations

enum class  Role : uint8_t {
  GKP , CB , LB , RB ,
  LWB , RWB , CDM , CM ,
  CAM , LM , RM , LWM ,
  RWM , ST , CF , LW ,
  RW , LF , RF
}
 Represents the positional role of a player on the field. More...
 

Variables

const std::unordered_map< std::string_view, Role > strToRole
 Maps a string representation of a role to its Role enum value. Used for parsing input.
 
const std::unordered_map< Role, std::string_view > roleToStr
 Maps a Role enum value to its string representation.
 

Enumeration Type Documentation

◆ Role

enum class Role : uint8_t
strong

Represents the positional role of a player on the field.

Enumerator
GKP 

Goalkeeper

CB 

Center Back

LB 

Left Back

RB 

Right Back

LWB 

Left Wing Back

RWB 

Right Wing Back

CDM 

Central Defensive Midfielder

CM 

Central Midfielder

CAM 

Central Attacking Midfielder

LM 

Left Midfielder

RM 

Right Midfielder

LWM 

Left Wing Midfielder

RWM 

Right Wing Midfielder

ST 

Striker

CF 

Center Forward

LW 

Left Winger

RW 

Right Winger

LF 

Left Forward

RF 

Right Forward

Variable Documentation

◆ roleToStr

const std::unordered_map<Role, std::string_view> roleToStr
inline
Initial value:
{
{Role::GKP, "GKP"}, {Role::CB, "CB"}, {Role::LB, "LB"},
{Role::RB, "RB"}, {Role::LWB, "LWB"}, {Role::RWB, "RWB"},
{Role::CDM, "CDM"}, {Role::CM, "CM"}, {Role::CAM, "CAM"},
{Role::LM, "LM"}, {Role::RM, "RM"}, {Role::LWM, "LWM"},
{Role::RWM, "RWM"}, {Role::ST, "ST"}, {Role::CF, "CF"},
{Role::LW, "LW"}, {Role::RW, "RW"}, {Role::LF, "LF"},
{Role::RF, "RF"}}

Maps a Role enum value to its string representation.

◆ strToRole

const std::unordered_map<std::string_view, Role> strToRole
inline
Initial value:
{
{"GKP", Role::GKP}, {"CB", Role::CB}, {"LB", Role::LB},
{"RB", Role::RB}, {"LWB", Role::LWB}, {"RWB", Role::RWB},
{"CDM", Role::CDM}, {"CM", Role::CM}, {"CAM", Role::CAM},
{"LM", Role::LM}, {"RM", Role::RM}, {"LWM", Role::LWM},
{"RWM", Role::RWM}, {"ST", Role::ST}, {"CF", Role::CF},
{"LW", Role::LW}, {"RW", Role::RW}, {"LF", Role::LF},
{"RF", Role::RF}}

Maps a string representation of a role to its Role enum value. Used for parsing input.