File: date_facet.xml

package info (click to toggle)
boost1.35 1.35.0-5
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 203,856 kB
  • ctags: 337,867
  • sloc: cpp: 938,683; xml: 56,847; ansic: 41,589; python: 18,999; sh: 11,566; makefile: 664; perl: 494; yacc: 456; asm: 353; csh: 6
file content (319 lines) | stat: -rw-r--r-- 14,235 bytes parent folder | download | duplicates (18)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE library PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN"
"../../../tools/boostbook/dtd/boostbook.dtd">

<!-- Copyright (c) 2005 CrystalClear Software, Inc.
     Subject to the Boost Software License, Version 1.0.
     (See accompanying file LICENSE_1_0.txt or  http://www.boost.org/LICENSE_1_0.txt)
-->

<section id="date_time.date_facet">
  <title>Date Facet</title>

  <link linkend="date_facet_intro">Introduction</link> -
  <link linkend="date_facet_constr">Construction</link> -
  <link linkend="date_facet_accessors">Accessors</link>

  <anchor id="date_facet_intro" />
  <bridgehead renderas="sect3">Introduction</bridgehead>
  <para>The <code>boost::date_time::date_facet</code> enables users to have significant control over the output streaming of dates (and other gregorian objects). The date_facet is typedef'd in the <code>gregorian</code> namespace as <code>date_facet</code> and <code>wdate_facet</code>. 
  </para>

  <anchor id="date_facet_constr" />
  <bridgehead renderas="sect3">Construction</bridgehead>
  <para>
    <informaltable frame="all">
      <tgroup cols="2">
        <thead>
          <row>
            <entry>Syntax</entry>
            <entry>Description</entry>
          </row>
        </thead>
        <tbody>
          <row>
            <entry valign="top"><screen>date_facet()</screen></entry>
            <entry>Default constructor</entry>
          </row>
          <row>
            <entry valign="top"><screen>date_facet(...)
  Parameters:
    char_type* format
    input_collection_type</screen></entry>
            <entry>Format given will be used for date output. All other formats will use their defaults. Collection is the set of short names to be used for months. All other name collections will use their defaults.</entry>
          </row>
          <row>
            <entry valign="top"><screen>date_facet(...)
  Parameters:
    char_type* format
    period_formatter_type
    special_values_formatter_type
    date_gen_formatter_type</screen></entry>
            <entry>Format given will be used for date output. The remaining parameters are formatter objects. Further details on these objects can be found <link linkend="date_time.io_objects">here</link>. This constructor also provides default arguments for all parameters except the format. Therefore, <code>date_facet("%m %d %Y")</code> will work.</entry>
          </row>
        </tbody>
      </tgroup>
    </informaltable>
  </para>

  <anchor id="date_facet_accessors" />
  <bridgehead renderas="sect3">Accessors</bridgehead>
  <para>
    <informaltable frame="all">
      <tgroup cols="2">
        <thead>
          <row>
            <entry valign="top" morerows="1">Syntax</entry>
            <entry>Description</entry>
          </row>
          <row>
              <entry>Example</entry>
          </row>
        </thead>
        <tbody>
          <row>
            <entry valign="top" morerows="1"><screen>void format(char_type*)</screen></entry>
            <entry>Set the format for dates.</entry>
          </row>
          <row>
            <entry><screen>date_facet* f = new date_facet();
f->format("%m %d %Y");</screen></entry>
          </row>

          <row>
            <entry valign="top" morerows="1"><screen>void set_iso_format()</screen></entry>
            <entry>Sets the date format to ISO</entry>
          </row>
          <row>
            <entry><screen>f->set_iso_format();
// "%Y%m%d"</screen></entry>
          </row>

          <row>
            <entry valign="top" morerows="1"><screen>void set_iso_extended_format()</screen></entry>
            <entry>Sets the date format to ISO Extended</entry>
          </row>
          <row>
            <entry><screen>f->set_iso_extended_format();
// "%Y-%m-%d"</screen></entry>
          </row>

          <row>
            <entry valign="top" morerows="1"><screen>void month_format(char_type*)</screen></entry>
            <entry>Set the format for months when they are 'put' individually.</entry>
          </row>
          <row>
            <entry><screen>f->month_format("%B"); 
ss &lt;&lt; greg_month(12); // "December"</screen></entry>
          </row>

          <row>
            <entry valign="top" morerows="1"><screen>void weekday_format(char_type*)</screen></entry>
            <entry>Set the format for weekdays when they are 'put' individually.</entry>
          </row>
          <row>
            <entry><screen>f->weekday_format("%a");
ss &lt;&lt; greg_weekday(2); // "Tue"</screen></entry>
          </row>

          <row>
            <entry valign="top" morerows="1"><screen>void period_formatter(...)
  Parameter:
    period_formatter_type</screen></entry>
            <entry>Replaces the period formatter object with a user created one.</entry>
          </row>
          <row>
            <entry>see the <link linkend="date_time.io_tutorial">tutorial</link> for a complete example.</entry>
          </row>

          <row>
            <entry valign="top" morerows="1"><screen>void special_values_formatter(...)
  Parameter:
    special_values_formatter_type</screen></entry>
            <entry>Replaces the special_values formatter object with a user created one.</entry>
          </row>
          <row>
            <entry>see the <link linkend="date_time.io_tutorial">tutorial</link> for a complete example.</entry>
          </row>

          <row>
            <entry valign="top" morerows="1"><screen>void date_gen_phrase_strings(...)
  Parameters:
    input_collection_type
    date_gen_formatter_type::
      phrase_elements</screen></entry>
            <entry>Sets new date generator phrase strings in date_gen_formatter. The input collection is a vector of strings (for details on these strings see <link linkend="io_objects.date_generators">date generator formatter/parser documentation</link>). The phrase_elements parameter is an enum, defined in the date_generator_formatter object, that has a default value of 'first'. It is used to indicate what the position of the first string in the collection will be.</entry>
          </row>
          <row>
            <entry><screen></screen></entry>
          </row>

          <row>
            <entry valign="top" morerows="1"><screen>void short_weekday_names(...)
  Parameter:
    input_collection_type</screen></entry>
            <entry>Replace strings used when 'putting' short weekdays.</entry>
          </row>
          <row>
            <entry>see the <link linkend="date_time.io_tutorial">tutorial</link> for a complete example.</entry>
          </row>

          <row>
            <entry valign="top" morerows="1"><screen>void long_weekday_names(...)
  Parameter:
    input_collection_type</screen></entry>
            <entry>Replace strings used when 'putting' long weekdays.</entry>
          </row>
          <row>
            <entry>see the <link linkend="date_time.io_tutorial">tutorial</link> for a complete example.</entry>
          </row>

          <row>
            <entry valign="top" morerows="1"><screen>void short_month_names(...)
  Parameter:
    input_collection_type</screen></entry>
            <entry>Replace strings used when 'putting' short months.</entry>
          </row>
          <row>
            <entry>see the <link linkend="date_time.io_tutorial">tutorial</link> for a complete example.</entry>
          </row>

          <row>
            <entry valign="top" morerows="1"><screen>void long_month_names(...)
  Parameter:
    input_collection_type</screen></entry>
            <entry>Replace strings used when 'putting' long months.</entry>
          </row>
          <row>
            <entry>see the <link linkend="date_time.io_tutorial">tutorial</link> for a complete example.</entry>
          </row>

          <row>
            <entry valign="top" morerows="1"><screen>OutItrT put(...)
  Common parameters for all 
  'put' functions:
    OutItrT 
    ios_base
    char_type
  Unique parameter for 'put' funcs:
    gregorian object</screen></entry>
            <entry>There are 12 put functions in the date_facet. The common paraeters are: an iterator pointing to the next item in the stream, an ios_base object, and the fill character. Each unique gregorian object has it's own put function. Each unique put function is described below.</entry>
          </row>
          <row>
            <entry><screen></screen></entry>
          </row>

          <row>
            <entry valign="top" morerows="1"><screen>OutItrT put(..., date)</screen></entry>
            <entry>Puts a date object into the stream using the format set by <code>format(...)</code> or the default.</entry>
          </row>
          <row>
            <entry><screen></screen></entry>
          </row>

          <row>
            <entry valign="top" morerows="1"><screen>OutItrT put(..., days)</screen></entry>
            <entry>Puts a days object into the stream as a number.</entry>
          </row>
          <row>
            <entry><screen></screen></entry>
          </row>

          <row>
            <entry valign="top" morerows="1"><screen>OutItrT put(..., month)</screen></entry>
            <entry>Puts a month object into the stream using the format set by <code>month_format(...)</code> or the default.</entry>
          </row>
          <row>
            <entry><screen></screen></entry>
          </row>

          <row>
            <entry valign="top" morerows="1"><screen>OutItrT put(..., day)</screen></entry>
            <entry>Puts a day of month object into the stream as a two digit number.</entry>
          </row>
          <row>
            <entry><screen>"01" // January 1st</screen></entry>
          </row>

          <row>
            <entry valign="top" morerows="1"><screen>OutItrT put(..., day_of_week)</screen></entry>
            <entry>Puts a day of week object into the stream using the format set by <code>weekday_format(...)</code> or the default.</entry>
          </row>
          <row>
            <entry><screen></screen></entry>
          </row>

          <row>
            <entry valign="top" morerows="1"><screen>OutItrT put(..., date_period)</screen></entry>
            <entry>Puts a date_period into the stream. The format of the dates will use the format set by <code>format(..)</code> or the default date format. The type of period (open or closed range) and the delimiters used are those used by the period_formatter.</entry>
          </row>
          <row>
            <entry><screen></screen></entry>
          </row>

          <row>
            <entry valign="top" morerows="1"><screen>OutItrT put(..., partial_date)</screen></entry>
            <entry>Puts a partial_date date_generator object into the stream. The month format used is set by <code>month_format(..)</code> or the default. The day of month is represented as a two digit number.</entry>
          </row>
          <row>
            <entry><screen>"01 Jan" // default formats
"01 January" // long month format</screen></entry>
          </row>

          <row>
            <entry valign="top" morerows="1"><screen>OutItrT put(..., date_generator)
  Date Generator Type:
    nth_day_of_the_week_in_month</screen></entry>
            <entry>Puts a nth_day_of_the_week_in_month object into the stream. The month format is set by <code>month_format(...)</code> or the default. The weekday format is set by <code>weekday_format(...)</code> or the default. The remaining phrase elements are set in the <link linkend ="io_objects.date_generators">date_generator_formatter</link>.</entry>
          </row>
          <row>
            <entry><screen>"third Fri in May" // defaults</screen></entry>
          </row>

          <row>
            <entry valign="top" morerows="1"><screen>OutItrT put(..., date_generator)
  Date Generator Type:
    first_day_of_the_week_in_month</screen></entry>
            <entry>Puts a first_day_of_the_week_in_month object into the stream. The month format is set by <code>month_format(...)</code> or the default. The weekday format is set by <code>weekday_format(...)</code> or the default. The remaining phrase elements are set in the <link linkend ="io_objects.date_generators">date_generator_formatter</link>.</entry>
          </row>
          <row>
            <entry><screen>"first Wed of Jun" // defaults</screen></entry>
          </row>

          <row>
            <entry valign="top" morerows="1"><screen>OutItrT put(..., date_generator)
  Date Generator Type:
    last_day_of_the_week_in_month</screen></entry>
            <entry>Puts a last_day_of_the_week_in_month object into the stream. The month format is set by <code>month_format(...)</code> or the default. The weekday format is set by <code>weekday_format(...)</code> or the default. The remaining phrase elements are set in the <link linkend ="io_objects.date_generators">date_generator_formatter</link>.</entry>
          </row>
          <row>
            <entry><screen>"last Tue of Mar" // defaults</screen></entry>
          </row>

          <row>
            <entry valign="top" morerows="1"><screen>OutItrT put(..., date_generator)
  Date Generator Type:
    first_day_of_the_week_after</screen></entry>
            <entry>Puts a first_day_of_the_week_after object into the stream. The weekday format is set by <code>weekday_format(...)</code> or the default. The remaining phrase elements are set in the <link linkend ="io_objects.date_generators">date_generator_formatter</link>.</entry>
          </row>
          <row>
            <entry><screen>"first Sat after" // defaults</screen></entry>
          </row>

          <row>
            <entry valign="top" morerows="1"><screen>OutItrT put(..., date_generator)
  Date Generator Type:
    first_day_of_the_week_before</screen></entry>
            <entry>Puts a first_day_of_the_week_before object into the stream. The weekday format is set by <code>weekday_format(...)</code> or the default. The remaining phrase elements are set in the <link linkend ="io_objects.date_generators">date_generator_formatter</link>.</entry>
          </row>
          <row>
            <entry><screen>"first Mon before" // defaults</screen></entry>
          </row>

        </tbody>
      </tgroup>
    </informaltable>
  </para>
</section>