5 #include <boost/any.hpp>
7 #include "../GbxRemote/Response/GbxResponse.h"
8 #include "../Utils/Parameter.h"
57 Map(std::map<std::string, GbxResponseParameter> serverStruct)
59 if(serverStruct.find(
"UId") != serverStruct.end())
70 void MapDetailed(std::map<std::string, GbxResponseParameter> serverStruct)
72 if(serverStruct.find(
"Mood") != serverStruct.end())
122 Additionals.insert(std::pair<std::string, boost::any>(key, value));
132 void setBasicInfo(std::map<std::string, GbxResponseParameter> serverStruct)
134 UId = serverStruct.find(
"UId")->second.GetString();
135 Name = serverStruct.find(
"Name")->second.GetString();
136 FileName = serverStruct.find(
"FileName")->second.GetString();
137 Environment = serverStruct.find(
"Environnement")->second.GetString();
138 Author = serverStruct.find(
"Author")->second.GetString();
140 GoldTime = atoi(serverStruct.find(
"GoldTime")->second.GetString().c_str());
141 CopperPrice = atoi(serverStruct.find(
"CopperPrice")->second.GetString().c_str());
143 MapType = serverStruct.find(
"MapType")->second.GetString();
144 MapStyle = serverStruct.find(
"MapStyle")->second.GetString();
156 Mood = serverStruct.find(
"Mood")->second.GetString();
157 BronzeTime = atoi(serverStruct.find(
"BronzeTime")->second.GetString().c_str());
158 SilverTime = atoi(serverStruct.find(
"SilverTime")->second.GetString().c_str());
159 AuthorTime = atoi(serverStruct.find(
"AuthorTime")->second.GetString().c_str());
161 std::istringstream(serverStruct.find(
"LapRace")->second.GetString()) >>
LapRace;
162 NbLaps = atoi(serverStruct.find(
"NbLaps")->second.GetString().c_str());
163 NbCheckpoints = atoi(serverStruct.find(
"NbCheckpoints")->second.GetString().c_str());
void setBasicInfo(std::map< std::string, GbxResponseParameter > serverStruct)
Sets the basic map information from the struct.
Definition: Map.h:132
Map()
Constructs a Map object without input.
Definition: Map.h:47
std::string Mood
Map mood (setting).
Definition: Map.h:33
bool LapRace
Map is multi-lap.
Definition: Map.h:38
std::map< std::string, boost::any > Additionals
Additional parameters.
Definition: Map.h:42
std::string FileName
File name.
Definition: Map.h:22
int NbCheckpoints
Number of checkpoints.
Definition: Map.h:40
int NbLaps
Number of laps.
Definition: Map.h:39
std::string MapStyle
Map style (self-entered).
Definition: Map.h:30
int CopperPrice
Copper price.
Definition: Map.h:27
Map(std::map< std::string, GbxResponseParameter > serverStruct)
Formats a server response into a usable form.
Definition: Map.h:57
Contains all information about a map in easy-to-use format.
Definition: Map.h:14
void CopyDetailedMap(Map map)
Copies information from map object.
Definition: Map.h:83
int GoldTime
Time of the gold medal.
Definition: Map.h:26
std::string Author
Login of the author.
Definition: Map.h:24
std::string MapType
Type of the map.
Definition: Map.h:29
std::string UId
Unique map identifier.
Definition: Map.h:20
int BronzeTime
Time of the bronze medal.
Definition: Map.h:34
void MapDetailed(std::map< std::string, GbxResponseParameter > serverStruct)
Formats a server response into a usable form.
Definition: Map.h:70
int SilverTime
Time of the silver medal.
Definition: Map.h:35
std::string Name
Map name.
Definition: Map.h:21
void SetId(int id)
Set database identifier value.
Definition: Map.h:103
std::string Environment
Game environment.
Definition: Map.h:23
void UpdateAdditional(std::string key, boost::any value)
Updates (or inserts) key with value.
Definition: Map.h:114
int AuthorTime
Time set by the author.
Definition: Map.h:36
void setDetailedInfo(std::map< std::string, GbxResponseParameter > serverStruct)
Sets the detailed map information from the struct.
Definition: Map.h:152
int Id
Map identifier (on database).
Definition: Map.h:17