| 214 | } |
| 215 | |
| 216 | void addGameDataNode(pugi::xml_node & parent, const GameData * game) |
| 217 | { |
| 218 | //create game and add to parent node |
| 219 | pugi::xml_node newGame = parent.append_child(GameData::xmlTagGame.c_str()); |
| 220 | //add values |
| 221 | if (!game->getPath().empty()) { |
| 222 | pugi::xml_node pathNode = newGame.append_child(GameData::xmlTagPath.c_str()); |
| 223 | //store path with generic directory seperators |
| 224 | boost::filesystem::path gamePath(game->getPath()); |
| 225 | pathNode.text().set(gamePath.generic_string().c_str()); |
| 226 | } |
| 227 | if (!game->getName().empty()) { |
| 228 | pugi::xml_node nameNode = newGame.append_child(GameData::xmlTagName.c_str()); |
| 229 | nameNode.text().set(game->getName().c_str()); |
| 230 | } |
| 231 | if (!game->getDescription().empty()) { |
| 232 | pugi::xml_node descriptionNode = newGame.append_child(GameData::xmlTagDescription.c_str()); |
| 233 | descriptionNode.text().set(game->getDescription().c_str()); |
| 234 | } |
| 235 | if (!game->getImagePath().empty()) { |
| 236 | pugi::xml_node imagePathNode = newGame.append_child(GameData::xmlTagImagePath.c_str()); |
| 237 | imagePathNode.text().set(game->getImagePath().c_str()); |
| 238 | } |
| 239 | //all other values are added regardless of their value |
| 240 | pugi::xml_node ratingNode = newGame.append_child(GameData::xmlTagRating.c_str()); |
| 241 | ratingNode.text().set(std::to_string((long double)game->getRating()).c_str()); |
| 242 | |
| 243 | pugi::xml_node userRatingNode = newGame.append_child(GameData::xmlTagUserRating.c_str()); |
| 244 | userRatingNode.text().set(std::to_string((long double)game->getUserRating()).c_str()); |
| 245 | |
| 246 | pugi::xml_node timesPlayedNode = newGame.append_child(GameData::xmlTagTimesPlayed.c_str()); |
| 247 | timesPlayedNode.text().set(std::to_string((unsigned long long)game->getTimesPlayed()).c_str()); |
| 248 | |
| 249 | pugi::xml_node lastPlayedNode = newGame.append_child(GameData::xmlTagLastPlayed.c_str()); |
| 250 | lastPlayedNode.text().set(std::to_string((unsigned long long)game->getLastPlayed()).c_str()); |
| 251 | } |
| 252 | |
| 253 | void updateGamelist(SystemData* system) |
| 254 | { |
no test coverage detected