File : a-strfix.ads


   1 ------------------------------------------------------------------------------
   2 --                                                                          --
   3 --                         GNAT RUN-TIME COMPONENTS                         --
   4 --                                                                          --
   5 --                    A D A . S T R I N G S . F I X E D                     --
   6 --                                                                          --
   7 --                                 S p e c                                  --
   8 --                                                                          --
   9 -- This specification is derived from the Ada Reference Manual for use with --
  10 -- GNAT.  In accordance with the copyright of that document, you can freely --
  11 -- copy and modify this specification,  provided that if you redistribute a --
  12 -- modified version,  any changes that you have made are clearly indicated. --
  13 --                                                                          --
  14 ------------------------------------------------------------------------------
  15 
  16 with Ada.Strings.Maps;
  17 
  18 package Ada.Strings.Fixed is
  19    pragma Preelaborate;
  20 
  21    --------------------------------------------------------------
  22    -- Copy Procedure for Strings of Possibly Different Lengths --
  23    --------------------------------------------------------------
  24 
  25    procedure Move
  26      (Source  : String;
  27       Target  : out String;
  28       Drop    : Truncation := Error;
  29       Justify : Alignment  := Left;
  30       Pad     : Character  := Space);
  31 
  32    ------------------------
  33    -- Search Subprograms --
  34    ------------------------
  35 
  36    function Index
  37      (Source  : String;
  38       Pattern : String;
  39       Going   : Direction := Forward;
  40       Mapping : Maps.Character_Mapping := Maps.Identity) return Natural;
  41 
  42    function Index
  43      (Source  : String;
  44       Pattern : String;
  45       Going   : Direction := Forward;
  46       Mapping : Maps.Character_Mapping_Function) return Natural;
  47 
  48    function Index
  49      (Source : String;
  50       Set    : Maps.Character_Set;
  51       Test   : Membership := Inside;
  52       Going  : Direction  := Forward) return Natural;
  53 
  54    function Index
  55      (Source  : String;
  56       Pattern : String;
  57       From    : Positive;
  58       Going   : Direction := Forward;
  59       Mapping : Maps.Character_Mapping := Maps.Identity) return Natural;
  60    pragma Ada_05 (Index);
  61 
  62    function Index
  63      (Source  : String;
  64       Pattern : String;
  65       From    : Positive;
  66       Going   : Direction := Forward;
  67       Mapping : Maps.Character_Mapping_Function) return Natural;
  68    pragma Ada_05 (Index);
  69 
  70    function Index
  71      (Source  : String;
  72       Set     : Maps.Character_Set;
  73       From    : Positive;
  74       Test    : Membership := Inside;
  75       Going   : Direction := Forward) return Natural;
  76    pragma Ada_05 (Index);
  77 
  78    function Index_Non_Blank
  79      (Source : String;
  80       Going  : Direction := Forward) return Natural;
  81 
  82    function Index_Non_Blank
  83      (Source : String;
  84       From   : Positive;
  85       Going  : Direction := Forward) return Natural;
  86    pragma Ada_05 (Index_Non_Blank);
  87 
  88    function Count
  89      (Source  : String;
  90       Pattern : String;
  91       Mapping : Maps.Character_Mapping := Maps.Identity) return Natural;
  92 
  93    function Count
  94      (Source  : String;
  95       Pattern : String;
  96       Mapping : Maps.Character_Mapping_Function) return Natural;
  97 
  98    function Count
  99      (Source : String;
 100       Set    : Maps.Character_Set) return Natural;
 101 
 102    procedure Find_Token
 103      (Source : String;
 104       Set    : Maps.Character_Set;
 105       From   : Positive;
 106       Test   : Membership;
 107       First  : out Positive;
 108       Last   : out Natural);
 109    pragma Ada_2012 (Find_Token);
 110 
 111    procedure Find_Token
 112      (Source : String;
 113       Set    : Maps.Character_Set;
 114       Test   : Membership;
 115       First  : out Positive;
 116       Last   : out Natural);
 117 
 118    ------------------------------------
 119    -- String Translation Subprograms --
 120    ------------------------------------
 121 
 122    function Translate
 123      (Source  : String;
 124       Mapping : Maps.Character_Mapping) return String;
 125 
 126    procedure Translate
 127      (Source  : in out String;
 128       Mapping : Maps.Character_Mapping);
 129 
 130    function Translate
 131      (Source  : String;
 132       Mapping : Maps.Character_Mapping_Function) return String;
 133 
 134    procedure Translate
 135      (Source  : in out String;
 136       Mapping : Maps.Character_Mapping_Function);
 137 
 138    ---------------------------------------
 139    -- String Transformation Subprograms --
 140    ---------------------------------------
 141 
 142    function Replace_Slice
 143      (Source : String;
 144       Low    : Positive;
 145       High   : Natural;
 146       By     : String) return String;
 147 
 148    procedure Replace_Slice
 149      (Source  : in out String;
 150       Low     : Positive;
 151       High    : Natural;
 152       By      : String;
 153       Drop    : Truncation := Error;
 154       Justify : Alignment  := Left;
 155       Pad     : Character  := Space);
 156 
 157    function Insert
 158      (Source   : String;
 159       Before   : Positive;
 160       New_Item : String) return String;
 161 
 162    procedure Insert
 163      (Source   : in out String;
 164       Before   : Positive;
 165       New_Item : String;
 166       Drop     : Truncation := Error);
 167 
 168    function Overwrite
 169      (Source   : String;
 170       Position : Positive;
 171       New_Item : String) return String;
 172 
 173    procedure Overwrite
 174      (Source   : in out String;
 175       Position : Positive;
 176       New_Item : String;
 177       Drop     : Truncation := Right);
 178 
 179    function Delete
 180      (Source  : String;
 181       From    : Positive;
 182       Through : Natural) return String;
 183 
 184    procedure Delete
 185      (Source  : in out String;
 186       From    : Positive;
 187       Through : Natural;
 188       Justify : Alignment := Left;
 189       Pad     : Character := Space);
 190 
 191    ---------------------------------
 192    -- String Selector Subprograms --
 193    ---------------------------------
 194 
 195    function Trim
 196      (Source : String;
 197       Side   : Trim_End) return String;
 198 
 199    procedure Trim
 200      (Source  : in out String;
 201       Side    : Trim_End;
 202       Justify : Alignment := Left;
 203       Pad     : Character := Space);
 204 
 205    function Trim
 206      (Source : String;
 207       Left   : Maps.Character_Set;
 208       Right  : Maps.Character_Set) return String;
 209 
 210    procedure Trim
 211      (Source  : in out String;
 212       Left    : Maps.Character_Set;
 213       Right   : Maps.Character_Set;
 214       Justify : Alignment := Strings.Left;
 215       Pad     : Character := Space);
 216 
 217    function Head
 218      (Source : String;
 219       Count  : Natural;
 220       Pad    : Character := Space) return String;
 221 
 222    procedure Head
 223      (Source  : in out String;
 224       Count   : Natural;
 225       Justify : Alignment := Left;
 226       Pad     : Character := Space);
 227 
 228    function Tail
 229      (Source : String;
 230       Count  : Natural;
 231       Pad    : Character := Space) return String;
 232 
 233    procedure Tail
 234      (Source  : in out String;
 235       Count   : Natural;
 236       Justify : Alignment := Left;
 237       Pad     : Character := Space);
 238 
 239    ----------------------------------
 240    -- String Constructor Functions --
 241    ----------------------------------
 242 
 243    function "*"
 244      (Left  : Natural;
 245       Right : Character) return String;
 246 
 247    function "*"
 248      (Left  : Natural;
 249       Right : String) return String;
 250 
 251 end Ada.Strings.Fixed;