~juan457/+junk/zorba

« back to all changes in this revision

Viewing changes to context/context.h

  • Committer: paulped at ETHZ
  • Date: 2007-01-25 19:55:55 UTC
  • Revision ID: svn-v4:8046edc3-af21-0410-8661-ec7318497eea:trunk/zorba:334
added nodeid service to context
added a test data directory 'wordlists'
miscellaneous bug fixes, unit testing improvements

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
#include "../types/base_types.h"
20
20
#include "../types/collation.h"
21
21
#include "../util/hashmap.h"
 
22
#include "../util/list.h"
22
23
#include "../util/rchandle.h"
23
24
#include "../util/xqp_exception.h"
24
25
#include "../values/qname_value.h"
 
26
#include "../values/node_values.h"
25
27
 
26
28
#include <stack>
27
29
#include <vector>
112
114
        **      and by namespace declaration attributes in direct element 
113
115
        **      constructors. 
114
116
        */
115
 
  //vector<name_space> namespaces;
 
117
  list<name_space> namespaces;
116
118
 
117
119
        /*
118
120
        **      [Definition: Default element/type namespace. This is a namespace URI 
141
143
        **      supported, in-scope schema types also include all type definitions 
142
144
        **      found in imported schemas. ] 
143
145
        */
144
 
        //vector<QName> in_scope_schema_types;
 
146
        list<QName> in_scope_schema_types;
145
147
 
146
148
        /*
147
149
        **      [Definition: In-scope element declarations. Each element declaration 
153
155
        **      includes information about the element's substitution group 
154
156
        **      affiliation. 
155
157
        */
156
 
        //vector<QName> in_scope_elem_decls;
 
158
        list<QName> in_scope_elem_decls;
157
159
 
158
160
        /*
159
161
        **      [Definition: In-scope attribute declarations. Each attribute 
163
165
        **      Feature is supported, in-scope attribute declarations include all 
164
166
        **      attribute declarations found in imported schemas.] 
165
167
        */
166
 
        //vector<QName> in_scope_attr_decls;
 
168
        list<QName> in_scope_attr_decls;
167
169
 
168
170
        /*
169
171
        **      [Definition: In-scope variables. This is a set of (expanded QName, 
183
185
        **      inference rules as described in [XQuery 1.0 and XPath 2.0 Formal 
184
186
        **      Semantics]. 
185
187
        */
186
 
        //vector<var_binding> in_scope_vars;
 
188
        list<var_binding> in_scope_vars;
187
189
 
188
190
        /*
189
191
        **      [Definition: Context item static type. This component defines the 
201
203
        **      extension, ordered. For a more complete definition of collation, see 
202
204
        **      [XQuery 1.0 and XPath 2.0 Functions and Operators].] 
203
205
        */
204
 
        //vector<collation_h_t> collations;
 
206
        list<collation_h_t> collations;
205
207
 
206
208
        /*
207
209
        **      [Definition: Default collation. This identifies one of the collations 
326
328
        name_space get_default_function_ns() const
327
329
                { return default_function_ns; }
328
330
 
329
 
/*
330
 
  vector<name_space> const& get_namespaces() const
331
 
                { return namespaces; }
332
 
        vector<QName> const& get_in_scope_schema_types() const
333
 
                { return in_scope_schema_types; }
334
 
        vector<QName> const& get_in_scope_elem_decls() const
335
 
                { return in_scope_elem_decls; }
336
 
        vector<QName> const& get_in_scope_attr_decls() const
337
 
                { return in_scope_attr_decls; }
338
 
        vector<var_binding> const& get_in_scope_vars() const
339
 
                { return in_scope_vars; }
340
 
        vector<collation_h_t> const& get_collations() const
341
 
                { return collations; }
342
 
*/
 
331
  list_iterator<name_space> namespaces_begin() const
 
332
                { return namespaces.begin(); }
 
333
  list_iterator<name_space> namespaces_end() const
 
