mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-04-10 19:15:13 +00:00
Work around for boost::assign::map_list_of and gcc
This commit is contained in:
parent
4ef5f64ff3
commit
ac57e111d2
|
@ -10,24 +10,36 @@
|
||||||
#include "components/ImageComponent.h"
|
#include "components/ImageComponent.h"
|
||||||
#include "components/TextComponent.h"
|
#include "components/TextComponent.h"
|
||||||
|
|
||||||
std::map< std::string, std::map<std::string, ThemeData::ElementPropertyType> > ThemeData::sElementMap = boost::assign::map_list_of
|
|
||||||
("image", boost::assign::map_list_of
|
// This is a work around for some ambiguity that is introduced in C++11 that boost::assign::map_list_of leave open.
|
||||||
|
// We use makeMap(actualmap) to implicitly convert the boost::assign::map_list_of's return type to ElementMapType.
|
||||||
|
// Problem exists with gcc 4.7 and Boost 1.51. Works fine with MSVC2010 without this hack.
|
||||||
|
typedef std::map<std::string, ThemeData::ElementPropertyType> ElementMapType;
|
||||||
|
template<typename T>
|
||||||
|
ElementMapType makeMap(const T& mapInit)
|
||||||
|
{
|
||||||
|
ElementMapType m = mapInit;
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::map< std::string, ElementMapType > ThemeData::sElementMap = boost::assign::map_list_of
|
||||||
|
("image", makeMap(boost::assign::map_list_of
|
||||||
("pos", NORMALIZED_PAIR)
|
("pos", NORMALIZED_PAIR)
|
||||||
("size", NORMALIZED_PAIR)
|
("size", NORMALIZED_PAIR)
|
||||||
("maxSize", NORMALIZED_PAIR)
|
("maxSize", NORMALIZED_PAIR)
|
||||||
("origin", NORMALIZED_PAIR)
|
("origin", NORMALIZED_PAIR)
|
||||||
("path", PATH)
|
("path", PATH)
|
||||||
("tile", BOOLEAN)
|
("tile", BOOLEAN)
|
||||||
("color", COLOR))
|
("color", COLOR)))
|
||||||
("text", boost::assign::map_list_of
|
("text", makeMap(boost::assign::map_list_of
|
||||||
("pos", NORMALIZED_PAIR)
|
("pos", NORMALIZED_PAIR)
|
||||||
("size", NORMALIZED_PAIR)
|
("size", NORMALIZED_PAIR)
|
||||||
("text", STRING)
|
("text", STRING)
|
||||||
("color", COLOR)
|
("color", COLOR)
|
||||||
("fontPath", PATH)
|
("fontPath", PATH)
|
||||||
("fontSize", FLOAT)
|
("fontSize", FLOAT)
|
||||||
("center", BOOLEAN))
|
("center", BOOLEAN)))
|
||||||
("textlist", boost::assign::map_list_of
|
("textlist", makeMap(boost::assign::map_list_of
|
||||||
("pos", NORMALIZED_PAIR)
|
("pos", NORMALIZED_PAIR)
|
||||||
("size", NORMALIZED_PAIR)
|
("size", NORMALIZED_PAIR)
|
||||||
("selectorColor", COLOR)
|
("selectorColor", COLOR)
|
||||||
|
@ -38,27 +50,27 @@ std::map< std::string, std::map<std::string, ThemeData::ElementPropertyType> > T
|
||||||
("fontSize", FLOAT)
|
("fontSize", FLOAT)
|
||||||
("scrollSound", PATH)
|
("scrollSound", PATH)
|
||||||
("alignment", STRING)
|
("alignment", STRING)
|
||||||
("horizontalMargin", FLOAT))
|
("horizontalMargin", FLOAT)))
|
||||||
("container", boost::assign::map_list_of
|
("container", makeMap(boost::assign::map_list_of
|
||||||
("pos", NORMALIZED_PAIR)
|
("pos", NORMALIZED_PAIR)
|
||||||
("size", NORMALIZED_PAIR))
|
("size", NORMALIZED_PAIR)))
|
||||||
("ninepatch", boost::assign::map_list_of
|
("ninepatch", makeMap(boost::assign::map_list_of
|
||||||
("pos", NORMALIZED_PAIR)
|
("pos", NORMALIZED_PAIR)
|
||||||
("size", NORMALIZED_PAIR)
|
("size", NORMALIZED_PAIR)
|
||||||
("path", PATH))
|
("path", PATH)))
|
||||||
("datetime", boost::assign::map_list_of
|
("datetime", makeMap(boost::assign::map_list_of
|
||||||
("pos", NORMALIZED_PAIR)
|
("pos", NORMALIZED_PAIR)
|
||||||
("size", NORMALIZED_PAIR)
|
("size", NORMALIZED_PAIR)
|
||||||
("color", COLOR)
|
("color", COLOR)
|
||||||
("fontPath", PATH)
|
("fontPath", PATH)
|
||||||
("fontSize", FLOAT))
|
("fontSize", FLOAT)))
|
||||||
("rating", boost::assign::map_list_of
|
("rating", makeMap(boost::assign::map_list_of
|
||||||
("pos", NORMALIZED_PAIR)
|
("pos", NORMALIZED_PAIR)
|
||||||
("size", NORMALIZED_PAIR)
|
("size", NORMALIZED_PAIR)
|
||||||
("filledPath", PATH)
|
("filledPath", PATH)
|
||||||
("unfilledPath", PATH))
|
("unfilledPath", PATH)))
|
||||||
("sound", boost::assign::map_list_of
|
("sound", makeMap(boost::assign::map_list_of
|
||||||
("path", PATH));
|
("path", PATH)));
|
||||||
|
|
||||||
namespace fs = boost::filesystem;
|
namespace fs = boost::filesystem;
|
||||||
|
|
||||||
|
@ -198,7 +210,7 @@ void ThemeData::parseViews(const pugi::xml_node& root)
|
||||||
throw error << "View missing \"name\" attribute!";
|
throw error << "View missing \"name\" attribute!";
|
||||||
|
|
||||||
const char* viewKey = node.attribute("name").as_string();
|
const char* viewKey = node.attribute("name").as_string();
|
||||||
ThemeView& view = mViews.insert(std::make_pair<std::string, ThemeView>(viewKey, ThemeView())).first->second;
|
ThemeView& view = mViews.insert(std::pair<std::string, ThemeView>(viewKey, ThemeView())).first->second;
|
||||||
|
|
||||||
// load common first
|
// load common first
|
||||||
if(common && node != common)
|
if(common && node != common)
|
||||||
|
@ -233,7 +245,7 @@ void ThemeData::parseView(const pugi::xml_node& root, ThemeView& view)
|
||||||
off = nameAttr.find_first_of(delim, prevOff);
|
off = nameAttr.find_first_of(delim, prevOff);
|
||||||
|
|
||||||
parseElement(node, elemTypeIt->second,
|
parseElement(node, elemTypeIt->second,
|
||||||
view.elements.insert(std::make_pair<std::string, ThemeElement>(elemKey, ThemeElement())).first->second);
|
view.elements.insert(std::pair<std::string, ThemeElement>(elemKey, ThemeElement())).first->second);
|
||||||
|
|
||||||
if(std::find(view.orderedKeys.begin(), view.orderedKeys.end(), elemKey) == view.orderedKeys.end())
|
if(std::find(view.orderedKeys.begin(), view.orderedKeys.end(), elemKey) == view.orderedKeys.end())
|
||||||
view.orderedKeys.push_back(elemKey);
|
view.orderedKeys.push_back(elemKey);
|
||||||
|
|
Loading…
Reference in a new issue