Project

Profile

Help

How to connect?
Download (2.29 KB) Statistics
| Branch: | Tag: | Revision:

he / latest9.6 / hec / Saxon.C.API / XdmItem.h @ 0608038f

1
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright (c) 2015 Saxonica Limited.
3
// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4
// If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
5
// This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0.
6
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
7

    
8
#ifndef SAXON_XDMITEM_h
9
#define SAXON_XDMITEM_h
10

    
11
#include "XdmValue.h"
12

    
13
class SaxonProcessor;
14

    
15
class XdmItem : public XdmValue
16
{
17

    
18
public:
19

    
20
     XdmItem();
21

    
22
     XdmItem(jobject);
23

    
24
    XdmItem(const XdmItem &item);
25

    
26
        
27
    virtual ~XdmItem(){
28
//std::cerr<<std::endl<<"XdmItem destructor called, refCount"<<getRefCount()<<std::endl;
29
        if(value !=NULL && proc != NULL) {
30
                        environ->env->DeleteLocalRef(value->xdmvalue);
31
        }
32
        free(value);
33
    }
34
    
35
    virtual bool isAtomic();
36

    
37
//TODO: isNode
38
//TODO: isFunction
39

    
40
    /**
41
     * Get Java XdmValue object.
42
     * @return jobject - The Java object of the XdmValue in its JNI representation
43
     */
44
     virtual  jobject getUnderlyingValue(SaxonProcessor * proc);
45

    
46
     sxnc_value * getUnderlyingCValue(){
47
        return value;
48
     }
49

    
50
     const char * getStringValue(SaxonProcessor * proc=NULL); 
51

    
52
 /**
53
     * Get the first item in the sequence
54
     * @return XdmItem or null if sequence is empty
55
     */
56
        XdmItem * getHead();
57

    
58
  /**
59
     * Get the n'th item in the value, counting from zero.
60
     *
61
     * @param n the item that is required, counting the first item in the sequence as item zero
62
     * @return the n'th item in the sequence making up the value, counting from zero
63
     * return NULL  if n is less than zero or greater than or equal to the number
64
     *                                    of items in the value
65
     * return NULL if the value is lazily evaluated and the delayed
66
     *                                    evaluation fails with a dynamic error.
67
     */
68
        XdmItem * itemAt(int n);
69

    
70
    /**
71
     * Get the number of items in the sequence
72
     *
73
     */
74
      int size();
75

    
76

    
77

    
78
        /**
79
        * Get the type of the object
80
        */
81
        virtual XDM_TYPE getType();
82

    
83
 protected:  
84
        sxnc_value* value;
85
};
86

    
87

    
88
#endif
(21-21/37)