Orcus
include
orcus
sax_token_parser_thread.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_SAX_TOKEN_PARSER_THREAD_HPP
9
#define INCLUDED_ORCUS_SAX_TOKEN_PARSER_THREAD_HPP
10
11
#include "orcus/env.hpp"
12
13
#include <memory>
14
#include <vector>
15
#include <ostream>
16
17
namespace
orcus {
18
19
class
tokens;
20
class
xmlns_context;
21
class
pstring;
22
class
string_pool;
23
struct
xml_token_element_t;
24
25
namespace
sax {
26
27
enum class
parse_token_t
28
{
29
unknown,
30
start_element,
31
end_element,
32
characters,
33
parse_error,
34
};
35
36
struct
ORCUS_PSR_DLLPUBLIC
parse_token
37
{
38
parse_token_t type;
39
40
union
41
{
42
struct
43
{
44
const
char
* p;
45
size_t
n;
46
47
} characters;
48
49
struct
50
{
51
const
char
* p;
52
size_t
len;
53
std::ptrdiff_t offset;
54
55
} error_value;
56
57
const
xml_token_element_t
* element;
58
};
59
60
parse_token
();
61
parse_token
(
const
pstring
& _characters);
62
parse_token
(parse_token_t _type,
const
xml_token_element_t
* _element);
63
parse_token
(parse_token_t _type,
const
char
* p,
size_t
len, std::ptrdiff_t offset);
64
65
parse_token
(
const
parse_token
& other);
66
67
parse_token
& operator= (
parse_token
) =
delete
;
68
69
bool
operator== (
const
parse_token
& other)
const
;
70
bool
operator!= (
const
parse_token
& other)
const
;
71
};
72
73
typedef
std::vector<parse_token> parse_tokens_t;
74
75
ORCUS_PSR_DLLPUBLIC std::ostream& operator<< (std::ostream& os,
const
parse_tokens_t&
tokens
);
76
77
class
ORCUS_PSR_DLLPUBLIC
parser_thread
78
{
79
struct
impl;
80
std::unique_ptr<impl> mp_impl;
81
82
public
:
83
parser_thread
(
const
char
* p,
size_t
n,
const
orcus::tokens
& tks,
xmlns_context
& ns_cxt,
size_t
min_token_size);
84
parser_thread
(
const
char
* p,
size_t
n,
const
orcus::tokens
& tks,
xmlns_context
& ns_cxt,
size_t
min_token_size,
size_t
max_token_size);
85
~
parser_thread
();
86
87
void
start();
88
97
bool
next_tokens
(parse_tokens_t&
tokens
);
98
99
void
swap_string_pool(
string_pool
& pool);
100
101
void
abort();
102
};
103
104
}}
105
106
#endif
107
108
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
orcus::pstring
Definition:
pstring.hpp:28
orcus::sax::parser_thread
Definition:
sax_token_parser_thread.hpp:78
orcus::sax::parser_thread::next_tokens
bool next_tokens(parse_tokens_t &tokens)
orcus::string_pool
Definition:
string_pool.hpp:24
orcus::tokens
Definition:
tokens.hpp:22
orcus::xmlns_context
Definition:
xml_namespace.hpp:83
orcus::sax::parse_token
Definition:
sax_token_parser_thread.hpp:37
orcus::xml_token_element_t
Definition:
types.hpp:97
Generated on Mon Aug 9 2021 00:00:00 for Orcus by
1.9.1