Project

Profile

Help

Download (3.5 KB) Statistics
| Branch: | Revision:

he / src / main / c / Saxon.C.API / XdmItem.h @ 03fcd3f9

1 72bf04c6 Norman Walsh
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
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 ead48a5d O'Neil Delpratt
     explicit XdmItem(jobject);
23 72bf04c6 Norman Walsh
24
    XdmItem(const XdmItem &item);
25
26
        
27 ead48a5d O'Neil Delpratt
    virtual ~XdmItem();
28
29
    virtual void incrementRefCount();
30
31
    virtual void decrementRefCount();
32 501beb26 O'Neil Delpratt
33
    /**
34
     * Determine whether the item is an atomic value or some other type of item
35
     *
36
     * @return true if the item is an atomic value, false if it is a node or a function (including maps and arrays)
37
     */
38 72bf04c6 Norman Walsh
    virtual bool isAtomic();
39
40 501beb26 O'Neil Delpratt
41
    /**
42
     * Determine whether the item is a node or some other type of item
43
     *
44
     * @return true if the item is a node, false if it is an atomic value or a function (including maps and arrays)
45
     */
46 61decfd8 Norman Walsh
    virtual bool isNode();
47
48 501beb26 O'Neil Delpratt
    /**
49
     * Determine whether the item is a function or some other type of item
50
     *
51
     * @return true if the item is a Xdm function item, false if it is an atomic value or a function (including maps and arrays)
52
     */
53 61decfd8 Norman Walsh
    virtual bool isFunction();
54 72bf04c6 Norman Walsh
55
    /**
56
     * Get Java XdmValue object.
57
     * @return jobject - The Java object of the XdmValue in its JNI representation
58
     */
59
     virtual  jobject getUnderlyingValue();
60
61
62
63
    /**
64
     * Get the string value of the item. For a node, this gets the string value
65
     * of the node. For an atomic value, it has the same effect as casting the value
66
     * to a string. In all cases the result is the same as applying the XPath string()
67
     * function.
68
     * <p>For atomic values, the result is the same as the result of calling
69
     * <code>toString</code>. This is not the case for nodes, where <code>toString</code>
70
     * returns an XML serialization of the node.</p>
71
     *
72
     * @return the result of converting the item to a string.
73
     * @deprecated the SaxonProcessor argument. It has been removed from release version 1.2.1
74
     */
75
     virtual const char * getStringValue();
76
77
 /**
78
     * Get the first item in the sequence
79 ead48a5d O'Neil Delpratt
     * @return XdmItem or nullptr if sequence is empty
80 72bf04c6 Norman Walsh
     */
81
        XdmItem * getHead();
82
83
  /**
84
     * Get the n'th item in the value, counting from zero.
85
     *
86
     * @param n the item that is required, counting the first item in the sequence as item zero
87
     * @return the n'th item in the sequence making up the value, counting from zero
88 ead48a5d O'Neil Delpratt
     * return nullptr  if n is less than zero or greater than or equal to the number
89 72bf04c6 Norman Walsh
     *                                    of items in the value
90 ead48a5d O'Neil Delpratt
     * return nullptr if the value is lazily evaluated and the delayed
91 72bf04c6 Norman Walsh
     *                                    evaluation fails with a dynamic error.
92
     */
93
        XdmItem * itemAt(int n);
94
95
    /**
96
     * Get the number of items in the sequence
97
     *
98
     */
99
      int size();
100
101
102
103
        /**
104
        * Get the type of the object
105
        */
106
        virtual XDM_TYPE getType();
107
108
 protected:  
109 61decfd8 Norman Walsh
        jobject value;
110 72bf04c6 Norman Walsh
        std::string stringValue;  /*!< Cached. String representation of the XdmValue, if available */
111
};
112
113
114
#endif