Class TXQValue

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type TXQValue = class(TInterfacedObject, IXQValue)

Description

Base class for XQuery-variants types, implementing the IXQValue interface. All other type classes are derived from it. (it correspondes to xs:anyType)

See IXQValue for an actual description

Hierarchy

  • TInterfacedObject
  • TXQValue

Overview

Fields

Public ftypeAnnotation: TXSType;

Methods

Public constructor create(atypeAnnotation: TXSType); virtual;
Public constructor create(atypeAnnotation: TXSType; const value: IXQValue); virtual;
Public class function newinstance : tobject; override;
Public procedure AfterConstruction; override;
Public procedure FreeInstance; override;
Public function kind: TXQValueKind;
Public function typeName: string;
Public function typeAnnotation: TXSType; inline;
Public function isUndefined: boolean; virtual;
Public function toBoolean: boolean; virtual;
Public function toBooleanEffective: boolean; virtual;
Public function toInt64: int64; virtual;
Public function toFloat: xqfloat; virtual;
Public function toFloatChecked(scontext: TXQStaticContext): xqfloat; virtual;
Public function toDecimal: BigDecimal; virtual;
Public function toString: string; override;
Public function toJoinedString(const sep: string = ' '): string; virtual;
Public function toDateTime: TDateTime; virtual;
Public function toNode: TTreeNode; virtual;
Public function toArray: TXQVArray; virtual;
Public function toXQVList: TXQVList; virtual;
Public function toXQuery: string; virtual;
Public function getSequenceCount: integer; virtual;
Public function get(i: integer): IXQValue; virtual;
Public function getProperty(const name: string): IXQValue; virtual;
Public function getPropertyEnumerator: TXQValuePropertyEnumerator; virtual;
Public function getInternalDateTimeData: PXQValueDateTimeData; virtual;
Public function debugAsStringWithTypeAnnotation(textOnly: boolean = true): string; deprecated;
Public function jsonSerialize(nodeFormat: TTreeNodeSerialization; insertWhitespace: boolean = false; const indent: string = ''): string; virtual;
Public function xmlSerialize(nodeFormat: TTreeNodeSerialization; sequenceTag: string = 'seq'; elementTag: string = 'e'; objectTag: string = 'object'): string; virtual;
Public function clone: IXQValue; virtual;
Public function query(const q: string): IXQValue;
Public function query(const q: string; const vs: array of ixqvalue): IXQValue;
Public function query(const q: string; const vs: array of string): IXQValue;
Public function map(const q: string): IXQValue; virtual;
Public function map(const q: string; const vs: array of ixqvalue): IXQValue; virtual;
Public function map(const q: string; const vs: array of string): IXQValue; virtual;
Public function filter(const q: string): IXQValue; virtual;
Public function filter(const q: string; const vs: array of ixqvalue): IXQValue; virtual;
Public function filter(const q: string; const vs: array of string): IXQValue; virtual;
Public function order(const q: string): IXQValue; virtual;
Public function retrieve(): IXQValue;
Public function GetEnumerator: TXQValueEnumerator; virtual;
Public function GetEnumeratorPtrUnsafe: TXQValueEnumeratorPtrUnsafe; virtual;

Description

Fields

Public ftypeAnnotation: TXSType;
 

Methods

Public constructor create(atypeAnnotation: TXSType); virtual;
 
Public constructor create(atypeAnnotation: TXSType; const value: IXQValue); virtual;
 
Public class function newinstance : tobject; override;
 
Public procedure AfterConstruction; override;
 
Public procedure FreeInstance; override;
 
Public function kind: TXQValueKind;

