Index

Package: Associations

Description

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

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: not null access Association'Class;
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: not null access Association'Class;
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: not null access Association'Class;
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.

Get_Value

function Get_Value
( this: not null access Association'Class;
name: String ) return A_Value;
Returns a copy of the named value in the association. Null will be returned if the value is not found.

Is_Defined

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

Iterate

procedure Iterate
( this: not null access Association'Class;
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: not null access Association'Class ) 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: not null access Association'Class;
name: String );
Removes the named value from the association.

Set_Default

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

Set_Default

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

Set_Default

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

Set_Default

procedure Set_Default
( this: not null access Association'Class;
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: not null access Association'Class;
name: String;
val: Boolean );
Sets a boolean value in the association by name.

Set_Value

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

Set_Value

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

Set_Value

procedure Set_Value
( this: not null access Association'Class;
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.