Class TXQVariableChangeLog

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type TXQVariableChangeLog = class(TObject)

Description

XQuery variable storage

This class stores a list of variables - a IXQValue for a string name.

It is called changelog because it also stores every old value. This allows you to go back in time with pushAll/popAll.
Reading a variable by name will always return the latest value (unless it was deleted by popAll).

Hierarchy

  • TObject
  • TXQVariableChangeLog

Overview

Fields

Public readonly: boolean;
Public parentLog: TXQVariableChangeLog;

Methods

Public procedure add(name: string; const value: IXQValue; const namespaceURL: string = '');
Public procedure add(const name: string; const value: string);
Public procedure add(const name: string; const value: string; const namespaceURL: string);
Public procedure add(const name: string; const value: integer; const namespaceURL: string = '');
Public procedure add(const name: string; const value: xqfloat; const namespaceURL: string = '');
Public procedure add(const name: string; const value: bigdecimal; const namespaceURL: string = '');
Public procedure add(const name: string; const value: boolean; const namespaceURL: string = '');
Public procedure add(const name: string; const value: TDateTime; const namespaceURL: string = '');
Public procedure add(const name: string; const value: TTreeNode; const namespaceURL: string = '');
Public procedure add(variable: TXQTermVariable; const value: IXQValue); inline;
Public function get(const name: string): IXQValue;
Public function get(const name: string; const namespaceURL: string): IXQValue;
Public function get(i: integer): IXQValue; inline;
Public function indexOf(const name: string; const namespaceURL: string = ''): integer;
Public function getName(i: integer): string;
Public function getAll(const name: string; const namespaceURL: string = ''): IXQValue;
Public function getString(const name:string): string;
Public function isPropertyChange(i: integer): boolean;
Public function hasVariable(const variable: TXQTermVariable): boolean;
Public function hasVariable(const variable: string; const namespaceURL: string = ''): boolean;
Public function hasVariable(const variable: string; out value: IXQValue; const namespaceURL: string = ''): boolean;
Public function hasVariable(const variable: TXQTermVariable; out value: IXQValue): boolean;
Public constructor create();
Public destructor destroy(); override;
Public procedure clear;
Public function pushAll: integer;
Public procedure popAll(level: integer = -1);
Public procedure stringifyNodes;
Public function debugTextRepresentation: string;
Public function clone: TXQVariableChangeLog;
Public procedure assign(from: TXQVariableChangeLog);
Public function finalValues: TXQVariableChangeLog;
Public procedure takeFrom(other: TXQVariableChangeLog);
Public function condensed: TXQVariableChangeLog;
Public function collected: TXQVariableChangeLog;
Public function condensedCollected: TXQVariableChangeLog;
Public procedure addObjectModification(const variable: string; value: IXQValue; const namespaceURL: string; properties: TStringArray);

Properties

Public property Values[name:string]: IXQValue read get write add;
Public property ValuesString[name:string]: string read getString write add;
Public property Names[i:integer]: string read getName;
Public property count: integer read varcount;

Description

Fields

Public readonly: boolean;

If true, modifying the variable value raises an error

Public parentLog: TXQVariableChangeLog;
 

Methods

Public procedure add(name: string; const value: IXQValue; const namespaceURL: string = '');

Add a variable

Public procedure add(const name: string; const value: string);

Add a variable (value is converted to a IXQValue)

Public procedure add(const name: string; const value: string; const namespaceURL: string);

Add a variable (value is converted to a IXQValue)

Public procedure add(const name: string; const value: integer; const namespaceURL: string = '');

Add a variable (value is converted to a IXQValue)

Public procedure add(const name: string; const value: xqfloat; const namespaceURL: string = '');

Add a variable (value is converted to a IXQValue)

Public procedure add(const name: string; const value: bigdecimal; const namespaceURL: string = '');

Add a variable (value is converted to a IXQValue)

Public procedure add(const name: string; const value: boolean; const namespaceURL: string = '');

Add a variable (value is converted to a IXQValue)

Public procedure add(const name: string; const value: TDateTime; const namespaceURL: string = '');

Add a variable (value is converted to a IXQValue)

Public procedure add(const name: string; const value: TTreeNode; const namespaceURL: string = '');

Add a variable (value is converted to a IXQValue)

Public procedure add(variable: TXQTermVariable; const value: IXQValue); inline;

Add a variable

Public function get(const name: string): IXQValue;

Returns the value of the variable name
The returned interface points to the same instance as the interface in the internal variable storage

Public function get(const name: string; const namespaceURL: string): IXQValue;

Returns the value of the variable name
The returned interface points to the same instance as the interface in the internal variable storage

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

Value of the variable at index i
The returned interface points to the same instance as the interface in the internal variable storage

Public function indexOf(const name: string; const namespaceURL: string = ''): integer;

Returns the last index of the variable name in the internal list. (Warning: doesn't support objects, yet??) It is recommended to use hasVariable instead, the index is an implementation detail

Public function getName(i: integer): string;

Name of the variable at index i

Public function getAll(const name: string; const namespaceURL: string = ''): IXQValue;

Returns all values of the variable with name getAll as sequence

Public function getString(const name:string): string;

Returns a value as string. This is the same as get(name).toString.

Public function isPropertyChange(i: integer): boolean;
 
Public function hasVariable(const variable: TXQTermVariable): boolean;

Returns if a variable with name exists

Parameters
variable
Public function hasVariable(const variable: string; const namespaceURL: string = ''): boolean;

Returns if a variable with name exists

Parameters
variable
Public function hasVariable(const variable: string; out value: IXQValue; const namespaceURL: string = ''): boolean;

Returns if a variable with name exists, and if it does, returns its value in .

Parameters
variable
value
Public function hasVariable(const variable: TXQTermVariable; out value: IXQValue): boolean;

Returns if a variable with name exists, and if it does, returns its value in .

Parameters
variable
value
Public constructor create();
 
Public destructor destroy(); override;
 
Public procedure clear;

Clear everything

Public function pushAll: integer;

Marks the current state of the variables (in O(1))

Public procedure popAll(level: integer = -1);

Reverts all variables to the latest marked state

Public procedure stringifyNodes;
 
Public function debugTextRepresentation: string;

Dump of the log as list of name=value pairs

Public function clone: TXQVariableChangeLog;
 
Public procedure assign(from: TXQVariableChangeLog);
 
Public function finalValues: TXQVariableChangeLog;

Remove all duplicates, so that only the last version of each variable remains

Public procedure takeFrom(other: TXQVariableChangeLog);

Adds all variables from other to self, and clears other

Public function condensed: TXQVariableChangeLog;

Removes all assignments to object properties and only keeps a final assignment to the object variable that contains all properties (i.e. obj.a := 123, obj.b := 456 is condensed to a single assignment like in the pseudocode obj := {a: 123, b:456}))

Public function collected: TXQVariableChangeLog;

Collects multiple assignments to single sequence assignment. (i.e. a := 123, a := 456, a := 789 collected is equivalent to a := (123, 456, 789)) (creates a new variable log that has to be freed)

Public function condensedCollected: TXQVariableChangeLog;

Same as condensed.collected

Public procedure addObjectModification(const variable: string; value: IXQValue; const namespaceURL: string; properties: TStringArray);
 

Properties

Public property Values[name:string]: IXQValue read get write add;
 
Public property ValuesString[name:string]: string read getString write add;
 
Public property Names[i:integer]: string read getName;
 
Public property count: integer read varcount;
 

Generated by PasDoc 0.14.0.