334
                { return namespaces.end(); }
 
335
 
 
336
        list_iterator<QName> in_scope_schema_types_begin() const
 
337
                { return in_scope_schema_types.begin(); }
 
338
        list_iterator<QName> in_scope_schema_types_end() const
 
339
                { return in_scope_schema_types.end(); }
 
340
 
 
341
        list_iterator<QName> in_scope_elem_decls_begin() const
 
342
                { return in_scope_elem_decls.begin(); }
 
343
        list_iterator<QName> in_scope_elem_decls_end() const
 
344
                { return in_scope_elem_decls.end(); }
 
345
 
 
346
        list_iterator<QName> in_scope_attr_decls_begin() const
 
347
                { return in_scope_attr_decls.begin(); }
 
348
        list_iterator<QName> in_scope_attr_decls_end() const
 
349
                { return in_scope_attr_decls.end(); }
 
350
 
 
351
        list_iterator<var_binding> in_scope_vars_begin() const
 
352
                { return in_scope_vars.begin(); }
 
353
        list_iterator<var_binding> in_scope_vars_end() const
 
354
                { return in_scope_vars.end(); }
 
355
 
 
356
        list_iterator<collation_h_t> collations_begin() const
 
357
                { return collations.begin(); }
 
358
        list_iterator<collation_h_t> collations_end() const
 
359
                { return collations.end(); }
 
360
 
343
361
 
344
362
        item_type get_context_item_type() const
345
363
                { return context_item_type; }
358
376
        std::string get_base_uri() const
359
377
                { return base_uri; }
360
378
        
 
379
 
361
380
        std::string get_function_type(QName const&, uint32_t arity) 
362
381
         const throw (xqp_exception);
363
382
        item_type get_document_type(std::string const&) 
376
395
        **      item in the sequence obtained by evaluating E1 becomes the context 
377
396
        **      item in the inner focus for an evaluation of E2.
378
397
        */
379
 
        item_iterator context_item;
 
398
        rchandle<item> context_item_h;
380
399
 
381
400
        /*
382
401
        **      [Definition: The context position is the position of the context item 
470
489
        */
471
490
        std::string default_collection;
472
491
        
 
492
        /*
 
493
        **      Persistent nodeid counter
 
494
        */
 
495
        fxarray<uint32_t> nodeid_counter;
473
496
 
474
497
public:
475
 
        symbol_table symtab; // string storage
 
498
        // string storage
 
499
        fxcharheap string_store;
 
500
 
 
501
        // nodeid services
 
502
        nodeid next_nodeid();
 
503
        nodeid context_nodeid();
 
504
 
 
505
        // variables 
476
506
        void push_var(rchandle<var_binding>);
477
507
        rchandle<item_iterator> get_var_value(
478
508
                rchandle<QName>) const throw (xqp_exception);
479
509
 
 
510
        // context item
 
511
  rchandle<item> get_context_item() const { return context_item_h; }
480
512
        uint32_t get_context_position() const { return context_position; }
481
513
        uint32_t get_context_size() const { return context_size; }
 
514
 
 
515
        // local time
482
516
        time_t get_currtime() const { return currtime; }
483
517
        int get_timezone() const { return timezone; }
484
518
                
485
 
  item_iterator get_context_item() const { return context_item; }
 
519
        // default doc/collection
486
520
        item_iterator get_document(std::string const&) const throw (xqp_exception);
487
521
        item_iterator get_collection(std::string const&) const throw (xqp_exception);
488
522
        item_iterator get_default_collection() const throw (xqp_exception);
489
523
        
 
524
        // function library
490
525
        function_impl const* get_function(signature const&) const
491
526
        throw (xqp_exception);
492
527
        
493
 
public:     // diagnostic flags
 
528
        // diagnostic flags
494
529
  enum diagnostic_flag_t {
495
530
    trace_functions   = 1,
496
531
    trace_timing      = 2,