Index

Package: Values

Description

package Values is
Copyright (c) 2012-2013 Kevin Wellwood All rights reserved. This source code is distributed under the Modified BSD License. For terms and conditions, see license.txt.

Classes

Value (abstract)

type Value is abstract tagged private;
A Value represents a generic value of one of the primitive types. The value can be converted to other types in some cases. Instances of the Value class can be copied and written to a stream.

Types

Value_Type

type Value_Type is
    (
        V_NULL,
        V_BOOLEAN,
        V_NUMBER,
        V_STRING,
        V_ID,
        V_LIST,
        V_ASSOCIATION,
        V_ERROR
    );
Defines the different primitive value types

Constants & Global variables

Cast_Exception

Cast_Exception : exception;
Raise when an abstract Value can't be cast to a specific Value class

Subprograms & Entries

Clone (abstract)

function Clone
( this: access Value ) return Value_Ptr'Class is abstract;

Compare (abstract)

function Compare
( this: Value;
other: Value'Class ) return Integer is abstract;
Compares 'this' to 'other', returning -1 if this is less than 'other', zero if this equals 'other', and 1 if this is greater than 'other'. If 'this' and 'other' are of different value types, then the comparison is based on the values' relative positions in the Value_Type enumeration.

Compare

function Compare
( this: Value'Class;
other: access Value'Class ) return Integer;

Get_Type (abstract)

function Get_Type
( this: Value ) return Value_Type is abstract;
Returns the primitive type of the value.

Image (abstract)

function Image
( this: Value ) return String is abstract;
Returns a depiction of the value as a string.

Value_Input (abstract)

function Value_Input
( stream: access Root_Stream_Type'Class ) return Value is abstract;
Streaming

Value_Read (abstract)

procedure Value_Read
( stream: access Root_Stream_Type'Class;
obj: out Value ) is abstract;

Value_Write (abstract)

procedure Value_Write
( stream: access Root_Stream_Type'Class;
obj: Value ) is abstract;

"="

function "="
( this: Value;
other: Value ) return Boolean;

<

function "<"
( this: Value'Class;
other: Value'Class ) return Boolean;

>

function ">"
( this: Value'Class;
other: Value'Class ) return Boolean;

<=

function "<="
( this: Value'Class;
other: Value'Class ) return Boolean;

>=

function ">="
( this: Value'Class;
other: Value'Class ) return Boolean;

To_Ptr

function To_Ptr
( val: access Value'Class ) return Value_Ptr;

Clone

function Clone
( this: Value_Ptr'Class ) return Value_Ptr;
Returns a copy of the target value, or Nul if the pointer has no target.

Get

function Get
( this: Value_Ptr ) return access Value'Class;

Refcount

function Refcount
( this: Value_Ptr'Class ) return Natural;

Image

function Image
( this: Value_Ptr'Class ) return String;

Is_Null

function Is_Null
( this: Value_Ptr'Class ) return Boolean;

Not_Null

function Not_Null
( this: Value_Ptr'Class ) return Boolean;

Set

procedure Set
( this: in out Value_Ptr;
target: access Value'Class );

Value_Ptr_Input

function Value_Ptr_Input
( stream: access Root_Stream_Type'Class ) return Value_Ptr;

Value_Ptr_Output

procedure Value_Ptr_Output
( stream: access Root_Stream_Type'Class;
this: Value_Ptr );

"="

function "="
( l, r: Value_Ptr ) return Boolean;
Thee following comparison operators map to Value equivalence comparison operators. The null pointer cases are handled safely.

"<"

function "<"
( l, r: Value_Ptr ) return Boolean;

">"

function ">"
( l, r: Value_Ptr ) return Boolean;

"<="

function "<="
( l, r: Value_Ptr ) return Boolean;

">="

function ">="
( l, r: Value_Ptr ) return Boolean;