• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<?xml version="1.0" encoding="utf-8"?>
2<!DOCTYPE library PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN"
3"../../../tools/boostbook/dtd/boostbook.dtd">
4
5<!-- Copyright (c) 2005 CrystalClear Software, Inc.
6     Subject to the Boost Software License, Version 1.0.
7     (See accompanying file LICENSE_1_0.txt or  http://www.boost.org/LICENSE_1_0.txt)
8-->
9
10<section id="date_time.time_input_facet">
11  <title>Time Input Facet</title>
12
13  <link linkend="time_input_facet_intro">Introduction</link> -
14  <link linkend="time_input_facet_constr">Construction</link> -
15  <link linkend="time_input_facet_accessors">Accessors</link>
16
17  <anchor id="time_input_facet_intro" />
18  <bridgehead renderas="sect3">Introduction</bridgehead>
19  <para>The <code>boost::date_time::time_input_facet</code> is an extension of the <code>date_input_facet</code>. It is typedef'ed in the <code>boost::posix_time</code> namespace as <code>time_input_facet</code> and <code>wtime_input_facet</code>. It is typedef'ed in the <code>boost::local_time</code> namespace as <code>local_time_input_facet</code> and <code>wlocal_time_input_facet</code>.
20  </para>
21
22  <anchor id="time_input_facet_constr" />
23  <bridgehead renderas="sect3">Construction</bridgehead>
24  <para>
25    <informaltable frame="all">
26      <tgroup cols="2">
27        <thead>
28          <row>
29            <entry>Syntax</entry>
30            <entry>Description</entry>
31          </row>
32        </thead>
33        <tbody>
34          <row>
35            <entry valign="top"><screen>time_input_facet()</screen></entry>
36            <entry>Default constructor</entry>
37          </row>
38          <row>
39            <entry valign="top"><screen>time_input_facet(string_type)</screen></entry>
40            <entry>Format given will be used for date/time input. All other formats will use their defaults.</entry>
41          </row>
42          <row>
43            <entry valign="top"><screen>time_input_facet(...)
44  Parameters:
45    string_type format
46    format_date_parser_type
47    special_values_parser_type
48    period_parser_type
49    date_gen_parser_type</screen></entry>
50<entry>Format given will be used for date/time input. The remaining parameters are parser objects. Further details on these objects can be found <link linkend="date_time.io_objects">here</link>.</entry>
51          </row>
52        </tbody>
53      </tgroup>
54    </informaltable>
55  </para>
56
57  <anchor id="time_input_facet_accessors" />
58  <bridgehead renderas="sect3">Accessors</bridgehead>
59  <para>
60    The time_input_facet inherits all the public date_input_facet methods. Therefore, the date_input_facet methods are not listed here. Instead, they can be found by following <link linkend="date_time.date_input_facet">this</link> link.
61    <informaltable frame="all">
62      <tgroup cols="2">
63        <thead>
64          <row>
65            <entry valign="top" morerows="1">Syntax</entry>
66            <entry>Description</entry>
67          </row>
68          <row>
69              <entry>Example</entry>
70          </row>
71        </thead>
72        <tbody>
73
74          <row>
75            <entry valign="top" morerows="1"><screen>void set_iso_format()</screen></entry>
76            <entry>Sets the time format to ISO</entry>
77          </row>
78          <row>
79            <entry><screen>f->set_iso_format();
80// "%Y%m%dT%H%M%S%F%q"
81"20051225T132536.789-0700"</screen></entry>
82          </row>
83
84          <row>
85            <entry valign="top" morerows="1"><screen>void set_iso_extended_format()</screen></entry>
86            <entry>Sets the date format to ISO Extended</entry>
87          </row>
88          <row>
89            <entry><screen>f->set_iso_extended_format();
90// "%Y-%m-%d %H:%M:%S%F %Q"
91"2005-12-25 13:25:36.789 -07:00"</screen></entry>
92          </row>
93
94          <row>
95            <entry valign="top" morerows="1"><screen>void time_duration_format(...)
96  Parameter:
97    char_type*</screen></entry>
98            <entry>Sets the time_duration format.</entry>
99          </row>
100          <row>
101            <entry><screen>f->time_duration_format("%H:%M");
102// hours and minutes only</screen></entry>
103          </row>
104
105
106          <row>
107            <entry valign="top" morerows="1"><screen>InItrT get(...)
108  Common parameters for all
109  'get' functions:
110    InItrT from
111    InItrT to
112    ios_base
113  Unique parameter for 'get' funcs:
114    gregorian object</screen></entry>
115            <entry>There are 3 get functions in the time_input_facet. The common parameters are: an iterator pointing to the begining of the stream, an iterator pointing to the end of the stream, and an ios_base object. Each unique gregorian object has it's own get function. Each unique get function is described below.</entry>
116          </row>
117          <row>
118            <entry><screen></screen></entry>
119          </row>
120
121          <row>
122            <entry valign="top" morerows="1"><screen>InItrT get(..., ptime)</screen></entry>
123            <entry>Gets a ptime object from the stream using the format set by <code>format(...)</code> or the default.</entry>
124          </row>
125          <row>
126            <entry><screen>ss.str("2005-Jan-01 13:12:01");
127ss >> pt; // default format</screen></entry>
128          </row>
129
130          <row>
131            <entry valign="top" morerows="1"><screen>InItrT get(..., time_duration)</screen></entry>
132            <entry>Gets a time_duration object from the stream using the format set by <code>time_duration_format(...)</code> or the default.</entry>
133          </row>
134          <row>
135            <entry><screen>ss.str("01:25:15.000123000");
136ss >> td; // default format</screen></entry>
137          </row>
138
139          <row>
140            <entry valign="top" morerows="1"><screen>InItrT get(..., time_period)</screen></entry>
141            <entry>Gets a time_period from the stream. The format of the dates/times will use the format set by <code>format(..)</code> or the default date and time format. The type of period (open or closed range) and the delimiters used are those used by the period_parser.</entry>
142          </row>
143          <row>
144            <entry>see the <link linkend="date_time.io_tutorial">tutorial</link> for a complete example.</entry>
145          </row>
146
147          <!-- This should be changed later
148          <row>
149            <entry valign="top" morerows="1"><screen>InItrT get_local_time(..., local_date_time)</screen></entry>
150            <entry>Gets a local_date_time object from the stream using the format set by <code>format(...)</code> or the default.</entry>
151          </row>
152          <row>
153            <entry><screen></screen></entry>
154          </row>
155          -->
156
157
158        </tbody>
159      </tgroup>
160    </informaltable>
161  </para>
162
163</section>
164