Orcus
Loading...
Searching...
No Matches
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 "env.hpp"
12
#include "types.hpp"
13
14
#include <memory>
15
#include <variant>
16
#include <vector>
17
#include <ostream>
18
19
namespace
orcus {
20
21
class
tokens;
22
class
xmlns_context;
23
class
string_pool;
24
struct
xml_token_element_t;
25
26
namespace
sax {
27
28
enum class
parse_token_t
29
{
30
unknown,
31
start_element,
32
end_element,
33
characters,
34
parse_error,
35
};
36
37
struct
ORCUS_PSR_DLLPUBLIC
parse_token
38
{
39
using
value_type = std::variant<std::string_view, parse_error_value_t, const xml_token_element_t*>;
40
41
parse_token_t type;
42
value_type value;
43
44
parse_token
();
45
parse_token
(std::string_view _characters);
46
parse_token
(parse_token_t _type,
const
xml_token_element_t
* _element);
47
parse_token
(std::string_view msg, std::ptrdiff_t offset);
48
49
parse_token
(
const
parse_token
& other);
50
51
parse_token
& operator= (
parse_token
) =
delete
;
52
53
bool
operator== (
const
parse_token
& other)
const
;
54
bool
operator!= (
const
parse_token
& other)
const
;
55
};
56
57
typedef
std::vector<parse_token> parse_tokens_t;
58
59
ORCUS_PSR_DLLPUBLIC std::ostream& operator<< (std::ostream& os,
const
parse_tokens_t&
tokens
);
60
61
class
ORCUS_PSR_DLLPUBLIC
parser_thread
62
{
63
struct
impl;
64
std::unique_ptr<impl> mp_impl;
65
66
public
:
67
parser_thread
(
const
char
* p,
size_t
n,
const
orcus::tokens
& tks,
xmlns_context
& ns_cxt,
size_t
min_token_size);
68
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);
69
~parser_thread
();
70
71
void
start();
72
81
bool
next_tokens
(parse_tokens_t&
tokens
);
82
83
void
swap_string_pool(
string_pool
& pool);
84
85
void
abort();
86
};
87
88
}}
89
90
#endif
91
92
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
orcus::sax::parser_thread
Definition
sax_token_parser_thread.hpp:62
orcus::sax::parser_thread::next_tokens
bool next_tokens(parse_tokens_t &tokens)
orcus::string_pool
Definition
string_pool.hpp:26
orcus::tokens
Definition
tokens.hpp:30
orcus::xmlns_context
Definition
xml_namespace.hpp:100
orcus::sax::parse_token
Definition
sax_token_parser_thread.hpp:38
orcus::xml_token_element_t
Definition
types.hpp:148
Generated on Sun Feb 9 2025 19:10:43 for Orcus by
1.10.0