Orcus
css_parser_base.hpp
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This Source Code Form is subject to the terms of the Mozilla Public
4  * License, v. 2.0. If a copy of the MPL was not distributed with this
5  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
6  */
7 
8 #ifndef INCLUDED_CSS_PARSER_BASE_HPP
9 #define INCLUDED_CSS_PARSER_BASE_HPP
10 
11 #include "orcus/env.hpp"
12 #include "orcus/css_types.hpp"
13 #include "orcus/exception.hpp"
14 #include "orcus/parser_base.hpp"
15 
16 #include <string>
17 #include <exception>
18 
19 namespace orcus { namespace css {
20 
21 class ORCUS_PSR_DLLPUBLIC parser_base : public ::orcus::parser_base
22 {
23 public:
24  parser_base(std::string_view content);
25 
26 protected:
27 
28  void identifier(const char*& p, size_t& len, std::string_view extra = std::string_view{});
29  uint8_t parse_uint8();
30 
37  std::string_view parse_value();
38  double parse_percent();
39  double parse_double_or_throw();
40 
41  void literal(const char*& p, size_t& len, char quote);
42  void skip_to(const char*& p, size_t& len, char c);
43 
51  void skip_to_or_blank(const char*& p, size_t& len, std::string_view chars);
52  void skip_blanks();
53  void skip_blanks_reverse();
54  void shrink_stream();
55  bool skip_comment();
56  void comment();
57  void skip_comments_and_blanks();
58  void set_combinator(char c, css::combinator_t combinator);
59  void reset_before_block();
60 
61 protected:
62  size_t m_simple_selector_count;
63  combinator_t m_combinator;
64 };
65 
66 
67 }}
68 
69 #endif
70 
71 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Definition: css_parser_base.hpp:22
std::string_view parse_value()
void skip_to_or_blank(const char *&p, size_t &len, std::string_view chars)
Definition: parser_base.hpp:23