SaxonC 12.7.0
Saxon Processor library for C/C++, PHP and Python
Loading...
Searching...
No Matches
Public Member Functions | List of all members
XdmAtomicValue Class Reference

The class XdmAtomicValue represents an item in an XPath sequence that is an atomic value. More...

#include <XdmAtomicValue.h>

Inheritance diagram for XdmAtomicValue:
XdmItem XdmValue

Public Member Functions

 XdmAtomicValue ()
 Default constructor.
 
 XdmAtomicValue (const XdmAtomicValue &other)
 XdmAtomicValue copy constructor.
 
virtual ~XdmAtomicValue ()
 Destructor method for XdmAtomicValue.
 
 XdmAtomicValue (int64_t val)
 XdmAtomicValue constructor to create an object which is a wrapper for a Java XdmAtomicValue object - internal use only.
 
 XdmAtomicValue (int64_t val, const char *ty)
 XdmAtomicValue constructor to create an object which is a wrapper for a Java XdmAtomicValue object - internal use only.
 
const char * getPrimitiveTypeName ()
 Get the primitive type of this atomic value, as a QName.
 
bool getBooleanValue ()
 Get the value converted to a boolean using the XPath casting rules.
 
double getDoubleValue ()
 Get the value converted to a double using the XPath casting rules.
 
const char * getStringValue (const char *encoding=nullptr)
 Get the string value of the item.
 
long getLongValue ()
 Get the value converted to an integer using the XPath casting rules.
 
void setType (const char *ty)
 Set the type annotation of the atomic value.
 
XdmItemgetHead ()
 Get the first item in the sequence consisting of just this item.
 
bool isAtomic ()
 Determine whether the item is an atomic value or some other type of item.
 
int getHashCode ()
 Get a hashcode that reflects the rules for equality matching.
 
XDM_TYPE getType ()
 Get the type of this XDM value.
 
- Public Member Functions inherited from XdmItem
 XdmItem ()
 Default constructor.
 
 XdmItem (int64_t objRef)
 XdmItem constructor to create an object which is a wrapper for a Java XdmItem object - internal use only.
 
 XdmItem (const XdmItem &item)
 XdmItem copy constructor.
 
bool operator== (const XdmItem &other) const
 
virtual ~XdmItem ()
 Destructor method for XdmItem.
 
virtual void incrementRefCount ()
 Increment reference count of this XdmItem - internal use only.
 
virtual void decrementRefCount ()
 Decrement reference count of this XdmItem - internal use only.
 
virtual bool isNode ()
 Determine whether the item is a node or some other type of item.
 
virtual bool isFunction ()
 Determine whether the item is an XDM function or some other type of item.
 
virtual bool isMap ()
 Determine whether the item is an XDM map or some other type of item.
 
virtual bool isArray ()
 Determine whether the item is an XDM array or some other type of item.
 
virtual int64_t getUnderlyingValue ()
 Get the underlying Java XdmValue object - internal use only.
 
const char * toString (const char *encoding=nullptr)
 Create a string representation of the item.
 
XdmItemitemAt (int n)
 Get the n'th item in the sequence consisting of just this item, counting from zero.
 
int size ()
 Get the number of items in the sequence.
 
- Public Member Functions inherited from XdmValue
 XdmValue ()
 Default constructor.
 
 XdmValue (const XdmValue &other)
 XdmValue copy constructor.
 
void addXdmItem (XdmItem *val)
 Add an XdmItem to the sequence.
 
virtual bool operator== (const XdmValue &other) const
 
void addXdmItemFromUnderlyingValue (XdmItem *val)
 Add an XdmItem to the sequence, when the sequence was returned from SaxonC - internal use only.
 
void addUnderlyingValue (int64_t val)
 Add Java XdmValue object to the sequence.
 
 XdmValue (int64_t val, bool arrFlag)
 A Constructor for handling XdmArray - internal use only.
 
 XdmValue (int64_t val)
 XdmValue constructor to create an object which is a wrapper for a Java XdmValue object - internal use only.
 
virtual ~XdmValue ()
 Destructor method for XdmValue.
 
void releaseXdmValue ()
 Deprecated: this is deprecated and a no-op, the C++ destructor handles this case.
 
int getRefCount ()
 Get the number of references on this XdmValue - internal use only This method is used for internal memory management.
 
void resetRelinquishedItems ()
 Reset associated reference counts on XdmItems that have been relinquished - internal use only.
 
void incrementRefCountForRelinquishedValue (int i)
 Increment the ref count for a relinquished item only once - internal use only.
 

Additional Inherited Members

- Protected Member Functions inherited from XdmValue
void initialize ()
 Initialize this XdmValue with default values.
 
- Protected Attributes inherited from XdmItem
const char * stringValue
 
const char * itemToString
 
- Protected Attributes inherited from XdmValue
char * valueType
 
XdmItem ** values
 
char * relinquished_values
 
int values_cap
 
int xdmSize
 
int refCount
 
int64_t value
 

Detailed Description

The class XdmAtomicValue represents an item in an XPath 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 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 ( )

Default constructor.

Creates an empty atomic value

◆ XdmAtomicValue() [2/4]

XdmAtomicValue::XdmAtomicValue ( const XdmAtomicValue & other)

XdmAtomicValue copy constructor.

Parameters
other- XdmAtomicValue

◆ XdmAtomicValue() [3/4]

XdmAtomicValue::XdmAtomicValue ( int64_t val)

XdmAtomicValue constructor to create an object which is a wrapper for a Java XdmAtomicValue object - internal use only.

Parameters
val- internal Java XdmAtomicValue object to be wrapped

◆ XdmAtomicValue() [4/4]

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

XdmAtomicValue constructor to create an object which is a wrapper for a Java XdmAtomicValue object - internal use only.

Parameters
val- internal Java XdmAtomicValue object to be wrapped
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 consisting of just this item.

Returns
This XdmAtomicValue

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. Memory deallocation is handled internally.

◆ getStringValue()

const char * XdmAtomicValue::getStringValue ( const char * encoding = nullptr)
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.

Parameters
encoding- the encoding of the string returned. If NULL or omitted defaults to the JVM encoding, which in most cases is UTF-8.
Returns
the result of converting the item to a string. The caller is responsible for memory deallocation.

Reimplemented from XdmItem.

◆ getType()

XDM_TYPE XdmAtomicValue::getType ( )
inlinevirtual

Get the type of this XDM value.

Returns
The type of the XdmValue as an XDM_TYPE

Reimplemented from XdmItem.

◆ isAtomic()

bool XdmAtomicValue::isAtomic ( )
inlinevirtual

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

Returns
True

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: