DEVELOPMENT EDITION · 769442725406
Library Reference
On this page

Ada.Text_IO.Bounded_IO

Text_IO of a bounded string instance's values (RM A.10.11).

Read the family guide for representation, selection and resource rules. The complete declaration page retains exact signatures/contracts; the source specification is the implementation baseline.

Availability and ownership

RM A.10.11 but the function forms of Get_Line, since a Verada function propagates no exception: Get_Line is a procedure that raises Ada.Strings.Length_Error for a line longer than the bound.

A client proof uses these contracts without proving the body again (see library assurance). Global => null excludes package-global effects, not changes made through an in out argument.

Import and instantiate

with Ada.Text_IO.Bounded_IO;
import Ada.Text_IO.Bounded_IO;

A Vibe module imports this unit's names with from Ada.Text_IO.Bounded_IO import Name; see library use across syntaxes. In Varc, keep each name's declared spelling and write & on arguments the call changes.

Contract and lifecycle reading

A Pre condition is the caller's obligation; a Post is what a normal return guarantees. What a postcondition does not state, a client cannot assume. Ghost functions are for contracts and ghost code. The family guide describes copying, lifetime, order and cost.

API 001

generic parameters (declaration) — Bounded: an instance of Ada.Strings.Bounded.Generic_Bounded_Length, whose Bounded_String values the operations read and write.

Declared interface:

generic
   with package Bounded is new Ada.Strings.Bounded.Generic_Bounded_Length (<>);

API 002

Put (declaration) — Text_IO's Put of the string's characters to File.

Declared interface:

procedure Put (File : File_Type; Item : Bounded.Bounded_String)
  with Global => (In_Out => File_System),
       Exceptional_Cases => (Status_Error => not Is_Open (File),
                             Mode_Error => Is_Open (File) and then Mode (File) = In_File);

API 003

Put (declaration) — Text_IO's Put to the current output.

Declared interface:

procedure Put (Item : Bounded.Bounded_String)
  with Global => (In_Out => File_System);

API 004

Put_Line (declaration) — Text_IO's Put_Line to File.

Declared interface:

procedure Put_Line (File : File_Type; Item : Bounded.Bounded_String)
  with Global => (In_Out => File_System),
       Exceptional_Cases => (Status_Error => not Is_Open (File),
                             Mode_Error => Is_Open (File) and then Mode (File) = In_File);

API 005

Put_Line (declaration) — Text_IO's Put_Line to the current output.

Declared interface:

procedure Put_Line (Item : Bounded.Bounded_String)
  with Global => (In_Out => File_System);

API 006

Get_Line (declaration) — Item takes the next line of File; Ada.Strings.Length_Error when the line is longer than the bound.

Declared interface:

procedure Get_Line (File : File_Type; Item : out Bounded.Bounded_String)
  with Pre => (if Is_Open (File) and then Mode (File) = In_File then not End_Of_File (File)),
       Global => (In_Out => File_System),
       Exceptional_Cases => (Status_Error => not Is_Open (File),
                             Mode_Error => Is_Open (File) and then Mode (File) /= In_File,
                             Ada.Strings.Length_Error => True);

API 007

Get_Line (declaration) — Item takes the next line of the current input; Length_Error as for a file.

Declared interface:

procedure Get_Line (Item : out Bounded.Bounded_String)
  with Pre => not End_Of_File,
       Global => (In_Out => File_System),
       Exceptional_Cases => (Ada.Strings.Length_Error => True);