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
};
34
35
struct
ORCUS_PSR_DLLPUBLIC
parse_token
36
{
37
parse_token_t type;
38
39
union
40
{
41
struct
42
{
43
const
char
* p;
44
size_t
n;
45
46
} characters;
47
48
const
xml_token_element_t
* element;
49
};
50
51
parse_token
();
52
parse_token
(
const
pstring
& _characters);
53
parse_token
(parse_token_t _type,
const
xml_token_element_t
* _element);
54
55
parse_token
(
const
parse_token
& other);
56
57
parse_token
& operator= (
parse_token
) =
delete
;
58
59
bool
operator== (
const
parse_token
& other)
const
;
60
bool
operator!= (
const
parse_token
& other)
const
;
61
};
62
63
typedef
std::vector<parse_token> parse_tokens_t;
64
65
ORCUS_PSR_DLLPUBLIC std::ostream& operator<< (std::ostream& os,
const
parse_tokens_t&
tokens
);
66
67
class
ORCUS_PSR_DLLPUBLIC
parser_thread
68
{
69
struct
impl;
70
std::unique_ptr<impl> mp_impl;
71
72
public
:
73
parser_thread
(
const
char
* p,
size_t
n,
const
orcus::tokens
& tks,
xmlns_context
& ns_cxt,
size_t
min_token_size);
74
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);
75
~
parser_thread
();
76
77
void
start();
78
87
bool
next_tokens(parse_tokens_t&
tokens
);
88
89
void
swap_string_pool(
string_pool
& pool);
90
};
91
92
}}
93
94
#endif
95
96
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
orcus::pstring
Definition:
pstring.hpp:24
orcus::xmlns_context
Definition:
xml_namespace.hpp:80
orcus::sax::parser_thread
Definition:
sax_token_parser_thread.hpp:67
orcus::xml_token_element_t
Definition:
types.hpp:67
orcus::sax::parse_token
Definition:
sax_token_parser_thread.hpp:35
orcus::tokens
Definition:
tokens.hpp:21
orcus::string_pool
Definition:
string_pool.hpp:22
orcus
Definition:
base64.hpp:15
Generated on Fri Nov 29 2019 14:28:44 for Orcus by
1.8.14