-
Notifications
You must be signed in to change notification settings - Fork 1
/
xpath_stack.h
84 lines (69 loc) · 2.25 KB
/
xpath_stack.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
www.sourceforge.net/projects/tinyxpath
Copyright (c) 2002-2004 Yves Berquin (yvesb@users.sourceforge.net)
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any
damages arising from the use of this software.
Permission is granted to anyone to use this software for any
purpose, including commercial applications, and to alter it and
redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation
would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and
must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
*/
/**
\file xpath_stack.h
\author Yves Berquin
*/
#ifndef __XPATH_STACK_H
#define __XPATH_STACK_H
#include "tinyxpath_conf.h"
#include "xpath_expression.h"
#include "xpath_stream.h"
namespace TinyXPath {
class result_and_next;
/// The XPath execution stack
/// \n All elements are result_and_next elements
class xpath_stack {
public:
xpath_stack();
void v_set_root(const tinyxml2::XMLNode* XNp_in_root) {
_XNp_root = XNp_in_root;
}
~xpath_stack();
void v_push(expression_result er_res);
void v_push_int(int i_elem, const char* cp_comment = nullptr);
void v_push_bool(bool o_in);
void v_push_string(std::string S_in);
void v_push_double(double d_elem);
void v_push_node_set(node_set* nsp_ptr);
expression_result* erp_top();
int i_top_int();
void v_pop(unsigned u_nb = 1);
int i_pop_int();
std::string S_pop_string();
bool o_pop_bool();
node_set ns_pop_node_set();
/// Return the stack's size
unsigned u_get_size() {
return _u_size;
}
expression_result* erp_previous(unsigned u_nb);
#ifdef TINYXPATH_DEBUG
void v_dump();
#endif
protected:
/// First element in the stack
result_and_next* _rnp_first;
/// Stack size
unsigned _u_size;
void v_pop_one();
const tinyxml2::XMLNode* _XNp_root;
};
} // namespace TinyXPath
#endif // __XPATH_STACK_H