-- $Date: 2004/01/02 10:01:37 $
-- $Revision: 1.8 $
-- $Author: jcrocholl $

package body String_Lists is

   --------------------
   -- List construction
   --------------------

   -- Insert an item at the end of the list.
   procedure Push
     (This    : in out List;  -- The list to modify.
      Content : in String) is -- The item to insert.
   begin
      US_Lists.Push(This, To_Unbounded_String(Content));
   end Push;

   -- Insert an item at the beginning of the list.
   procedure Unshift
     (This    : in out List;  -- The list to modify.
      Content : in String) is -- The item to insert.
   begin
      US_Lists.Unshift(This, To_Unbounded_String(Content));
   end Unshift;

   ------------------------
   -- Iterating over a list
   ------------------------

   -- Read the item at the current iteration pointer.
   function Current
     (This : in List-- The list to iterate over.
     return String is -- Current item.
   begin
      return To_String(US_Lists.Current(This));
   end Current;

   --------------------------------------
   -- Manipulating a list while iterating
   --------------------------------------

   -- Update the item at the current iteration pointer.
   procedure Update_Current
     (This    : in out List;  -- The list to modify.
      Content : in String) is -- New content for the current item.
   begin
      US_Lists.Update_Current(This, To_Unbounded_String(Content));
   end Update_Current;

   -- Insert an item directly before the item at the current iteration
   -- pointer.
   procedure Insert_Before_Current
     (This    : in out List;  -- The list to modify.
      Content : in String) is -- The item to insert.
   begin
      US_Lists.Insert_Before_Current(This, To_Unbounded_String(Content));
   end Insert_Before_Current;

   -- Insert an item directly after the item at the current iteration
   -- pointer.
   procedure Insert_After_Current
     (This    : in out List;  -- The list to modify.
      Content : in String) is -- The item to insert.
   begin
      US_Lists.Insert_After_Current(This, To_Unbounded_String(Content));
   end Insert_After_Current;

end String_Lists;