11
11
#include "context.h"
13
#include "../util/xqp_exception.h"
14
#include "../values/values.h"
16
#include "../util/xqp_exception.h"
17
#include "../values/values.h"
21
/*+=========================================+
23
| The context module is still mostly |
26
+=========================================+
19
30
using namespace std;
22
33
#define EMPTY_SEQUENCE(X) item_iterator((X))
25
///////////////////////////////
27
///////////////////////////////
35
/*...........................................
36
: default constructor :
37
:.........................................:
40
//XXX: seriously missing: context constructor from XML config file.
46
in_scope_schema_types(),
47
in_scope_elem_decls(),
48
in_scope_attr_decls(),
51
//statically_known_collection_types(32,0.6),
52
signature_map(256,0.6),
53
statically_known_documents(256,0.6),
54
statically_known_collections(64,0.6),
59
function_implementations(1024,0.6),
61
available_documents(1024,0.6),
62
available_collections(1024,0.6),
63
default_collection("defcol"),
64
nodeid_counter("nodeid",1),
74
/*...........................................
76
:.........................................:
79
// this is a persistent counter
80
nodeid context::next_nodeid()
82
return nodeid(++nodeid_counter[0]);
85
nodeid context::context_nodeid()
87
if (!context_item_h->is_node())
88
throw xqp_exception(__FUNCTION__,"nodeid expects node");
89
node* n_p = dynamic_cast<node*>(&*context_item_h);
90
return n_p->get_nodeid();
94
/*...........................................
96
:.........................................:
29
99
var_binding::var_binding()
68
///////////////////////////////
70
///////////////////////////////
78
in_scope_schema_types(1024),
79
in_scope_elem_decls(1024),
80
in_scope_attr_decls(1024),
83
statically_known_collection_types(32,0.6),
86
signature_map(256,0.6),
87
statically_known_documents(256,0.6),
88
statically_known_collections(64,0.6),
94
function_implementations(1024,0.6),
96
available_documents(1024,0.6),
97
available_collections(1024,0.6),
98
default_collection("defcol")
107
136
void context::push_var(
108
137
rchandle<var_binding> vb_h)
184
function_impl const* context::get_function(
185
signature const& sig) const
186
throw (xqp_exception)
192
/*...........................................
194
:.........................................:
149
197
item_type context::get_document_type(
150
198
string const& doc_uri) const
151
199
throw (xqp_exception)
209
item_iterator context::get_document(
210
string const& doc_uri) const
211
throw (xqp_exception)
213
return EMPTY_SEQUENCE(*this);
217
/*...........................................
218
: context collection :
219
:.........................................:
161
222
item_type context::get_collection_type(
162
223
string const& col_uri) const
163
224
throw (xqp_exception)
173
function_impl const* context::get_function(
174
signature const& sig) const
175
throw (xqp_exception)
180
item_iterator context::get_document(
181
string const& doc_uri) const
182
throw (xqp_exception)
184
return EMPTY_SEQUENCE(*this);
187
234
item_iterator context::get_collection(
188
235
string const& col_uri) const
189
236
throw (xqp_exception)