On this page
- Unbounded_Wide_String
- Length
- Code
- To_Wide_String
- Null_Unbounded_Wide_String
- To_Unbounded_Wide_String
- To_Unbounded_Wide_String
- Wide_String_Access
- Free
- Set_Unbounded_Wide_String
- Append
- Append
- Append
- Append
- Append
- Append
- Append
- Append
- Element
- Replace_Element
- Slice
- Unbounded_Slice
- Unbounded_Slice
- Index
- Index
- Index
- Index
- Index
- Index
- Index_Non_Blank
- Index_Non_Blank
- Count
- Count
- Count
- Find_Token
- Find_Token
- Translate
- Translate
- Translate
- Translate
- Replace_Slice
- Replace_Slice
- Insert
- Insert
- Overwrite
- Overwrite
- Delete
- Delete
- Trim
- Trim
- Trim
- Trim
- Head
- Head
- Tail
- Tail
Package Ada.Strings.Wide_Unbounded
Verada predefined library: Ada.Strings.Wide_Unbounded (Ada RM A.4.5, A.4.7): strings of any length, copied as other values are. A value holds a Verada.Strings.Texts.Text, whose characters a copy shares and the last holder frees. Each operation is stated by its model, To_Wide_String, and Ada.Strings.Wide_Fixed's operation on it, so that a proof of one carries over. Only memory limits the length (Verada.Storage): an operation that would make a longer string raises Storage_Error, as an allocation the heap cannot make does. Where the RM raises Index_Error or Pattern_Error, a precondition requires what avoids it. (Generated from tools/library/unbounded.vads.in by tools/library/strings-widths.vb.)
Unbounded_Wide_String
type Unbounded_Wide_String is private
with Default_Initial_Condition => Length (Unbounded_Wide_String) = 0;Length
function Length (Source : Unbounded_Wide_String) return Natural
with Global => null,
Post => Length'Result < Verada.Storage.Length_Bound;Code
function Code (Source : Unbounded_Wide_String; Index : Positive) return Natural
with Ghost, Global => null,
Pre => Index <= Length (Source);(Verada, for contracts) the position of the character at Index
To_Wide_String
function To_Wide_String (Source : Unbounded_Wide_String) return Wide_String
with Global => null,
Post => To_Wide_String'Result'Length = Length (Source) and then To_Wide_String'Result'First = 1 and then To_Wide_String'Result'Last = Length (Source)
and then (for all I in To_Wide_String'Result'Range => Wide_Character'Pos (To_Wide_String'Result (I)) = Code (Source, I));the model of a value: its characters, from 1
Null_Unbounded_Wide_String
Null_Unbounded_Wide_String : constant Unbounded_Wide_String;To_Unbounded_Wide_String
function To_Unbounded_Wide_String (Source : Wide_String) return Unbounded_Wide_String
with Global => null,
Post => To_Wide_String (To_Unbounded_Wide_String'Result) = Source;To_Unbounded_Wide_String
function To_Unbounded_Wide_String (Length : Natural) return Unbounded_Wide_String
with Global => null,
Post => To_Wide_String (To_Unbounded_Wide_String'Result) = Wide_Fixed."*" (Length, Wide_Space);a string of Length spaces
Wide_String_Access
type Wide_String_Access is access Wide_String;an access to a string, which Free deallocates (pool-specific, as Verada frees only what an allocator made)
Free
procedure Free (X : in out Wide_String_Access)
with Global => null,
Post => X = null;Set_Unbounded_Wide_String
procedure Set_Unbounded_Wide_String (Target : out Unbounded_Wide_String; Source : Wide_String)
with Global => null,
Post => To_Wide_String (Target) = Source;Append
function Append (Left, Right : Unbounded_Wide_String) return Unbounded_Wide_String
with Global => null,
Post => To_Wide_String (Append'Result) = To_Wide_String (Left) & To_Wide_String (Right);Append
function Append (Left : Unbounded_Wide_String; Right : Wide_String) return Unbounded_Wide_String
with Global => null,
Post => To_Wide_String (Append'Result) = To_Wide_String (Left) & Right;Append
function Append (Left : Wide_String; Right : Unbounded_Wide_String) return Unbounded_Wide_String
with Global => null,
Post => To_Wide_String (Append'Result) = Wide_Fixed.Joined (Left, To_Wide_String (Right), "");Append
function Append (Left : Unbounded_Wide_String; Right : Wide_Character) return Unbounded_Wide_String
with Global => null,
Post => To_Wide_String (Append'Result) = To_Wide_String (Left) & Right;Append
function Append (Left : Wide_Character; Right : Unbounded_Wide_String) return Unbounded_Wide_String
with Global => null,
Post => To_Wide_String (Append'Result) = Left & To_Wide_String (Right);Append
procedure Append (Source : in out Unbounded_Wide_String; New_Item : Unbounded_Wide_String)
with Global => null,
Post => To_Wide_String (Source) = To_Wide_String (Source)'Old & To_Wide_String (New_Item);Append
procedure Append (Source : in out Unbounded_Wide_String; New_Item : Wide_String)
with Global => null,
Post => To_Wide_String (Source) = To_Wide_String (Source)'Old & New_Item;Append
procedure Append (Source : in out Unbounded_Wide_String; New_Item : Wide_Character)
with Global => null,
Post => To_Wide_String (Source) = To_Wide_String (Source)'Old & New_Item;function "&" (Left, Right : Unbounded_Wide_String) return Unbounded_Wide_String
with Global => null,
Post => To_Wide_String ("&"'Result) = To_Wide_String (Left) & To_Wide_String (Right);function "&" (Left : Unbounded_Wide_String; Right : Wide_String) return Unbounded_Wide_String
with Global => null,
Post => To_Wide_String ("&"'Result) = To_Wide_String (Left) & Right;function "&" (Left : Wide_String; Right : Unbounded_Wide_String) return Unbounded_Wide_String
with Global => null,
Post => To_Wide_String ("&"'Result) = Wide_Fixed.Joined (Left, To_Wide_String (Right), "");function "&" (Left : Unbounded_Wide_String; Right : Wide_Character) return Unbounded_Wide_String
with Global => null,
Post => To_Wide_String ("&"'Result) = To_Wide_String (Left) & Right;function "&" (Left : Wide_Character; Right : Unbounded_Wide_String) return Unbounded_Wide_String
with Global => null,
Post => To_Wide_String ("&"'Result) = Left & To_Wide_String (Right);Element
function Element (Source : Unbounded_Wide_String; Index : Positive) return Wide_Character
with Global => null,
Pre => Index <= Length (Source),
Post => Element'Result = To_Wide_String (Source) (Index);Replace_Element
procedure Replace_Element (Source : in out Unbounded_Wide_String; Index : Positive; By : Wide_Character)
with Global => null,
Pre => Index <= Length (Source),
Post => To_Wide_String (Source) = Wide_Fixed.Overwrite (To_Wide_String (Source)'Old, Index, (1 => By));Slice
function Slice (Source : Unbounded_Wide_String; Low : Positive; High : Natural) return Wide_String
with Global => null,
Pre => Low <= Length (Source) + 1 and then High <= Length (Source),
Post => Slice'Result = To_Wide_String (Source) (Low .. High);the characters at Low .. High, with those bounds
Unbounded_Slice
function Unbounded_Slice (Source : Unbounded_Wide_String; Low : Positive; High : Natural) return Unbounded_Wide_String
with Global => null,
Pre => Low <= Length (Source) + 1 and then High <= Length (Source),
Post => To_Wide_String (Unbounded_Slice'Result) = To_Wide_String (Source) (Low .. High);Unbounded_Slice
procedure Unbounded_Slice (Source : Unbounded_Wide_String; Target : out Unbounded_Wide_String; Low : Positive; High : Natural)
with Global => null,
Pre => Low <= Length (Source) + 1 and then High <= Length (Source),
Post => To_Wide_String (Target) = To_Wide_String (Source) (Low .. High);function "=" (Left, Right : Unbounded_Wide_String) return Boolean
with Global => null,
Post => "="'Result = (To_Wide_String (Left) = To_Wide_String (Right));function "=" (Left : Unbounded_Wide_String; Right : Wide_String) return Boolean
with Global => null,
Post => "="'Result = (To_Wide_String (Left) = Right);function "=" (Left : Wide_String; Right : Unbounded_Wide_String) return Boolean
with Global => null,
Post => "="'Result = (Left = To_Wide_String (Right));function "<" (Left, Right : Unbounded_Wide_String) return Boolean
with Global => null,
Post => "<"'Result = (To_Wide_String (Left) < To_Wide_String (Right));function "<" (Left : Unbounded_Wide_String; Right : Wide_String) return Boolean
with Global => null,
Post => "<"'Result = (To_Wide_String (Left) < Right);function "<" (Left : Wide_String; Right : Unbounded_Wide_String) return Boolean
with Global => null,
Post => "<"'Result = (Left < To_Wide_String (Right));function "<=" (Left, Right : Unbounded_Wide_String) return Boolean
with Global => null,
Post => "<="'Result = (To_Wide_String (Left) <= To_Wide_String (Right));function "<=" (Left : Unbounded_Wide_String; Right : Wide_String) return Boolean
with Global => null,
Post => "<="'Result = (To_Wide_String (Left) <= Right);function "<=" (Left : Wide_String; Right : Unbounded_Wide_String) return Boolean
with Global => null,
Post => "<="'Result = (Left <= To_Wide_String (Right));function ">" (Left, Right : Unbounded_Wide_String) return Boolean
with Global => null,
Post => ">"'Result = (To_Wide_String (Left) > To_Wide_String (Right));function ">" (Left : Unbounded_Wide_String; Right : Wide_String) return Boolean
with Global => null,
Post => ">"'Result = (To_Wide_String (Left) > Right);function ">" (Left : Wide_String; Right : Unbounded_Wide_String) return Boolean
with Global => null,
Post => ">"'Result = (Left > To_Wide_String (Right));function ">=" (Left, Right : Unbounded_Wide_String) return Boolean
with Global => null,
Post => ">="'Result = (To_Wide_String (Left) >= To_Wide_String (Right));function ">=" (Left : Unbounded_Wide_String; Right : Wide_String) return Boolean
with Global => null,
Post => ">="'Result = (To_Wide_String (Left) >= Right);function ">=" (Left : Wide_String; Right : Unbounded_Wide_String) return Boolean
with Global => null,
Post => ">="'Result = (Left >= To_Wide_String (Right));Index
function Index (Source : Unbounded_Wide_String; Pattern : Wide_String; From : Positive; Going : Direction := Forward;
Mapping : Wide_Maps.Wide_Character_Mapping := Wide_Maps.Identity) return Natural
with Global => null,
Pre => Pattern'Length > 0 and then From <= Length (Source),
Post => Index'Result = Wide_Fixed.Index (To_Wide_String (Source), Pattern, From, Going, Mapping);Index
function Index (Source : Unbounded_Wide_String; Pattern : Wide_String; From : Positive; Going : Direction := Forward;
Mapping : Wide_Maps.Wide_Character_Mapping_Function) return Natural
with Global => null,
Pre => Pattern'Length > 0 and then Mapping /= null and then From <= Length (Source),
Post => Index'Result = 0 or else Index'Result <= Length (Source) - Pattern'Length + 1;Index
function Index (Source : Unbounded_Wide_String; Pattern : Wide_String; Going : Direction := Forward;
Mapping : Wide_Maps.Wide_Character_Mapping := Wide_Maps.Identity) return Natural
with Global => null,
Pre => Pattern'Length > 0,
Post => Index'Result = Wide_Fixed.Index (To_Wide_String (Source), Pattern, Going, Mapping);Index
function Index (Source : Unbounded_Wide_String; Pattern : Wide_String; Going : Direction := Forward;
Mapping : Wide_Maps.Wide_Character_Mapping_Function) return Natural
with Global => null,
Pre => Pattern'Length > 0 and then Mapping /= null,
Post => Index'Result = 0 or else Index'Result <= Length (Source) - Pattern'Length + 1;Index
function Index (Source : Unbounded_Wide_String; Set : Wide_Maps.Wide_Character_Set; From : Positive; Test : Membership := Inside;
Going : Direction := Forward) return Natural
with Global => null,
Pre => From <= Length (Source),
Post => Index'Result = Wide_Fixed.Index (To_Wide_String (Source), Set, From, Test, Going);Index
function Index (Source : Unbounded_Wide_String; Set : Wide_Maps.Wide_Character_Set; Test : Membership := Inside; Going : Direction := Forward) return Natural
with Global => null,
Post => Index'Result = Wide_Fixed.Index (To_Wide_String (Source), Set, Test, Going);Index_Non_Blank
function Index_Non_Blank (Source : Unbounded_Wide_String; From : Positive; Going : Direction := Forward) return Natural
with Global => null,
Pre => From <= Length (Source),
Post => Index_Non_Blank'Result = Wide_Fixed.Index_Non_Blank (To_Wide_String (Source), From, Going);Index_Non_Blank
function Index_Non_Blank (Source : Unbounded_Wide_String; Going : Direction := Forward) return Natural
with Global => null,
Post => Index_Non_Blank'Result = Wide_Fixed.Index_Non_Blank (To_Wide_String (Source), Going);Count
function Count (Source : Unbounded_Wide_String; Pattern : Wide_String; Mapping : Wide_Maps.Wide_Character_Mapping := Wide_Maps.Identity) return Natural
with Global => null,
Pre => Pattern'Length > 0,
Post => Count'Result = Wide_Fixed.Count (To_Wide_String (Source), Pattern, Mapping);Count
function Count (Source : Unbounded_Wide_String; Pattern : Wide_String; Mapping : Wide_Maps.Wide_Character_Mapping_Function) return Natural
with Global => null,
Pre => Pattern'Length > 0 and then Mapping /= null,
Post => Count'Result <= Length (Source);Count
function Count (Source : Unbounded_Wide_String; Set : Wide_Maps.Wide_Character_Set) return Natural
with Global => null,
Post => Count'Result = Wide_Fixed.Count (To_Wide_String (Source), Set);Find_Token
procedure Find_Token (Source : Unbounded_Wide_String; Set : Wide_Maps.Wide_Character_Set; From : Positive; Test : Membership;
First : out Positive; Last : out Natural)
with Global => null,
Pre => From <= Length (Source),
Post => (if Last = 0
then First = From
and then (for all I in From .. Length (Source) => Wide_Maps.Is_In (To_Wide_String (Source) (I), Set) /= (Test = Inside))
else First in From .. Last and then Last <= Length (Source)
and then (for all I in From .. First - 1 => Wide_Maps.Is_In (To_Wide_String (Source) (I), Set) /= (Test = Inside))
and then (for all I in First .. Last => Wide_Maps.Is_In (To_Wide_String (Source) (I), Set) = (Test = Inside))
and then (Last = Length (Source) or else Wide_Maps.Is_In (To_Wide_String (Source) (Last + 1), Set) /= (Test = Inside)));Find_Token
procedure Find_Token (Source : Unbounded_Wide_String; Set : Wide_Maps.Wide_Character_Set; Test : Membership;
First : out Positive; Last : out Natural)
with Global => null,
Post => (if Last = 0
then First = 1
and then (for all I in 1 .. Length (Source) => Wide_Maps.Is_In (To_Wide_String (Source) (I), Set) /= (Test = Inside))
else First <= Last and then Last <= Length (Source)
and then (for all I in 1 .. First - 1 => Wide_Maps.Is_In (To_Wide_String (Source) (I), Set) /= (Test = Inside))
and then (for all I in First .. Last => Wide_Maps.Is_In (To_Wide_String (Source) (I), Set) = (Test = Inside))
and then (Last = Length (Source) or else Wide_Maps.Is_In (To_Wide_String (Source) (Last + 1), Set) /= (Test = Inside)));Translate
function Translate (Source : Unbounded_Wide_String; Mapping : Wide_Maps.Wide_Character_Mapping) return Unbounded_Wide_String
with Global => null,
Post => To_Wide_String (Translate'Result) = Wide_Fixed.Translate (To_Wide_String (Source), Mapping);Translate
procedure Translate (Source : in out Unbounded_Wide_String; Mapping : Wide_Maps.Wide_Character_Mapping)
with Global => null,
Post => To_Wide_String (Source) = Wide_Fixed.Translate (To_Wide_String (Source)'Old, Mapping);Translate
function Translate (Source : Unbounded_Wide_String; Mapping : Wide_Maps.Wide_Character_Mapping_Function) return Unbounded_Wide_String
with Global => null,
Pre => Mapping /= null,
Post => Length (Translate'Result) = Length (Source);Translate
procedure Translate (Source : in out Unbounded_Wide_String; Mapping : Wide_Maps.Wide_Character_Mapping_Function)
with Global => null,
Pre => Mapping /= null,
Post => Length (Source) = Length (Source)'Old;Replace_Slice
function Replace_Slice (Source : Unbounded_Wide_String; Low : Positive; High : Natural; By : Wide_String) return Unbounded_Wide_String
with Global => null,
Pre => Low <= Length (Source) + 1,
Post => To_Wide_String (Replace_Slice'Result) = Wide_Fixed.Replace_Slice (To_Wide_String (Source), Low, High, By);Replace_Slice
procedure Replace_Slice (Source : in out Unbounded_Wide_String; Low : Positive; High : Natural; By : Wide_String)
with Global => null,
Pre => Low <= Length (Source) + 1,
Post => To_Wide_String (Source) = Wide_Fixed.Replace_Slice (To_Wide_String (Source)'Old, Low, High, By);Insert
function Insert (Source : Unbounded_Wide_String; Before : Positive; New_Item : Wide_String) return Unbounded_Wide_String
with Global => null,
Pre => Before <= Length (Source) + 1,
Post => To_Wide_String (Insert'Result) = Wide_Fixed.Insert (To_Wide_String (Source), Before, New_Item);Insert
procedure Insert (Source : in out Unbounded_Wide_String; Before : Positive; New_Item : Wide_String)
with Global => null,
Pre => Before <= Length (Source) + 1,
Post => To_Wide_String (Source) = Wide_Fixed.Insert (To_Wide_String (Source)'Old, Before, New_Item);Overwrite
function Overwrite (Source : Unbounded_Wide_String; Position : Positive; New_Item : Wide_String) return Unbounded_Wide_String
with Global => null,
Pre => Position <= Length (Source) + 1,
Post => To_Wide_String (Overwrite'Result) = Wide_Fixed.Overwrite (To_Wide_String (Source), Position, New_Item);Overwrite
procedure Overwrite (Source : in out Unbounded_Wide_String; Position : Positive; New_Item : Wide_String)
with Global => null,
Pre => Position <= Length (Source) + 1,
Post => To_Wide_String (Source) = Wide_Fixed.Overwrite (To_Wide_String (Source)'Old, Position, New_Item);Delete
function Delete (Source : Unbounded_Wide_String; From : Positive; Through : Natural) return Unbounded_Wide_String
with Global => null,
Pre => Through < From or else From <= Length (Source) + 1,
Post => To_Wide_String (Delete'Result) = Wide_Fixed.Delete (To_Wide_String (Source), From, Through);Delete
procedure Delete (Source : in out Unbounded_Wide_String; From : Positive; Through : Natural)
with Global => null,
Pre => Through < From or else From <= Length (Source) + 1,
Post => To_Wide_String (Source) = Wide_Fixed.Delete (To_Wide_String (Source)'Old, From, Through);Trim
function Trim (Source : Unbounded_Wide_String; Side : Trim_End) return Unbounded_Wide_String
with Global => null,
Post => To_Wide_String (Trim'Result) = Wide_Fixed.Trim (To_Wide_String (Source), Side);Trim
procedure Trim (Source : in out Unbounded_Wide_String; Side : Trim_End)
with Global => null,
Post => To_Wide_String (Source) = Wide_Fixed.Trim (To_Wide_String (Source)'Old, Side);Trim
function Trim (Source : Unbounded_Wide_String; Left, Right : Wide_Maps.Wide_Character_Set) return Unbounded_Wide_String
with Global => null,
Post => To_Wide_String (Trim'Result) = Wide_Fixed.Trim (To_Wide_String (Source), Left, Right);Trim
procedure Trim (Source : in out Unbounded_Wide_String; Left, Right : Wide_Maps.Wide_Character_Set)
with Global => null,
Post => To_Wide_String (Source) = Wide_Fixed.Trim (To_Wide_String (Source)'Old, Left, Right);Head
function Head (Source : Unbounded_Wide_String; Count : Natural; Pad : Wide_Character := Wide_Space) return Unbounded_Wide_String
with Global => null,
Post => To_Wide_String (Head'Result) = Wide_Fixed.Head (To_Wide_String (Source), Count, Pad);Head
procedure Head (Source : in out Unbounded_Wide_String; Count : Natural; Pad : Wide_Character := Wide_Space)
with Global => null,
Post => To_Wide_String (Source) = Wide_Fixed.Head (To_Wide_String (Source)'Old, Count, Pad);Tail
function Tail (Source : Unbounded_Wide_String; Count : Natural; Pad : Wide_Character := Wide_Space) return Unbounded_Wide_String
with Global => null,
Post => To_Wide_String (Tail'Result) = Wide_Fixed.Tail (To_Wide_String (Source), Count, Pad);Tail
procedure Tail (Source : in out Unbounded_Wide_String; Count : Natural; Pad : Wide_Character := Wide_Space)
with Global => null,
Post => To_Wide_String (Source) = Wide_Fixed.Tail (To_Wide_String (Source)'Old, Count, Pad);function "*" (Left : Natural; Right : Wide_Character) return Unbounded_Wide_String
with Global => null,
Post => To_Wide_String ("*"'Result) = Wide_Fixed."*" (Left, Right);function "*" (Left : Natural; Right : Wide_String) return Unbounded_Wide_String
with Global => null,
Post => To_Wide_String ("*"'Result) = Wide_Fixed."*" (Left, Right);function "*" (Left : Natural; Right : Unbounded_Wide_String) return Unbounded_Wide_String
with Global => null,
Post => To_Wide_String ("*"'Result) = Wide_Fixed."*" (Left, To_Wide_String (Right));