with Values.Lists; use Values.Lists;
private with Ada.Containers.Indefinite_Ordered_Maps;
package Values.Associations is
type Assoc_Value is new Value with private;
type Assoc_Ptr is new Value_Ptr with private;
function Create_Assoc return Assoc_Ptr;
overriding
function Clone( this : access Assoc_Value ) return Value_Ptr'Class;
overriding
function Compare( this : Assoc_Value; other : Value'Class ) return Integer;
overriding
function Get_Type( this : Assoc_Value ) return Value_Type;
overriding
function Image( this : Assoc_Value ) return String;
function Get( this : Assoc_Value; field : String ) return Value_Ptr;
function Is_Empty( this : Assoc_Value ) return Boolean;
procedure Iterate( this : Assoc_Value;
examine : not null access procedure( key : String;
value : Value_Ptr ) );
function Get_Keys( this : Assoc_Value ) return List_Ptr;
function Size( this : Assoc_Value ) return Natural;
procedure Set( this : in out Assoc_Value;
field : String;
val : Value_Ptr'Class );
function As_Assoc( ptr : Value_Ptr'Class ) return Assoc_Ptr;
function As_Value( this : Assoc_Ptr ) return Value_Ptr;
function Get( this : Assoc_Ptr ) return access Assoc_Value'Class;
Nul : constant Assoc_Ptr;
private
package Value_Maps is new Ada.Containers.Indefinite_Ordered_Maps( String, Value_Ptr, "<", "=" );
type Assoc_Value is new Value with
record
val : Value_Maps.Map;
end record;
type A_Naked_Assoc is access all Assoc_Value'Class;
overriding
procedure Delete( this : in out Assoc_Value );
overriding
function Value_Input( stream : access Root_Stream_Type'Class ) return Assoc_Value;
for Assoc_Value'Input use Value_Input;
overriding
procedure Value_Read( stream : access Root_Stream_Type'Class; this : out Assoc_Value );
for Assoc_Value'Read use Value_Read;
procedure Value_Write( stream : access Root_Stream_Type'Class; this : Assoc_Value );
for Assoc_Value'Write use Value_Write;
type Assoc_Ptr is new Value_Ptr with null record;
Nul : constant Assoc_Ptr := (Value_Ptr with others => <>);
end Values.Associations;