SaxonC  11.6
Saxon Processor library for C/C++, PHP and Python
Public Member Functions | List of all members
XdmAtomicValue Class Reference

#include <XdmAtomicValue.h>

Inheritance diagram for XdmAtomicValue:
XdmItem XdmValue

Public Member Functions

 XdmAtomicValue ()
 A default Constructor. More...
 
 XdmAtomicValue (const XdmAtomicValue &other)
 A copy constructor. More...
 
virtual ~XdmAtomicValue ()
 Destructor. More...
 
 XdmAtomicValue (jobject val)
 A Java Wrapper Constructor. More...
 
 XdmAtomicValue (jobject val, const char *ty)
 A Java Wrapper Constructor. More...
 
const char * getPrimitiveTypeName ()
 Get the primitive type of this atomic value, as a QName. More...
 
bool getBooleanValue ()
 Get the value converted to a boolean using the XPath casting rules. More...
 
double getDoubleValue ()
 Get the value converted to a double using the XPath casting rules. More...
 
const char * getStringValue ()
 Get the string value of the item. More...
 
long getLongValue ()
 Get the value converted to an integer using the XPath casting rules. More...
 
void setType (const char *ty)
 Set the type annotation of the atomic value. More...
 
XdmItemgetHead ()
 Get the first item in the sequence. More...
 
bool isAtomic ()
 Determine whether the item is an atomic value or some other type of item. More...
 
int getHashCode ()
 Get a hashcode that reflects the rules for equality matching. More...
 
XDM_TYPE getType ()
 
- Public Member Functions inherited from XdmItem
 XdmItem ()
 XdmItem default constructor. More...
 
 XdmItem (jobject)
 XdmItem constructor created as a wrapper around an existing Saxon Java object. More...
 
 XdmItem (const XdmItem &item)
 Copy constructor. More...
 
virtual ~XdmItem ()
 Destructor. More...
 
virtual void incrementRefCount ()
 Increment reference count of this XdmItem - Memory management - Internal use only. More...
 
virtual void decrementRefCount ()
 Decrement reference count of this XdmItem - Memory management - Internal use only. More...
 
virtual bool isNode ()
 
virtual bool isFunction ()
 
virtual bool isMap ()
 
virtual bool isArray ()
 
virtual jobject getUnderlyingValue ()
 
const char * toString ()
 Create a string representation of the value. More...
 
XdmItemitemAt (int n)
 
int size ()
 
- Public Member Functions inherited from XdmValue
 XdmValue ()
 A default Constructor. More...
 
 XdmValue (const XdmValue &other)
 A copy constructor. More...
 
XdmValueaddXdmValueWithType (const char *tStr, const char *val)
 Add an XdmItem to the sequence. More...
 
void addXdmItem (XdmItem *val)
 
void addUnderlyingValue (jobject val)
 
 XdmValue (jobject val, bool arrFlag)
 A Constructor for handling XdmArray - Internal user only. More...
 
 XdmValue (jobject val)
 A Constructor. More...
 
virtual ~XdmValue ()
 Destructor. More...
 
void releaseXdmValue ()
 Delete the XdmValue object and clean up all items in the sequence. Release the underlying JNI object.
 
int getRefCount ()
 Get the number of references on this XdmValue. More...
 

Additional Inherited Members

- Protected Member Functions inherited from XdmValue
void initialize ()
 initialize this XdmValue with default values
 
- Protected Attributes inherited from XdmItem
jobject value
 
std::string stringValue
 
- Protected Attributes inherited from XdmValue
char * valueType
 
std::vector< XdmItem * > values
 
int xdmSize
 
int refCount
 

Detailed Description

The class XdmAtomicValue represents an item in an XPath 2.0 sequence that is an atomic value. The value may belong to any of the 19 primitive types defined in XML Schema, or to a type derived from these primitive types, or the XPath 2.0 type xs:untypedAtomic. The type may be either a built-in type or a user-defined type.

An XdmAtomicValue is immutable.

Constructor & Destructor Documentation

