4.2.48. GNATCOLL.String_List_Builders

package GNATCOLL.String_List_Builders is

   package OS renames GNATCOLL.OS;
   package GS renames GNAT.Strings;

   type String_List_Builder is limited private;
   --  String_List_Builder is an efficient unbounded structure to create list
   --  of strings by aggregation. The structure also allow export to **char
   --  in C without reallocation.

   procedure Append (Self : in out String_List_Builder; Item : String);
   --  Append string Item to Self.

   procedure Append (Self  : in out String_List_Builder;
                     Other : String_List_Builder);
   --  Append builder Other to Self.

   procedure Delete (Self : in out String_List_Builder; Index : Positive);
   --  Remove Index(th) element from Self.

   function Length (Self : String_List_Builder) return Natural
   with Inline => True;
   --  Return number of elements stored

   function Element
      (Self  : String_List_Builder; Index : Positive) return String
   with Inline => True;
   --  Return Index(th) element of the list as a string

   function Element
      (Self : String_List_Builder; Index : Positive) return OS.C_String
   with Inline => True;
   --  Return Index(th) element of the list as a char* C string

   procedure Deallocate (Self : in out String_List_Builder);
   --  Free memory used by Self (reseting Self to the empty list).

   function As_List (Self : String_List_Builder) return GS.String_List;
   --  Return a String_List representation

   function As_C_String_Array
      (Self : String_List_Builder) return OS.C_String_Array;
   --  Return the address to the "char**" representation of the
   --  structure.

   function As_C_String (Self : String_List_Builder) return OS.C_String;
   --  Return the address to a block of C strings. A block consists of
   --  a null-terminated block of null-terminated strings

end GNATCOLL.String_List_Builders;