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_XPATH_PARSER_HPP
9 #define INCLUDED_ORCUS_XPATH_PARSER_HPP
10 
11 #include "orcus/types.hpp"
12 
13 namespace orcus {
14 
15 class pstring;
16 class xmlns_context;
17 
18 class xpath_parser
19 {
20     const xmlns_context& m_cxt;
21     const char* mp_char;
22     const char* mp_end;
23 
24     xmlns_id_t m_default_ns;
25 
26     enum class token_type { element, attribute };
27 
28 public:
29 
30     struct token
31     {
32         xmlns_id_t ns;
33         pstring name;
34         bool attribute;
35 
36         token(xmlns_id_t _ns, const pstring& _name, bool _attribute);
37         token();
38         token(const token& r);
39     };
40 
41     xpath_parser(const xmlns_context& cxt, const char* p, size_t n, xmlns_id_t default_ns);
42 
43     token next();
44 };
45 
46 }
47 
48 #endif
49 
50 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
51