1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
|
:mod:`Ahven.SList` -- Package
=============================
.. module:: Ahven.SList
.. moduleauthor:: Tero Koskinen <tero.koskinen@iki.fi>
.. versionadded:: 1.4
-----
Types
-----
List
''''
::
type List is new Ada.Finalization.Controlled with private;
Cursor
''''''
::
type Cursor is private;
Count_Type
''''''''''
::
subtype Count_Type is Natural;
----------
Exceptions
----------
Invalid_Cursor
''''''''''''''
::
Invalid_Cursor : exception;
Raised when the cursor given as a parameter is invalid.
For example, calling Data (Pos) when Is_Valid (Pos) returns
False causes the exception to be raised.
List_Full
'''''''''
::
List_Full : exception;
Raised when the size of the list exceeds Count_Type'Last.
------------------------
Procedures and Functions
------------------------
Append
''''''
::
procedure Append (Target : in out List; Node_Data : Element_Type);
Append an element at the end of the list.
Clear
'''''
.. versionchanged:: 1.8
Previously Clear was called Remove_All.
::
procedure Clear (Target : in out List);
Remove all elements from the list.
First
'''''
::
function First (Target : List) return Cursor;
Return a cursor to the first element of the list.
Next
''''
::
function Next (Position : Cursor) return Cursor;
Move the cursor to point to the next element on the list.
Data
''''
::
function Data (Position : Cursor) return Element_Type;
Return element pointed by the cursor.
Is_Valid
''''''''
::
function Is_Valid (Position : Cursor) return Boolean;
Tell the validity of the cursor. The cursor
will become invalid when you iterate it over
the last item.
Length
''''''
::
function Length (Target : List) return Count_Type;
Return the length of the list.
For_Each
''''''''
.. versionadded:: 1.8
::
generic
with procedure Action (T : in out Element_Type) is <>;
procedure For_Each (Target : List);
A generic procedure for walk through every item
in the list and call Action procedure for them.
|