-- =========================================================================== -- Copyright 1996 by WPL Laboratories, Inc. All Rights Reserved -- -- WPL Laboratories, Inc. -- Whitehall Offices, Suite 6 -- 410 Lancaster Avenue -- Haverford, PA 19041 -- -- -- For Support call 610-658-2362 -- -- $Revision: 1.1 $ $Date: 1995/01/15 19:48:46 $ -- -- =========================================================================== use Ada.Strings.Unbounded; with Ada.Strings.Fixed; use Ada.Strings.Fixed; package body broken is -- ======================================================================= -- PURPOSE: -- -- OUTSTANDING ISSUES: -- ======================================================================= -- ========================= -- Text_Holder_Type -- ========================= -- ==================================================================== -- Add -- -- PURPOSE: -- Add Text into the Holder -- ==================================================================== procedure Add (Holder : in out Text_Holder_Type; Text : in String) is begin Append (Holder.Data, Text); end Add; -- ==================================================================== -- Replace -- -- PURPOSE: -- Zeros out Data of Holder and adds a new Item to Holder. -- ==================================================================== procedure Replace (Holder : in out Text_Holder_Type; Text : in String) is begin Holder.Data := To_Unbounded_String (Text); end Replace; -- ==================================================================== -- Value -- -- PURPOSE: -- Returns the Holder with its included data. -- ==================================================================== function Value (Holder : in Text_Holder_Type) return String is begin return (To_String (Holder.Data)); end Value; -- ======================== -- Object_Holder -- ======================== -- ==================================================================== -- Data_Value -- -- PURPOSE: -- Returns the Holder with its included data. -- ==================================================================== function Data_Value (Holder : in Object_Holder_Type) return String is Str_Len : Natural := Length (Holder.Data); Val : Unbounded_String; Amt_Left : String := To_String (Holder.Data); Old_Index : Positive := 1; New_Index : Positive := 1; List_Ptr : List_Handler.List_Ptr_Type := Holder.Object_List_Ptr; Object_Ptr : List_Handler.Element_Ptr_Type := null; begin if Count (Holder.Data, ">OBJECT<") = 0 then return To_String (Holder.Data); else for i in 1..Count (Holder.Data, ">OBJECT<") loop List_Handler.Next (List_Ptr, Object_Ptr); Old_Index := New_Index; New_Index := Index (Amt_Left (Old_Index .. Amt_Left'Last), ">OBJECT<"); if Old_Index /= New_Index then Append (Val, Amt_Left(Old_Index .. New_Index - 1)); end if; Append (Val, Value (Text_Holder_Type'Class (Object_Ptr.All))); New_Index := New_Index + 8; end loop; Append (Val, Amt_Left (New_Index .. Amt_Left'Last)); end if; return To_String (Val); end Data_Value; -- ==================================================================== -- Value -- -- PURPOSE: -- Returns the Holder with its included data. -- ==================================================================== function Value (Holder : in Object_Holder_Type) return String is begin return (Data_Value (Holder)); end Value; -- ==================== -- Broken_Type -- ==================== -- ==================================================================== -- Add -- -- PURPOSE: -- Add an Item to the Holder -- ==================================================================== procedure Add (Holder : in out Object_Holder_Type'Class; Item : in Broken_Type) is begin List_Handler.Add_To_End (List => Holder.Object_List_Ptr, Element => Item); -- ----------------------------------------------- -- Now add Object placement modifier here! -- ----------------------------------------------- Append (Holder.Data, ">OBJECT<"); end Add; -- ==================================================================== -- Replace -- -- PURPOSE: -- Zeros out Data of Holder and adds a new Item to Holder. -- ==================================================================== procedure Replace (Holder : in out Object_Holder_Type'Class; Item : in Broken_Type) is begin Holder.Object_List_Ptr := null; List_Handler.Add_To_End (List => Holder.Object_List_Ptr, Element => Item); Holder.Data := To_Unbounded_String (">OBJECT<"); end Replace; end broken;