tsp_cpp/xmlParser/xmlParser.cpp

86 lines
1.8 KiB
C++
Raw Permalink Normal View History

//
// Created by trotfunky on 07/05/19.
//
#include <pugixml.hpp>
#include "xmlParser.h"
namespace xmlParser
{
const std::string colorToStr(const sf::Color& color)
{
if(color == sf::Color::Black)
{
return("Black");
}
else if(color == sf::Color::White)
{
return("White");
}
else if(color == sf::Color::Red)
{
return("Red");
}
else if(color == sf::Color::Green)
{
return("Green");
}
else if(color == sf::Color::Blue)
{
return("Blue");
}
else if(color == sf::Color::Yellow)
{
return("Yellow");
}
else if(color == sf::Color::Magenta)
{
return("Magenta");
}
else if(color == sf::Color::Cyan)
{
return("Cyan");
}
return("Transparent");
}
const sf::Color& strToColor(const std::string& stringColor)
{
if(stringColor == "Black")
{
return(sf::Color::Black);
}
else if(stringColor == "White")
{
return(sf::Color::White);
}
else if(stringColor == "Red")
{
return(sf::Color::Red);
}
else if(stringColor == "Green")
{
return(sf::Color::Green);
}
else if(stringColor == "Blue")
{
return(sf::Color::Blue);
}
else if(stringColor == "Yellow")
{
return(sf::Color::Yellow);
}
else if(stringColor == "Magenta")
{
return(sf::Color::Magenta);
}
else if(stringColor == "Cyan")
{
return(sf::Color::Cyan);
}
else
{
return(sf::Color::Green);
}
}
}