OSDN Git Service

PR c++/9704
[pf3gnuchains/gcc-fork.git] / gcc / ada / g-catiio.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                         GNAT RUN-TIME COMPONENTS                         --
4 --                                                                          --
5 --                G N A T . C A L E N D A R . T I M E _ I O                 --
6 --                                                                          --
7 --                                 S p e c                                  --
8 --                                                                          --
9 --                                                                          --
10 --            Copyright (C) 1999-2001 Ada Core Technologies, Inc.           --
11 --                                                                          --
12 -- This specification is derived from the Ada Reference Manual for use with --
13 -- GNAT. The copyright notice above, and the license provisions that follow --
14 -- apply solely to the  contents of the part following the private keyword. --
15 --                                                                          --
16 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
17 -- terms of the  GNU General Public License as published  by the Free Soft- --
18 -- ware  Foundation;  either version 2,  or (at your option) any later ver- --
19 -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
20 -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
21 -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
22 -- for  more details.  You should have  received  a copy of the GNU General --
23 -- Public License  distributed with GNAT;  see file COPYING.  If not, write --
24 -- to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, --
25 -- MA 02111-1307, USA.                                                      --
26 --                                                                          --
27 -- As a special exception,  if other files  instantiate  generics from this --
28 -- unit, or you link  this unit with other files  to produce an executable, --
29 -- this  unit  does not  by itself cause  the resulting  executable  to  be --
30 -- covered  by the  GNU  General  Public  License.  This exception does not --
31 -- however invalidate  any other reasons why  the executable file  might be --
32 -- covered by the  GNU Public License.                                      --
33 --                                                                          --
34 -- GNAT was originally developed  by the GNAT team at  New York University. --
35 -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
36 --                                                                          --
37 ------------------------------------------------------------------------------
38
39 --  This package augments standard Ada.Text_IO with facilities for input
40 --  and output of time values in standardized format.
41
42 package GNAT.Calendar.Time_IO is
43
44    Picture_Error : exception;
45
46    type Picture_String is new String;
47
48    --  This is a string to describe date and time output format. The string is
49    --  a set of standard character and special tag that are replaced by the
50    --  corresponding values. It follows the GNU Date specification. Here are
51    --  the recognized directives :
52    --
53    --          %    a literal %
54    --          n    a newline
55    --          t    a horizontal tab
56    --
57    --          Time fields:
58    --
59    --          %H   hour (00..23)
60    --          %I   hour (01..12)
61    --          %k   hour ( 0..23)
62    --          %l   hour ( 1..12)
63    --          %M   minute (00..59)
64    --          %p   locale's AM or PM
65    --          %r   time, 12-hour (hh:mm:ss [AP]M)
66    --          %s   seconds  since 1970-01-01  00:00:00 UTC
67    --                (a nonstandard extension)
68    --          %S   second (00..59)
69    --          %T   time, 24-hour (hh:mm:ss)
70    --
71    --          Date fields:
72    --
73    --          %a   locale's abbreviated weekday name (Sun..Sat)
74    --          %A   locale's    full   weekday   name,    variable   length
75    --                  (Sunday..Saturday)
76    --          %b   locale's abbreviated month name (Jan..Dec)
77    --          %B   locale's    full    month    name,   variable    length
78    --                  (January..December)
79    --          %c   locale's date and time (Sat Nov 04 12:02:33 EST 1989)
80    --          %d   day of month (01..31)
81    --          %D   date (mm/dd/yy)
82    --          %h   same as %b
83    --          %j   day of year (001..366)
84    --          %m   month (01..12)
85    --          %U   week number  of year with  Sunday as first day  of week
86    --                  (00..53)
87    --          %w   day of week (0..6) with 0 corresponding to Sunday
88    --          %W   week number  of year with  Monday as first day  of week
89    --                  (00..53)
90    --          %x   locale's date representation (mm/dd/yy)
91    --          %y   last two digits of year (00..99)
92    --          %Y   year (1970...)
93    --
94    --          By default,  date pads numeric fields with zeroes.  GNU date
95    --          recognizes the following nonstandard numeric modifiers:
96    --
97    --          -    (hyphen) do not pad the field
98    --          _    (underscore) pad the field with spaces
99
100    ISO_Date      : constant Picture_String;
101    --  This format follow the ISO 8601 standard. The format is "YYYY-MM-DD",
102    --  four digits year, month and day number separated by minus.
103
104    US_Date       : constant Picture_String;
105    --  This format is the common US date format: "MM/DD/YY",
106    --  month and day number, two digits year separated by slashes.
107
108    European_Date : constant Picture_String;
109    --  This format is the common European date format: "DD/MM/YY",
110    --  day and month number, two digits year separated by slashes.
111
112    function Image
113      (Date    : Ada.Calendar.Time;
114       Picture : Picture_String)
115       return    String;
116    --  Return Date as a string with format Picture.
117    --  raise Picture_Error if picture string is wrong
118
119    procedure Put_Time
120      (Date    : Ada.Calendar.Time;
121       Picture : Picture_String);
122    --  Put Date with format Picture.
123    --  raise Picture_Error if picture string is wrong
124
125 private
126    ISO_Date      : constant Picture_String := "%Y-%m-%d";
127    US_Date       : constant Picture_String := "%m/%d/%y";
128    European_Date : constant Picture_String := "%d/%m/%y";
129
130 end GNAT.Calendar.Time_IO;