Orcus
Loading...
Searching...
No Matches
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
16namespace orcus { namespace json {
17
18class ORCUS_PSR_DLLPUBLIC parse_error : public ::orcus::parse_error
19{
20public:
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
30class ORCUS_PSR_DLLPUBLIC parser_base : public ::orcus::parser_base
31{
32 struct impl;
33 std::unique_ptr<impl> mp_impl;
34
35protected:
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);
43
44 void skip_ws();
45 void parse_true();
46 void parse_false();
47 void parse_null();
48 double parse_double_or_throw();
49
50 parse_quoted_string_state parse_string();
51};
52
53}}
54
55#endif
56
57/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Definition: json_parser_base.hpp:19
Definition: json_parser_base.hpp:31
Definition: parser_base.hpp:27
Definition: parser_base.hpp:41
Definition: parser_global.hpp:33