Saxon/C  1.2.1
Saxon Processor library for C/C++, PHP and Python
XdmItem.h
1 // 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.
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(getRefCount()<1){
30  if(value !=NULL && proc != NULL && SaxonProcessor::jvmCreatedCPP>0) {
31  SaxonProcessor::sxn_environ->env->DeleteLocalRef(value->xdmvalue);
32  }
33  free(value);
34  if(stringValue.empty()) {
35  stringValue.clear();
36  }
37  }
38  }
39 
40 virtual void incrementRefCount() {
41  refCount++;
42  //std::cerr<<"refCount-inc-xdmItem="<<refCount<<" ob ref="<<(this)<<std::endl;
43  }
44 
45 virtual void decrementRefCount() {
46  if (refCount > 0)
47  refCount--;
48  //std::cerr<<"refCount-dec-xdmItem="<<refCount<<" ob ref="<<(this)<<std::endl;
49  }
50 
51  virtual bool isAtomic();
52 
53 //TODO: isNode
54 //TODO: isFunction
55 
60  virtual jobject getUnderlyingValue();
61 
62  sxnc_value * getUnderlyingCValue(){
63  return value;
64  }
65 
66 
79  virtual const char * getStringValue();
80 
85  XdmItem * getHead();
86 
97  XdmItem * itemAt(int n);
98 
103  int size();
104 
105 
106 
110  virtual XDM_TYPE getType();
111 
112  protected:
113  sxnc_value* value;
114  std::string stringValue;
115 };
116 
117 
118 #endif
virtual const char * getStringValue()
Definition: XdmItem.cpp:56
Definition: XdmValue.h:46
std::string stringValue
Definition: XdmItem.h:114
Definition: SaxonProcessor.h:296
Definition: XdmItem.h:15
XdmItem * itemAt(int n)
Definition: XdmItem.cpp:33
Definition: SaxonCXPath.h:12
virtual XDM_TYPE getType()
Definition: XdmItem.cpp:83
virtual jobject getUnderlyingValue()
Definition: XdmItem.cpp:46
int size()
Definition: XdmItem.cpp:42
XdmItem * getHead()
Definition: XdmItem.cpp:31