alaCarte Maps
Renderer for OpenStreetMap tiles
MapCssParser Struct Reference

#include <mapcss_parser.hpp>

Public Member Functions

void addAttributeToTemplate (StylePtr &style, const shared_ptr< AttributeCreator > &attrType, const string &specifier, const ParseInfo &info)
 Converts a given string into a text position. More...
 
void applyStyleToRules (std::vector< RulePtr > &rules, const StylePtr &style)
 Sets a given style as the style of given rules. More...
 
SelectorPtr createSelectorFromObjectType (const SelectorPtr &next, const shared_ptr< Rule > &rule, obj::ObjectTypeEnum objType, Rule::AcceptableTypes &type)
 Creates an selector used to match geoobject types. More...
 
SelectorPtr createChildSelectorFromObjectType (const SelectorPtr &next, const shared_ptr< Rule > &rule, obj::ObjectTypeEnum objType)
 Creates a selector, selecting children of the specified type. More...
 
SelectorPtr createSelectorFromUnaryCondition (const SelectorPtr &next, const shared_ptr< Rule > &rule, const UnaryCondition &condition)
 Creates a selector using an unary operator. More...
 
SelectorPtr createSelectorFromBinaryCondition (const SelectorPtr &next, const shared_ptr< Rule > &rule, const BinaryCondition &condition)
 Creates a selector using an binary operator. More...
 
SelectorPtr createSelectorFromCondition (const SelectorPtr &next, const shared_ptr< Rule > &rule, const ConditionType &condition)
 Creates a selector for a given condition. More...
 
RulePtr createSelectorChain (const std::vector< SelectorItem > &items)
 Creates a chain of selectors from given subselectors. More...
 
void warnUnsupportedAttribute (const string &attribute) const
 Emits a warning for unknown mapcss attribute. More...
 
 MapCssParser (const shared_ptr< Geodata > &geodata)
 Initializes the parser. More...
 
void load (const string &path)
 Loads a file from the given path and tries to parse the content into a stylesheet. More...
 

Public Attributes

shared_ptr< Geodatageodata
 The geodata used to inject them in the rules. More...
 
shared_ptr< StylesheetparsedStylesheet
 The parsed stylesheet. More...
 
excp::ParseException catchedException
 The exception that may be catched. More...
 
shared_ptr< ParserLoggerlogger
 Output logger for errors and warnings. More...
 

Detailed Description

Definition at line 39 of file mapcss_parser.hpp.

Constructor & Destructor Documentation

MapCssParser::MapCssParser ( const shared_ptr< Geodata > &  geodata)

Initializes the parser.

Parameters
geodataused in created rules

Definition at line 338 of file mapcss_parser.cpp.

Member Function Documentation

void MapCssParser::addAttributeToTemplate ( StylePtr style,
const shared_ptr< AttributeCreator > &  attrType,
const string specifier,
const ParseInfo info 
)

Converts a given string into a text position.

Parameters
specifierselecting text position (values are "line" and "center")
Returns
The specified text position Adds an attribute to an existing style
Parameters
styleto add the attribute
attrTypetype of the attribute
specifierfor the attribute

Definition at line 118 of file mapcss_parser.cpp.

void MapCssParser::applyStyleToRules ( std::vector< RulePtr > &  rules,
const StylePtr style 
)

Sets a given style as the style of given rules.

Parameters
rulesrules, where the style should applied to
stylewhich should be applied to the rules

Definition at line 144 of file mapcss_parser.cpp.

SelectorPtr MapCssParser::createChildSelectorFromObjectType ( const SelectorPtr next,
const shared_ptr< Rule > &  rule,
obj::ObjectTypeEnum  objType 
)

Creates a selector, selecting children of the specified type.

Parameters
nextselector which is called, if this selector matches
rulecontaining the selector
objTypewhich should be selected by this selector
Returns
The created selector

Definition at line 184 of file mapcss_parser.cpp.

RulePtr MapCssParser::createSelectorChain ( const std::vector< SelectorItem > &  items)

Creates a chain of selectors from given subselectors.

The last selector will always be an applyselector, which applies the style of the rule

Parameters
itemsto be converted into a selector chain
Returns
A new rule containing the selector chain

Definition at line 286 of file mapcss_parser.cpp.

SelectorPtr MapCssParser::createSelectorFromBinaryCondition ( const SelectorPtr next,
const shared_ptr< Rule > &  rule,
const BinaryCondition condition 
)

Creates a selector using an binary operator.

Parameters
nextselector which is called, if this selector matches
rulecontaining the selector
conditionused to select objects
Returns
The created selector

Definition at line 230 of file mapcss_parser.cpp.

SelectorPtr MapCssParser::createSelectorFromCondition ( const SelectorPtr next,
const shared_ptr< Rule > &  rule,
const ConditionType condition 
)

Creates a selector for a given condition.

Parameters
nextselector which is called, if this selector matches
rulecontaining the selector
conditionused to select objects
Returns
The created selector

Definition at line 263 of file mapcss_parser.cpp.

SelectorPtr MapCssParser::createSelectorFromObjectType ( const SelectorPtr next,
const shared_ptr< Rule > &  rule,
obj::ObjectTypeEnum  objType,
Rule::AcceptableTypes type 
)

Creates an selector used to match geoobject types.

Parameters
nextselector which is called, if this selector matches
rulecontaining the selector
objTypewhich should be selected by the selector
Returns
The created selector

Definition at line 160 of file mapcss_parser.cpp.

SelectorPtr MapCssParser::createSelectorFromUnaryCondition ( const SelectorPtr next,
const shared_ptr< Rule > &  rule,
const UnaryCondition condition 
)

Creates a selector using an unary operator.

Parameters
nextselector which is called, if this selector matches
rulecontaining the selector
conditionused to select objects
Returns
The created selector

Definition at line 207 of file mapcss_parser.cpp.

void MapCssParser::load ( const string path)

Loads a file from the given path and tries to parse the content into a stylesheet.

Parameters
pathto a file containing a stylesheet in mapcss form
Returns
The created stylesheet

Definition at line 350 of file mapcss_parser.cpp.

void MapCssParser::warnUnsupportedAttribute ( const string attribute) const

Emits a warning for unknown mapcss attribute.

Parameters
attributename

Definition at line 329 of file mapcss_parser.cpp.

Member Data Documentation

excp::ParseException MapCssParser::catchedException

The exception that may be catched.

Definition at line 59 of file mapcss_parser.hpp.

shared_ptr<Geodata> MapCssParser::geodata

The geodata used to inject them in the rules.

Definition at line 55 of file mapcss_parser.hpp.

shared_ptr<ParserLogger> MapCssParser::logger

Output logger for errors and warnings.

Definition at line 61 of file mapcss_parser.hpp.

shared_ptr<Stylesheet> MapCssParser::parsedStylesheet

The parsed stylesheet.

Definition at line 57 of file mapcss_parser.hpp.


The documentation for this struct was generated from the following files: