Orcus
parser_global.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 ORCUS_PARSER_GLOBAL_HPP
9 #define ORCUS_PARSER_GLOBAL_HPP
10 
11 #include "env.hpp"
12 
13 #include <sstream>
14 
15 namespace orcus {
16 
17 class cell_buffer;
18 
19 enum class string_escape_char_t
20 {
21  invalid,
22  valid,
23  control_char
24 };
25 
33 {
34  ORCUS_PSR_DLLPUBLIC static const size_t error_no_closing_quote;
35  ORCUS_PSR_DLLPUBLIC static const size_t error_illegal_escape_char;
36 
37  const char* str;
38  size_t length;
39 
50  bool transient;
51 
57 };
58 
59 ORCUS_PSR_DLLPUBLIC bool is_blank(char c);
60 ORCUS_PSR_DLLPUBLIC bool is_alpha(char c);
61 ORCUS_PSR_DLLPUBLIC bool is_name_char(char c);
62 ORCUS_PSR_DLLPUBLIC bool is_numeric(char c);
63 
75 ORCUS_PSR_DLLPUBLIC bool is_in(char c, const char* allowed, size_t n_allowed);
76 
77 ORCUS_PSR_DLLPUBLIC void write_to(std::ostringstream& os, const char* p, size_t n);
78 
79 ORCUS_PSR_DLLPUBLIC double parse_numeric(const char*& p, size_t max_length);
80 
81 ORCUS_PSR_DLLPUBLIC long parse_integer(const char*& p, size_t max_length);
82 
86 ORCUS_PSR_DLLPUBLIC parse_quoted_string_state parse_single_quoted_string(
87  const char*& p, size_t max_length, cell_buffer& buffer);
88 
100 ORCUS_PSR_DLLPUBLIC const char* parse_to_closing_single_quote(
101  const char* p, size_t max_length);
102 
103 ORCUS_PSR_DLLPUBLIC parse_quoted_string_state parse_double_quoted_string(
104  const char*& p, size_t max_length, cell_buffer& buffer);
105 
117 ORCUS_PSR_DLLPUBLIC const char* parse_to_closing_double_quote(
118  const char* p, size_t max_length);
119 
129 ORCUS_PSR_DLLPUBLIC string_escape_char_t get_string_escape_char_type(char c);
130 
140 ORCUS_PSR_DLLPUBLIC double clip(double input, double low, double high);
141 
142 }
143 
144 #endif
145 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Definition: cell_buffer.hpp:21
bool has_control_character
Definition: parser_global.hpp:56
Definition: parser_global.hpp:32
Definition: base64.hpp:15