Current Version: 1.0.10
Project Name: csspp
expression.h
Go to the documentation of this file.
1 #ifndef CSSPP_EXPRESSION_H
2 #define CSSPP_EXPRESSION_H
3 // CSS Preprocessor
4 // Copyright (C) 2015-2016 Made to Order Software Corp.
5 //
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 
20 #include "csspp/node.h"
21 
22 namespace csspp
23 {
24 
26 {
27 public:
29 
30  virtual node::pointer_t get_variable(std::string const & variable_name, bool global_only = false) const = 0;
32 };
33 
35 {
36 public:
38 
40 
41  void compile_args(bool divide_font_metrics);
43 
44  static bool boolean(node::pointer_t n);
45  static void set_unique_id_counter(int counter);
46  static int get_unique_id_counter();
47 
48 private:
49  typedef std::map<std::string, node::pointer_t> variable_vector_t;
50  typedef std::vector<std::string> dimension_vector_t;
51 
52  bool end_of_nodes();
53  void mark_start();
55  void next();
56 
58 
60 
61  bool is_label() const;
63 
65 
67 
69 
73 
76 
78 
79  void dimensions_to_vectors(position const & pos, std::string const & dimension, dimension_vector_t & dividend, dimension_vector_t & divisor);
80  std::string multiplicative_dimension(position const & pos, std::string const & dim1, node_type_t const op, std::string const & dim2);
81  std::string rebuild_dimension(dimension_vector_t const & dividend, dimension_vector_t const & divisor);
84 
87 
89 
91 
92  // in internal_functions.cpp
97  node::pointer_t internal_function__get_string(node::pointer_t func, size_t argn, std::string & str);
99 
145 
147 
149  size_t f_pos = 0;
150  size_t f_start = static_cast<size_t>(-1);
153  bool f_divide_font_metrics = false;
155 };
156 
157 } // namespace csspp
158 #endif
159 // #ifndef CSSPP_LEXER_H
160 
161 // Local Variables:
162 // mode: cpp
163 // indent-tabs-mode: nil
164 // c-basic-offset: 4
165 // tab-width: 4
166 // End:
167 
168 // vim: ts=4 sw=4 et
node::pointer_t power()
Definition: expr_power.cpp:187
node::pointer_t internal_function__adjust_hue(node::pointer_t func)
node::pointer_t internal_function__random(node::pointer_t func)
node::pointer_t internal_function__unit(node::pointer_t func)
std::string rebuild_dimension(dimension_vector_t const &dividend, dimension_vector_t const &divisor)
node::pointer_t internal_function__identifier(node::pointer_t func)
node::pointer_t internal_function__frgba(node::pointer_t func)
node::pointer_t additive()
node::pointer_t internal_function__get_string(node::pointer_t func, size_t argn, std::string &str)
node::pointer_t equality()
node::pointer_t internal_function__max(node::pointer_t func)
node::pointer_t logical_and()
node::pointer_t internal_function__atan(node::pointer_t func)
node::pointer_t unary()
Definition: expr_unary.cpp:115
node::pointer_t assignment()
Definition: expr_list.cpp:157
std::shared_ptr< node > pointer_t
Definition: node.h:122
node::pointer_t internal_function__integer(node::pointer_t func)
node::pointer_t internal_function__hsla(node::pointer_t func)
node::pointer_t internal_function__blue(node::pointer_t func)
node_type_t
Definition: node.h:36
node::pointer_t internal_function__string(node::pointer_t func)
node::pointer_t relational()
node::pointer_t internal_function__get_string_or_identifier(node::pointer_t func, size_t argn, std::string &str)
node::pointer_t internal_function__get_number(node::pointer_t func, size_t argn, decimal_number_t &number)
node::pointer_t internal_function__rgba(node::pointer_t func)
node::pointer_t internal_function__cos(node::pointer_t func)
node::pointer_t post()
Definition: expr_list.cpp:184
variable_vector_t f_variables
Definition: expression.h:152
node::pointer_t internal_function__hue(node::pointer_t func)
virtual node::pointer_t get_variable(std::string const &variable_name, bool global_only=false) const =0
expression(node::pointer_t n)
Definition: expression.cpp:40
node::pointer_t internal_function__log(node::pointer_t func)
std::string multiplicative_dimension(position const &pos, std::string const &dim1, node_type_t const op, std::string const &dim2)
node::pointer_t compile_list(node::pointer_t parent)
Definition: expr_unary.cpp:56
node::pointer_t internal_function__rgb(node::pointer_t func)
node::pointer_t internal_function__str_length(node::pointer_t func)
node::pointer_t multiply(node_type_t op, node::pointer_t lhs, node::pointer_t rhs)
node::pointer_t internal_function__ceil(node::pointer_t func)
node::pointer_t internal_function__saturation(node::pointer_t func)
node::pointer_t internal_function__get_number_or_percent(node::pointer_t func, size_t argn, decimal_number_t &number)
node::pointer_t internal_function__function_exists(node::pointer_t func)
node::pointer_t internal_function__sin(node::pointer_t func)
bool is_comparable(node::pointer_t lhs, node::pointer_t rhs)
node::pointer_t internal_function__round(node::pointer_t func)
node::pointer_t replace_with_result(node::pointer_t result)
Definition: expression.cpp:72
node::pointer_t expression_list()
Definition: expr_list.cpp:53
node::pointer_t internal_function__hsl(node::pointer_t func)
node::pointer_t internal_function__percentage(node::pointer_t func)
node::pointer_t internal_function__acos(node::pointer_t func)
node::pointer_t internal_function__sign(node::pointer_t func)
node::pointer_t apply_power(node::pointer_t lhs, node::pointer_t rhs)
Definition: expr_power.cpp:40
bool is_less_than(node::pointer_t lhs, node::pointer_t rhs)
expression_variables_interface * f_variable_handler
Definition: expression.h:154
node::pointer_t internal_function__type_of(node::pointer_t func)
node::pointer_t internal_function__floor(node::pointer_t func)
node::pointer_t internal_function__sqrt(node::pointer_t func)
static bool boolean(node::pointer_t n)
Check whether a node represents true or false.
node::pointer_t internal_function__green(node::pointer_t func)
double decimal_number_t
Definition: csspp.h:53
bool is_label() const
Definition: expr_list.cpp:40
node::pointer_t internal_function__unique_id(node::pointer_t funct)
bool is_equal(node::pointer_t lhs, node::pointer_t rhs)
virtual node::pointer_t execute_user_function(node::pointer_t func)=0
node::pointer_t multiplicative()
std::map< std::string, node::pointer_t > variable_vector_t
Definition: expression.h:49
static int get_unique_id_counter()
void dimensions_to_vectors(position const &pos, std::string const &dimension, dimension_vector_t &dividend, dimension_vector_t &divisor)
node::pointer_t internal_function__get_any(node::pointer_t func, size_t argn)
node::pointer_t internal_function__frgb(node::pointer_t func)
node::pointer_t f_current
Definition: expression.h:151
bool f_divide_font_metrics
Definition: expression.h:153
node::pointer_t logical_or()
node::pointer_t internal_function__if(node::pointer_t func)
node::pointer_t internal_function__decimal_number(node::pointer_t func)
node::pointer_t internal_function__get_color(node::pointer_t func, size_t argn, color &col)
void compile_args(bool divide_font_metrics)
Definition: expr_unary.cpp:40
node::pointer_t internal_function__global_variable_exists(node::pointer_t func)
node::pointer_t internal_function__not(node::pointer_t func)
node::pointer_t internal_function__asin(node::pointer_t func)
static void set_unique_id_counter(int counter)
node::pointer_t internal_function__inspect(node::pointer_t func)
void set_variable_handler(expression_variables_interface *handler)
Definition: expression.cpp:49
node::pointer_t conditional()
node::pointer_t compile()
Definition: expression.cpp:54
node::pointer_t internal_function__min(node::pointer_t func)
node::pointer_t excecute_function(node::pointer_t func)
node::pointer_t f_node
Definition: expression.h:148
node::pointer_t internal_function__variable_exists(node::pointer_t func)
node::pointer_t internal_function__red(node::pointer_t func)
node::pointer_t internal_function__abs(node::pointer_t func)
node::pointer_t internal_function__alpha(node::pointer_t func)
std::vector< std::string > dimension_vector_t
Definition: expression.h:50
node::pointer_t internal_function__lightness(node::pointer_t func)
node::pointer_t internal_function__tan(node::pointer_t func)

Documentation of CSS Preprocessor.

This document is part of the Snap! Websites Project.

Copyright by Made to Order Software Corp.