Index

Package: Associations

Description

package Associations is

Classes

Association

type Association is new Object with private;

Ancestors:

Primitive operations:

Adjust (overriding Objects.Adjust)
Delete (overriding Objects.Delete)
Object_Input
Object_Read (overriding Objects.Object_Read)
Object_Write (overriding Objects.Object_Write)
Objects.Construct (Inherited)
To_String (overriding Objects.To_String)
An Association is an ordered map of strings to Value objects. Names are case insensitive. Associations do not subclass the Value class to avoid the possibility of nesting.

Types

A_Association

type A_Association is access all Association'Class;

Subprograms & Entries

Create_Association

function Create_Association return A_Association;
Creates a new empty association.

As_Boolean

function As_Boolean
( this: access Association;
name: String ) return Boolean;
Returns the named value in the association as a boolean. An exception is raised if the value is not found or if it can't be converted to a boolean.

As_Integer

function As_Integer
( this: access Association;
name: String ) return Integer;
Returns the named value in the association as an integer. An exception is raised if the value is not found or if it can't be converted to an integer.

As_String

function As_String
( this: access Association;
name: String ) return String;
Returns the named value in the association as a string. An exception is raised if the value is not found or if it can't be converted to a string.

Is_Defined

function Is_Defined
( this: access Association;
name: String ) return Boolean;
Returns True if 'name' is defined with a value in the association.

Iterate

procedure Iterate
( this: access Association;
examine: not null access procedure( name : String;
value: A_Value ) );
Iterates through the name/value pairs in the association. The iteration will be in alphabetical order of names.

Length

function Length
( this: access Association ) return Natural;
Returns the number of name/value pairs in the assocation.

Object_Input

function Object_Input
( stream: access Root_Stream_Type'Class ) return Association;
Reads an Association from a stream. This should not be called directly.

Remove

procedure Remove
( this: access Association;
name: String );
Removes the named value from the association.

Set_Default

procedure Set_Default
( this: access Association;
name: String;
val: Boolean );
Sets a boolean value in the association by name if it isn't defined.

Set_Default

procedure Set_Default
( this: access Association;
name: String;
val: Integer );
Sets an integer value in the association by name if it isn't defined.

Set_Default

procedure Set_Default
( this: access Association;
name: String;
val: String );
Sets a string value in the association by name if it isn't defined.

Set_Default

procedure Set_Default
( this: access Association;
name: String;
val: in out A_Value );
Sets a value in the association by name if it isn't defined, consuming 'val'.

Set_Value

procedure Set_Value
( this: access Association;
name: String;
val: Boolean );
Sets a boolean value in the association by name.

Set_Value

procedure Set_Value
( this: access Association;
name: String;
val: Integer );
Sets an integer value in the association by name.

Set_Value

procedure Set_Value
( this: access Association;
name: String;
val: String );
Sets a string value in the association by name.

Set_Value

procedure Set_Value
( this: access Association;
name: String;
val: in out A_Value );
Sets a value in the association by name, consuming 'val'.

Copy

function Copy
( src: A_Association ) return A_Association;
Returns a deep copy of the assocation or null of 'src' is null.

Delete

procedure Delete
( this: in out A_Association );
Deletes the association.