Orcus
json_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_ORCUS_JSON_PARSER_BASE_HPP
9 #define INCLUDED_ORCUS_JSON_PARSER_BASE_HPP
10 
11 #include "orcus/parser_base.hpp"
12 #include "orcus/parser_global.hpp"
13 
14 #include <memory>
15 
16 namespace orcus { namespace json {
17 
18 class ORCUS_PSR_DLLPUBLIC parse_error : public ::orcus::parse_error
19 {
20 public:
21  parse_error(const std::string& msg, std::ptrdiff_t offset);
22 
23  static void throw_with(
24  const char* msg_before, char c, const char* msg_after, std::ptrdiff_t offset);
25 
26  static void throw_with(
27  const char* msg_before, const char* p, size_t n, const char* msg_after, std::ptrdiff_t offset);
28 };
29 
30 class ORCUS_PSR_DLLPUBLIC parser_base : public ::orcus::parser_base
31 {
32  struct impl;
33  std::unique_ptr<impl> mp_impl;
34 
35 protected:
36 
37  parser_base() = delete;
38  parser_base(const parser_base&) = delete;
39  parser_base& operator=(const parser_base&) = delete;
40 
41  parser_base(const char* p, size_t n);
42  ~parser_base();
43 
44  void parse_true();
45  void parse_false();
46  void parse_null();
47  long parse_long_or_throw();
48  double parse_double_or_throw();
49 
50  parse_quoted_string_state parse_string();
51 
52  void skip_blanks();
53 };
54 
55 }}
56 
57 #endif
58 
59 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Definition: json_parser_base.hpp:30
Definition: json_parser_base.hpp:18
Definition: parser_base.hpp:34
Definition: parser_global.hpp:32
Definition: parser_base.hpp:20
Definition: base64.hpp:15