Primary type of a value (actually just wraps classKind. Since you can't define class functions in the interface, but we need to do calculations with types itself)

Public function typeName: string;

XPath type name (actually just wraps typeAnnotation.name)

Public function typeAnnotation: TXSType; inline;

Returns the class underlying the interface

Public function isUndefined: boolean; virtual;

Returns true, iff the value is undefined or an empty sequence

Public function toBoolean: boolean; virtual;

Returns the value as boolean; dynamically converted, if necessary

Public function toBooleanEffective: boolean; virtual;

Returns the effective boolean value (the main difference to toBoolean is that toBooleanEffective returns true for the string "false", while toBoolean returns false)

Public function toInt64: int64; virtual;

Returns the value as int64; dynamically converted, if necessary

Public function toFloat: xqfloat; virtual;

Returns the value as xqfloat; dynamically converted, if necessary

Public function toFloatChecked(scontext: TXQStaticContext): xqfloat; virtual;
 
Public function toDecimal: BigDecimal; virtual;

Returns the value as BigDecimal; dynamically converted, if necessary

Public function toString: string; override;

Returns the value as string; dynamically converted, if necessary

Public function toJoinedString(const sep: string = ' '): string; virtual;

Returns the value as joined string (string-join($self, $sep)); dynamically converted, if necessary

Public function toDateTime: TDateTime; virtual;

Returns the value as dateTime; dynamically converted, if necessary

Public function toNode: TTreeNode; virtual;

Returns the value as node, or nil if it is not a node

Public function toArray: TXQVArray; virtual;

Returns the value as array; dynamically converted, if necessary.
If the value is a single value, the array contains just this value; if it is a sequence, the array contains all members of the sequence

Public function toXQVList: TXQVList; virtual;

Converts the TXQValue dynamically to a TXQVList sequence (and "destroys it", however you have to free the list)

Public function toXQuery: string; virtual;

Converts the value to an XQuery expression that evaluates to an equal value again (intended for debugging, not serialization, so no guarantees)

Public function getSequenceCount: integer; virtual;

Returns the number of values actually contained in this value (0 for undefined, element count for sequences, and 1 for everything else)

Public function get(i: integer): IXQValue; virtual;

Returns the i-th value in this sequence. (non-sequence values are considered to be sequences of length 1)

Public function getProperty(const name: string): IXQValue; virtual;

Returns an object property. Returns empty sequence for non objects.

Public function getPropertyEnumerator: TXQValuePropertyEnumerator; virtual;

Returns an iterator over all object properties. Raises an exception for non-objects

Public function getInternalDateTimeData: PXQValueDateTimeData; virtual;
 
Public function debugAsStringWithTypeAnnotation(textOnly: boolean = true): string; deprecated;

Warning: this symbol is deprecated.

 
Public function jsonSerialize(nodeFormat: TTreeNodeSerialization; insertWhitespace: boolean = false; const indent: string = ''): string; virtual;
 
Public function xmlSerialize(nodeFormat: TTreeNodeSerialization; sequenceTag: string = 'seq'; elementTag: string = 'e'; objectTag: string = 'object'): string; virtual;
 
Public function clone: IXQValue; virtual;
 
Public function query(const q: string): IXQValue;

Evaluates another XQuery expression on this value using the defaultQueryEngine. The return value is query whereby self is stored in $_. Use this to do an operation on all values of a sequence, e.g. sum($_)

Public function query(const q: string; const vs: array of ixqvalue): IXQValue;

Like query, sets the additional arguments as variables $_1, $_2, ...

Public function query(const q: string; const vs: array of string): IXQValue;

Like query, sets the additional arguments as variables $_1, $_2, ...

Public function map(const q: string): IXQValue; virtual;

Evaluates another XQuery expression on this value using the defaultQueryEngine. The return value is self ! query (i.e. all values in self simply mapped through query)

Public function map(const q: string; const vs: array of ixqvalue): IXQValue; virtual;

Like map, sets the additional arguments as variables $_1, $_2, ...

Public function map(const q: string; const vs: array of string): IXQValue; virtual;

Like map, sets the additional arguments as variables $_1, $_2, ...

Public function filter(const q: string): IXQValue; virtual;

Evaluates another XQuery expression on this value using the defaultQueryEngine. The return value is self [query] (i.e. all values in self filtered through query)

Public function filter(const q: string; const vs: array of ixqvalue): IXQValue; virtual;

Like filter, sets the additional arguments as variables $_1, $_2, ...

Public function filter(const q: string; const vs: array of string): IXQValue; virtual;

Like filter, sets the additional arguments as variables $_1, $_2, ...

Public function order(const q: string): IXQValue; virtual;

Orders the sequence, equivalent to query for $_ in self order by (....) return $_ . The current value is in $_. Kind of slow

Public function retrieve(): IXQValue;

Retrieves referenced resources. This is primarily used for HTTP requests, but can also retrieve files. It will parse the resource as HTML/XML/JSON if possible. It will retrieve each value in a sequence individually

Public function GetEnumerator: TXQValueEnumerator; virtual;

Implements the enumerator for for..in. (Only use with IXQValue references, not TXQValue)
Because it returns an IXQValue, it modifies the reference count of all objects in the sequence. For large sequences this is rather slow (e.g. it wastes 1 second to iterate over 10 million values in a simple benchmark.) and it is recommended to use GetEnumeratorPtrUnsafe. (it took 35ms for those 10 million values, comparable to the 30ms of a native loop not involving any enumerators)

Public function GetEnumeratorPtrUnsafe: TXQValueEnumeratorPtrUnsafe; virtual;

Implements a faster version of GetEnumerator. It does not change any reference counts, not even of self, so it must not be used with values returned by functions!


Generated by PasDoc 0.14.0.