◆ XdmAtomicValue() [1/4]

XdmAtomicValue::XdmAtomicValue ( )

A default Constructor.

Create a empty atomic value

◆ XdmAtomicValue() [2/4]

XdmAtomicValue::XdmAtomicValue ( const XdmAtomicValue other)

A copy constructor.

Parameters
other- XdmAtomicValue

◆ ~XdmAtomicValue()

XdmAtomicValue::~XdmAtomicValue ( )
virtual

Destructor.

Destructor for this XdmAtomicValue

◆ XdmAtomicValue() [3/4]

XdmAtomicValue::XdmAtomicValue ( jobject  val)

A Java Wrapper Constructor.

Wrap a Java XdmAtomicValue object.

Parameters
val- Java XdmAtomicValue object

◆ XdmAtomicValue() [4/4]

XdmAtomicValue::XdmAtomicValue ( jobject  val,
const char *  ty 
)

A Java Wrapper Constructor.

Wrap a Java XdmAtomicValue object.

Parameters
val- Java XdmAtomicValue object
ty- type of the XdmAtomicValue

Member Function Documentation

◆ getBooleanValue()

bool XdmAtomicValue::getBooleanValue ( )

Get the value converted to a boolean using the XPath casting rules.

Returns
the result of converting to a boolean (Note: this is not the same as the effective boolean value).
Remarks
false if the value cannot be cast to a boolean. Exception will be thrown which can be retrieved via the getException method on the Processor

◆ getDoubleValue()

double XdmAtomicValue::getDoubleValue ( )

Get the value converted to a double using the XPath casting rules.

If the value is a string, the XSD 1.1 rules are used, which means that the string "+INF" is recognised.

Returns
the result of converting to a double
Remarks
zero if the value cannot be cast to a double. Exception will be thrown which can be retrieved via the getException method on the Processor

◆ getHashCode()

int XdmAtomicValue::getHashCode ( )

Get a hashcode that reflects the rules for equality matching.

Returns
a suitable hashcode

◆ getHead()

XdmItem * XdmAtomicValue::getHead ( )
virtual

Get the first item in the sequence.

Returns
XdmItem or nullptr if sequence is empty

Reimplemented from XdmItem.

◆ getLongValue()

long XdmAtomicValue::getLongValue ( )

Get the value converted to an integer using the XPath casting rules.

Returns
the result of converting to an integer
Remarks
zero if the value cannot be cast to an integer. Exception will be thrown which can be retrieved via the getException method on the Processor

◆ getPrimitiveTypeName()

const char * XdmAtomicValue::getPrimitiveTypeName ( )

Get the primitive type of this atomic value, as a QName.

The primitive types for this purpose are the 19 primitive types of XML Schema, plus xs:integer, xs:dayTimeDuration and xs:yearMonthDuration, and xs:untypedAtomic. For external objects, the result is xs:anyAtomicType.

Returns
a string of the QName naming the primitive type of this atomic value. This will always be an atomic type.

◆ getStringValue()

const char * XdmAtomicValue::getStringValue ( )
virtual

Get the string value of the item.

For a node, this gets the string value of the node. For an atomic value, it has the same effect as casting the value to a string. In all cases the result is the same as applying the XPath string() function.

For atomic values, the result is the same as the result of calling toString. This is not the case for nodes, where toString returns an XML serialization of the node.

Returns
the result of converting the item to a string.

Reimplemented from XdmItem.

◆ getType()

XDM_TYPE XdmAtomicValue::getType ( )
inlinevirtual

Get the type of the object

Reimplemented from XdmItem.

◆ isAtomic()

bool XdmAtomicValue::isAtomic ( )
inlinevirtual

Determine whether the item is an atomic value or some other type of item.

Returns
true if the item is an atomic value, false if it is a node or a function (including maps and arrays)

Reimplemented from XdmItem.

◆ setType()

void XdmAtomicValue::setType ( const char *  ty)

Set the type annotation of the atomic value.

Parameters
ty- The annotated type given as a string

The documentation for this class was generated from the following files: