26 #include <boost/spirit/include/qi.hpp> 27 #include <boost/spirit/include/phoenix_core.hpp> 28 #include <boost/spirit/include/phoenix_operator.hpp> 29 #include <boost/spirit/include/phoenix_fusion.hpp> 30 #include <boost/spirit/include/phoenix_object.hpp> 31 #include <boost/spirit/include/phoenix_stl.hpp> 32 #include <boost/spirit/include/phoenix_bind.hpp> 33 #include <boost/spirit/include/phoenix.hpp> 34 #include <boost/spirit/include/qi_symbols.hpp> 41 for(
auto& entry : table)
43 this->add(entry.first, entry.second);
55 using namespace qi::labels;
56 using boost::phoenix::construct;
63 rule_rgb =
'(' >> qi::float_[_a = _1] >>
',' >> qi::float_[_b = _1] >>
',' >> qi::float_[_val = phx::construct<Color>(_a, _b, _1)] >>
')';
64 rule_rgba =
'(' >> qi::float_[_a = _1] >>
',' >> qi::float_[_b = _1] >>
',' >> qi::float_[_c = _1] >>
',' >> qi::float_[_val = phx::construct<Color>(_a, _b, _c, _1)] >>
')';
A grammar to parse a mapcss color.
qi::rule< ItType, uint8(), qi::locals< uint8, uint8 > > rule_hexvalue
Rule to parse the hex color code.
ColorSymbols()
This file is part of alaCarte.
const boost::unordered_map< string, Color > & getTable() const
Returns the hole table.
qi::uint_parser< uint8, 16, 1, 1 > hexdigit
Rule to parse a hex digit.
qi::rule< ItType, Color(), qi::locals< float, float >, Skipper > rule_rgb
Rule for rgb(...)
qi::rule< ItType, Color(), qi::locals< float, float, float >, Skipper > rule_rgba
Rule for rgba(...)
ColorGrammar()
Creates all rules for the color grammar.
ColorSymbols colorSymbol_
Symbol parser for colors.
qi::rule< ItType, Color(), Skipper > rule_color
Mainrule.
qi::rule< ItType, Color(), qi::locals< uint8, uint8, uint8, uint8 > > rule_hexcolor
Rule for #COLORCODE.
static const ColorTable & Inst()
Returns a instance of a color table.