34 #include "../../Display/2D/color.h" 35 #include "style_get_value.h" 36 #include "style_set_value.h" 37 #include "style_set_image.h" 38 #include "style_token.h" 39 #include "style_tokenizer.h" 85 static StyleToken next_token(
size_t &pos,
const std::vector<StyleToken> &tokens,
bool skip_whitespace =
true);
98 static bool parse_color(
const std::vector<StyleToken> &tokens,
size_t &in_out_pos,
Colorf &out_color);
106 const std::string::value_type *name;
109 static ColorType colors[];
static bool parse_color(const std::vector< StyleToken > &tokens, size_t &in_out_pos, Colorf &out_color)
virtual void set_value(const std::string &name, const StyleSetValue &value)=0
Set the value for the specified property name.
Floating point color description class (for float).
Definition: color.h:660
static bool parse_position(const std::vector< StyleToken > &tokens, size_t &in_out_pos, StyleSetValue &out_position_x, StyleSetValue &out_position_y)
static bool is_resolution(const StyleToken &token)
Linear or radial gradient.
Definition: style_set_image.h:48
std::vector< StyleToken > tokens
Tokenized style string relevant for parsing a property.
Definition: style_property_parser.h:67
static bool equals(const std::string &s1, const std::string &s2)
static const StyleGetValue & default_value(const char *name)
Gets the default value for a given property.
static bool parse_frequency(const StyleToken &token, StyleSetValue &out_frequency)
static bool parse_resolution(const StyleToken &token, StyleSetValue &out_resolution)
static bool is_inherited(const char *name)
Indicates if this an inherited property or not.
static bool parse_length(const StyleToken &token, StyleSetValue &out_length)
static bool is_time(const StyleToken &token)
Style property interface used to parse or query properties by name.
Definition: style_property_parser.h:120
Interface used by style parsers to store values in a style property set.
Definition: style_property_parser.h:50
static void parse(StylePropertySetter *setter, const std::string &styles)
Parses a string of styles and sets the values.
static bool parse_angle(const StyleToken &token, StyleSetValue &out_angle)
Sets the default value for a property.
Definition: style_property_parser.h:113
StyleDimension
Unit of a style value.
Definition: style_dimension.h:34
Style token.
Definition: style_token.h:68
static bool is_length(const StyleToken &token)
Style value returned by style classes.
Definition: style_get_value.h:39
virtual void parse(StylePropertySetter *setter, const std::string &name, StyleParser &parser)=0
Parse a property and set property values if successful.
Style property parser.
Definition: style_property_parser.h:74
virtual ~StylePropertyParser()
Definition: style_property_parser.h:79
StylePropertyDefault(const std::string &name, const StyleGetValue &value)
static bool parse_time(const StyleToken &token, StyleSetValue &out_time)
static bool parse_gradient(const std::vector< StyleToken > &tokens, size_t &in_out_pos, StyleGradient &out_gradient)
virtual void set_value_array(const std::string &name, const std::vector< StyleSetValue > &value_array)=0
Set a value array for the specified property name.
static bool is_frequency(const StyleToken &token)
static void debug_parse_error(const std::string &name, const std::vector< StyleToken > &tokens)
static bool is_angle(const StyleToken &token)
virtual ~StylePropertySetter()
Definition: style_property_parser.h:53
Style value variable.
Definition: style_set_value.h:39
StylePropertyParser(const std::vector< std::string > &property_names)
Constructs a property parser for the specified property names.
static bool parse_integer(const std::string &value, int &out_int)
bool important_flag
True if the !important flag was specified in the style string.
Definition: style_property_parser.h:70
Parser interface used during property parsing.
Definition: style_property_parser.h:63
static StyleToken next_token(size_t &pos, const std::vector< StyleToken > &tokens, bool skip_whitespace=true)