22 #ifndef MAPCSS_GRAMMAR_HPP 23 #define MAPCSS_GRAMMAR_HPP 37 namespace phx = boost::phoenix;
51 : top(top), bottom(bottom)
89 typedef fsio::vector<
string,
131 (std::vector<ConditionType>, conditions)
203 virtual void addAttribute(
const shared_ptr<StyleTemplate>& styleTemplate,
const string& specifier,
const shared_ptr<ParserLogger>& logger,
const ParseInfo& info) = 0;
220 struct MapCSSGrammar :
public qi::grammar<GrammarIterator, StylesheetPtr(), qi::locals<std::vector<RulePtr>, StylePtr>, CommentSkipper>
249 qi::rule<ItType, Zoom(), qi::locals<int, int>, Skipper>
rule_zoom;
259 qi::rule<ItType, RulePtr(), qi::locals<std::vector<SelectorItem> >, Skipper>
rule_selector;
262 qi::rule<ItType, std::vector<RulePtr>(), Skipper> rule_cssrule;
Checks if a value is recognised by a regex.
Checks if two values are equal.
Zoom(int bottom, int top)
Creates a zoom from given values.
SelectorItem()
Creates an empty selector item.
qi::rule< ItType, StylePtr(), qi::locals< shared_ptr< AttributeCreator >, ParseInfo >, Skipper > rule_styleset
Rule to parse a styleset of a rule.
symbols for the binary operators
qi::rule< ItType, Zoom(), qi::locals< int, int >, Skipper > rule_zoom
Rule to parse a zoom range.
Checks if a value is greater then another.
BOOST_FUSION_ADAPT_STRUCT(SelectorItem,(obj::ObjectTypeEnum, objectType)(Zoom, zoom)(std::vector< ConditionType >, conditions)) struct UnitTypes
symbols for the unit types
fsio::vector< op::UnaryTypesEnum, string > UnaryCondition
Stores informations about an unary condition.
The grammar for the mapcss format.
Checks if a value is lesser than another.
AttributeTypes attributeType_
The symbol parser for style attributes.
int bottom
The bottom of the zoom range.
void expand(const Zoom &other)
qi::rule< ItType, string(), Skipper > rule_specifier
Rule to parse the specifier.
Zoom zoom
The zoom which should be selected.
qi::rule< ItType, string()> rule_tag
Rule to parse a tag.
fsio::vector< string, op::BinaryTypesEnum, string > BinaryCondition
Stores informations about an binary condition.
std::vector< ConditionType > conditions
The condition of the item.
BinaryTypesEnum
Enum with binary operators used in selectors.
classic::position_iterator2< StringIterator > GrammarIterator
Iterator wrapping the file iterator and to be used in all grammars.
Zoom()
Creates the standard zoom.
symbols for the attributes
shared_ptr< StyleTemplate > StylePtr
Shortcut for a shared pointer to style.
qi::rule< ItType > rule_class
Rule to parse mapcss classes.
ObjectTypes selectorObject_
The symbol parser for objects.
qi::rule< ItType, RulePtr(), qi::locals< std::vector< SelectorItem > >, Skipper > rule_selector
Rule to parse a selector.
qi::rule< ItType, string()> rule_value
Rule to parse a value.
GrammarIterator ItType
The Iterator used in this grammar.
boost::variant< UnaryCondition, BinaryCondition > ConditionType
Possible Conditions.
qi::rule< ItType, SelectorItem(), Skipper > rule_subselector
Rule to parse one part of the selector.
UnitTypesEnum
Contains all the units available for numeric values.
Checks if a geoobject does not have a certain tag.
Selects lines (unclosed ways)
ObjectTypeEnum
Enum with object selectors.
CommentSkipper Skipper
The skipper used in this grammar.
Checks if two values are not equal.
Checks if a value is lesser or equal to another.
UnaryTypes unaryOperator_
The symbol parser for unary operators.
bool operator==(const Zoom &z) const
Compares to zoom's.
obj::ObjectTypeEnum objectType
The type of the object, which should be selected.
BinaryTypes binaryOperator_
The symbol parser for binary operators.
Selects areas (closed ways)
Checks if a value is greater or equal to another.
Represents a part of the style selector.
Simple structure to store a zoom range.
qi::rule< ItType, string(), Skipper > attribute_name
Rule to parse generic (unknown) attribute name.
int top
The top of the zoom range.
qi::rule< ItType, BinaryCondition()> rule_binary_condition
Rule to parse a binary condition.
void focus(const Zoom &other)
SelectorItem(obj::ObjectTypeEnum o, const Zoom &zoom, const std::vector< ConditionType > &conds)
Creates an selector item from given values.
UnaryTypesEnum
Enum with unary operators used in selectors.
symbols for the unary operators
qi::rule< ItType, StylesheetPtr(), qi::locals< std::vector< RulePtr >, StylePtr >, Skipper > rule_stylesheet
Main rule returning a stylesheet.
qi::rule< ItType, UnaryCondition()> rule_unary_condition
Rule to parse a unary condition.