Ada Programming/Libraries/Ada.Wide_Text_IO
This language feature is available from Ada 95 on.
Ada.Wide_Text_IO is a unit of the Predefined Language Environment since Ada 95.
Generic nested packages
editAda.Wide_Text_IO has the following nested packages for input/output of scalar types. The only parameter is the involved type.
- Decimal_IO
- Enumeration_IO
- Fixed_IO
- Float_IO
- Integer_IO
- Modular_IO
Specification
edit-- Standard Ada library specification -- Copyright (c) 2003-2018 Maxim Reznik <reznikmm@gmail.com> -- Copyright (c) 2004-2016 AXE Consultants -- Copyright (c) 2004, 2005, 2006 Ada-Europe -- Copyright (c) 2000 The MITRE Corporation, Inc. -- Copyright (c) 1992, 1993, 1994, 1995 Intermetrics, Inc. -- SPDX-License-Identifier: BSD-3-Clause and LicenseRef-AdaReferenceManual -- -------------------------------------------------------------------------with
Ada.IO_Exceptions;package
Ada.Wide_Text_IOis
type
File_Typeis
limited
private
;type
File_Modeis
(In_File, Out_File, Append_File);type
Countis
range
0 .. implementation_defined;subtype
Positive_Countis
Countrange
1 .. Count'Last; Unbounded :constant
Count := 0; -- line and page lengthsubtype
Fieldis
Integerrange
0 .. implementation_defined;subtype
Number_Baseis
Integerrange
2 .. 16;type
Type_Setis
(Lower_Case, Upper_Case); -- File Managementprocedure
Create (File :in
out
File_Type; Mode :in
File_Mode := Out_File; Name :in
String := ""; Form :in
String := "");procedure
Open (File :in
out
File_Type; Mode :in
File_Mode; Name :in
String; Form :in
String := "");procedure
Close (File :in
out
File_Type);procedure
Delete (File :in
out
File_Type);procedure
Reset (File :in
out
File_Type; Mode :in
File_Mode);procedure
Reset (File :in
out
File_Type);function
Mode (File :in
File_Type)return
File_Mode;function
Name (File :in
File_Type)return
String;function
Form (File :in
File_Type)return
String;function
Is_Open(File :in
File_Type)return
Boolean; -- Control of default input and output filesprocedure
Set_Input (File :in
File_Type);procedure
Set_Output(File :in
File_Type);procedure
Set_Error (File :in
File_Type);function
Standard_Inputreturn
File_Type;function
Standard_Outputreturn
File_Type;function
Standard_Errorreturn
File_Type;function
Current_Inputreturn
File_Type;function
Current_Outputreturn
File_Type;function
Current_Errorreturn
File_Type;type
File_Accessis
access
constant
File_Type;function
Standard_Inputreturn
File_Access;function
Standard_Outputreturn
File_Access;function
Standard_Errorreturn
File_Access;function
Current_Inputreturn
File_Access;function
Current_Outputreturn
File_Access;function
Current_Errorreturn
File_Access; -- Buffer controlprocedure
Flush (File :in
out
File_Type);procedure
Flush; -- Specification of line and page lengthsprocedure
Set_Line_Length (File :in
File_Type; To :in
Count);procedure
Set_Line_Length (To :in
Count);procedure
Set_Page_Length (File :in
File_Type; To :in
Count);procedure
Set_Page_Length (To :in
Count);function
Line_Length (File :in
File_Type)return
Count;function
Line_Lengthreturn
Count;function
Page_Length (File :in
File_Type)return
Count;function
Page_Lengthreturn
Count; -- Column, Line, and Page Controlprocedure
New_Line (File :in
File_Type; Spacing :in
Positive_Count := 1);procedure
New_Line (Spacing :in
Positive_Count := 1);procedure
Skip_Line (File :in
File_Type; Spacing :in
Positive_Count := 1);procedure
Skip_Line (Spacing :in
Positive_Count := 1);function
End_Of_Line (File :in
File_Type)return
Boolean;function
End_Of_Linereturn
Boolean;procedure
New_Page (File :in
File_Type);procedure
New_Page;procedure
Skip_Page (File :in
File_Type);procedure
Skip_Page;function
End_Of_Page (File :in
File_Type)return
Boolean;function
End_Of_Pagereturn
Boolean;function
End_Of_File (File :in
File_Type)return
Boolean;function
End_Of_Filereturn
Boolean;procedure
Set_Col (File :in
File_Type; To :in
Positive_Count);procedure
Set_Col (To :in
Positive_Count);procedure
Set_Line (File :in
File_Type; To :in
Positive_Count);procedure
Set_Line (To :in
Positive_Count);function
Col (File :in
File_Type)return
Positive_Count;function
Colreturn
Positive_Count;function
Line (File :in
File_Type)return
Positive_Count;function
Linereturn
Positive_Count;function
Page (File :in
File_Type)return
Positive_Count;function
Pagereturn
Positive_Count; -- Character Input-Outputprocedure
Get (File :in
File_Type; Item :out
Wide_Character);procedure
Get (Item :out
Wide_Character);procedure
Put (File :in
File_Type; Item :in
Wide_Character);procedure
Put (Item :in
Wide_Character);procedure
Look_Ahead (File :in
File_Type; Item :out
Wide_Character; End_Of_Line :out
Boolean);procedure
Look_Ahead (Item :out
Wide_Character; End_Of_Line :out
Boolean);procedure
Get_Immediate (File :in
File_Type; Item :out
Wide_Character);procedure
Get_Immediate (Item :out
Wide_Character);procedure
Get_Immediate (File :in
File_Type; Item :out
Wide_Character; Available :out
Boolean);procedure
Get_Immediate (Item :out
Wide_Character; Available :out
Boolean); -- String Input-Outputprocedure
Get (File :in
File_Type; Item :out
Wide_String);procedure
Get (Item :out
Wide_String);procedure
Put (File :in
File_Type; Item :in
Wide_String);procedure
Put (Item :in
Wide_String);procedure
Get_Line (File :in
File_Type; Item :out
Wide_String; Last :out
Natural);procedure
Get_Line (Item :out
Wide_String; Last :out
Natural);function
Get_Line(File :in
File_Type)return
Wide_String;function
Get_Linereturn
Wide_String;procedure
Put_Line (File :in
File_Type; Item :in
Wide_String);procedure
Put_Line (Item :in
Wide_String); -- Generic packages for Input-Output of Integer Typesgeneric
type
Numis
range
<>;package
Integer_IOis
Default_Width : Field := Num'Width; Default_Base : Number_Base := 10;procedure
Get (File :in
File_Type; Item :out
Num; Width :in
Field := 0);procedure
Get (Item :out
Num; Width :in
Field := 0);procedure
Put (File :in
File_Type; Item :in
Num; Width :in
Field := Default_Width; Base :in
Number_Base := Default_Base);procedure
Put (Item :in
Num; Width :in
Field := Default_Width; Base :in
Number_Base := Default_Base);procedure
Get (From :in
Wide_String; Item :out
Num; Last :out
Positive);procedure
Put (To :out
Wide_String; Item :in
Num; Base :in
Number_Base := Default_Base);end
Integer_IO;generic
type
Numis
mod
<>;package
Modular_IOis
Default_Width : Field := Num'Width; Default_Base : Number_Base := 10;procedure
Get (File :in
File_Type; Item :out
Num; Width :in
Field := 0);procedure
Get (Item :out
Num; Width :in
Field := 0);procedure
Put (File :in
File_Type; Item :in
Num; Width :in
Field := Default_Width; Base :in
Number_Base := Default_Base);procedure
Put (Item :in
Num; Width :in
Field := Default_Width; Base :in
Number_Base := Default_Base);procedure
Get (From :in
Wide_String; Item :out
Num; Last :out
Positive);procedure
Put (To :out
Wide_String; Item :in
Num; Base :in
Number_Base := Default_Base);end
Modular_IO; -- Generic packages for Input-Output of Real Typesgeneric
type
Numis
digits
<>;package
Float_IOis
Default_Fore : Field := 2; Default_Aft : Field := Num'Digits-1; Default_Exp : Field := 3;procedure
Get (File :in
File_Type; Item :out
Num; Width :in
Field := 0);procedure
Get (Item :out
Num; Width :in
Field := 0);procedure
Put (File :in
File_Type; Item :in
Num; Fore :in
Field := Default_Fore; Aft :in
Field := Default_Aft; Exp :in
Field := Default_Exp);procedure
Put (Item :in
Num; Fore :in
Field := Default_Fore; Aft :in
Field := Default_Aft; Exp :in
Field := Default_Exp);procedure
Get (From :in
Wide_String; Item :out
Num; Last :out
Positive);procedure
Put (To :out
Wide_String; Item :in
Num; Aft :in
Field := Default_Aft; Exp :in
Field := Default_Exp);end
Float_IO;generic
type
Numis
delta
<>;package
Fixed_IOis
Default_Fore : Field := Num'Fore; Default_Aft : Field := Num'Aft; Default_Exp : Field := 0;procedure
Get (File :in
File_Type; Item :out
Num; Width :in
Field := 0);procedure
Get (Item :out
Num; Width :in
Field := 0);procedure
Put (File :in
File_Type; Item :in
Num; Fore :in
Field := Default_Fore; Aft :in
Field := Default_Aft; Exp :in
Field := Default_Exp);procedure
Put (Item :in
Num; Fore :in
Field := Default_Fore; Aft :in
Field := Default_Aft; Exp :in
Field := Default_Exp);procedure
Get (From :in
Wide_String; Item :out
Num; Last :out
Positive);procedure
Put (To :out
Wide_String; Item :in
Num; Aft :in
Field := Default_Aft; Exp :in
Field := Default_Exp);end
Fixed_IO;generic
type
Numis
delta
<>digits
<>;package
Decimal_IOis
Default_Fore : Field := Num'Fore; Default_Aft : Field := Num'Aft; Default_Exp : Field := 0;procedure
Get (File :in
File_Type; Item :out
Num; Width :in
Field := 0);procedure
Get (Item :out
Num; Width :in
Field := 0);procedure
Put (File :in
File_Type; Item :in
Num; Fore :in
Field := Default_Fore; Aft :in
Field := Default_Aft; Exp :in
Field := Default_Exp);procedure
Put (Item :in
Num; Fore :in
Field := Default_Fore; Aft :in
Field := Default_Aft; Exp :in
Field := Default_Exp);procedure
Get (From :in
Wide_String; Item :out
Num; Last :out
Positive);procedure
Put (To :out
Wide_String; Item :in
Num; Aft :in
Field := Default_Aft; Exp :in
Field := Default_Exp);end
Decimal_IO; -- Generic package for Input-Output of Enumeration Typesgeneric
type
Enumis
(<>);package
Enumeration_IOis
Default_Width : Field := 0; Default_Setting : Type_Set := Upper_Case;procedure
Get (File :in
File_Type; Item :out
Enum);procedure
Get (Item :out
Enum);procedure
Put (File :in
File_Type; Item :in
Enum; Width :in
Field := Default_Width; Set :in
Type_Set := Default_Setting);procedure
Put (Item :in
Enum; Width :in
Field := Default_Width; Set :in
Type_Set := Default_Setting);procedure
Get (From :in
Wide_String; Item :out
Enum; Last :out
Positive);procedure
Put (To :out
Wide_String; Item :in
Enum; Set :in
Type_Set := Default_Setting);end
Enumeration_IO; -- Exceptions Status_Error :exception
renames
IO_Exceptions.Status_Error; Mode_Error :exception
renames
IO_Exceptions.Mode_Error; Name_Error :exception
renames
IO_Exceptions.Name_Error; Use_Error :exception
renames
IO_Exceptions.Use_Error; Device_Error :exception
renames
IO_Exceptions.Device_Error; End_Error :exception
renames
IO_Exceptions.End_Error; Data_Error :exception
renames
IO_Exceptions.Data_Error; Layout_Error :exception
renames
IO_Exceptions.Layout_Error;private
type
File_Typeis
limited
null
record
;end
Ada.Wide_Text_IO;
See also
editWikibook
editExternal examples
edit- Search for examples of
Ada.Wide_Text_IO
in: Rosetta Code, GitHub (gists), any Alire crate or this Wikibook. - Search for posts related to
Ada.Wide_Text_IO
in: Stack Overflow, comp.lang.ada or any Ada related page.
Ada Reference Manual
editAda 95
editAda 2005
editAda 2012
editOpen-Source Implementations
editFSF GNAT
- Specification: a-witeio.ads
- Body: a-witeio.adb
drake
- Specification: streams/a-witeio.ads