Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/doc/html/boost/date_time/date.html @ 29

Last change on this file since 29 was 29, checked in by landauf, 16 years ago

updated boost from 1_33_1 to 1_34_1

File size: 14.9 KB
Line 
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
4<title>Class template date</title>
5<link rel="stylesheet" href="../../boostbook.css" type="text/css">
6<meta name="generator" content="DocBook XSL Stylesheets V1.68.1">
7<link rel="start" href="../../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
8<link rel="up" href="../../date_time/doxy.html#header.boost.date_time.date.hpp" title="Header &lt;boost/date_time/date.hpp&gt;">
9<link rel="prev" href="../CV/simple_exception_policy.html" title="Class template simple_exception_policy">
10<link rel="next" href="day_clock.html" title="Class template day_clock">
11</head>
12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13<table cellpadding="2" width="100%">
14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
15<td align="center"><a href="../../../../index.htm">Home</a></td>
16<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
17<td align="center"><a href="../../../../people/people.htm">People</a></td>
18<td align="center"><a href="../../../../more/faq.htm">FAQ</a></td>
19<td align="center"><a href="../../../../more/index.htm">More</a></td>
20</table>
21<hr>
22<div class="spirit-nav">
23<a accesskey="p" href="../CV/simple_exception_policy.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../../date_time/doxy.html#header.boost.date_time.date.hpp"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="day_clock.html"><img src="../../images/next.png" alt="Next"></a>
24</div>
25<div class="refentry" lang="en">
26<a name="boost.date_time.date"></a><div class="titlepage"></div>
27<div class="refnamediv">
28<h2><span class="refentrytitle">Class template date</span></h2>
29<p>boost::date_time::date &#8212; Representation of timepoint at the one day level resolution. </p>
30</div>
31<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
32<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="bold"><strong>template</strong></span>&lt;<span class="bold"><strong>typename</strong></span> T, <span class="bold"><strong>typename</strong></span> calendar, <span class="bold"><strong>typename</strong></span> duration_type_&gt; 
33<span class="bold"><strong>class</strong></span> date {
34<span class="bold"><strong>public</strong></span>:
35  <span class="emphasis"><em>// types</em></span>
36  <span class="bold"><strong>typedef</strong></span> T                          date_type;       
37  <span class="bold"><strong>typedef</strong></span> calendar                   calendar_type;   
38  <span class="bold"><strong>typedef</strong></span> calendar::date_traits_type traits_type;     
39  <span class="bold"><strong>typedef</strong></span> duration_type_             duration_type;   
40  <span class="bold"><strong>typedef</strong></span> calendar::year_type        year_type;       
41  <span class="bold"><strong>typedef</strong></span> calendar::month_type       month_type;      
42  <span class="bold"><strong>typedef</strong></span> calendar::day_type         day_type;        
43  <span class="bold"><strong>typedef</strong></span> calendar::ymd_type         ymd_type;        
44  <span class="bold"><strong>typedef</strong></span> calendar::date_rep_type    date_rep_type;   
45  <span class="bold"><strong>typedef</strong></span> calendar::date_int_type    date_int_type;   
46  <span class="bold"><strong>typedef</strong></span> calendar::day_of_week_type day_of_week_type;
47
48  <span class="emphasis"><em>// <a href="date.html#boost.date_time.dateconstruct-copy-destruct">construct/copy/destruct</a></em></span>
49  <a href="date.html#id871595-bb">date</a>(year_type, month_type, day_type);
50  <a href="date.html#id767280-bb">date</a>(<span class="bold"><strong>const</strong></span> ymd_type &amp;);
51  <a href="date.html#id969341-bb">date</a>(date_int_type);
52  <a href="date.html#id896756-bb">date</a>(date_rep_type);
53
54  <span class="emphasis"><em>// <a href="date.html#id802680-bb">public member functions</a></em></span>
55  <span class="type">year_type</span> <a href="date.html#id802683-bb">year</a>() <span class="bold"><strong>const</strong></span>;
56  <span class="type">month_type</span> <a href="date.html#id802691-bb">month</a>() <span class="bold"><strong>const</strong></span>;
57  <span class="type">day_type</span> <a href="date.html#id755480-bb">day</a>() <span class="bold"><strong>const</strong></span>;
58  <span class="type">day_of_week_type</span> <a href="date.html#id755488-bb">day_of_week</a>() <span class="bold"><strong>const</strong></span>;
59  <span class="type">ymd_type</span> <a href="date.html#id755496-bb">year_month_day</a>() <span class="bold"><strong>const</strong></span>;
60  <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="date.html#id755503-bb"><span class="bold"><strong>operator</strong></span>&lt;</a>(<span class="bold"><strong>const</strong></span> date_type &amp;) <span class="bold"><strong>const</strong></span>;
61  <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="date.html#id892587-bb"><span class="bold"><strong>operator</strong></span>==</a>(<span class="bold"><strong>const</strong></span> date_type &amp;) <span class="bold"><strong>const</strong></span>;
62  <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="date.html#id892600-bb">is_special</a>() <span class="bold"><strong>const</strong></span>;
63  <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="date.html#id828666-bb">is_not_a_date</a>() <span class="bold"><strong>const</strong></span>;
64  <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="date.html#id787162-bb">is_infinity</a>() <span class="bold"><strong>const</strong></span>;
65  <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="date.html#id792920-bb">is_pos_infinity</a>() <span class="bold"><strong>const</strong></span>;
66  <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="date.html#id646910-bb">is_neg_infinity</a>() <span class="bold"><strong>const</strong></span>;
67  <span class="type">special_values</span> <a href="date.html#id646921-bb">as_special</a>() <span class="bold"><strong>const</strong></span>;
68  <span class="type">duration_type</span> <a href="date.html#id646932-bb"><span class="bold"><strong>operator</strong></span>-</a>(<span class="bold"><strong>const</strong></span> date_type &amp;) <span class="bold"><strong>const</strong></span>;
69  <span class="type">date_type</span> <a href="date.html#id646946-bb"><span class="bold"><strong>operator</strong></span>-</a>(<span class="bold"><strong>const</strong></span> duration_type &amp;) <span class="bold"><strong>const</strong></span>;
70  <span class="type">date_type</span> <a href="date.html#id891873-bb"><span class="bold"><strong>operator</strong></span>-=</a>(<span class="bold"><strong>const</strong></span> duration_type &amp;) ;
71  <span class="type">date_rep_type</span> <a href="date.html#id859413-bb">day_count</a>() <span class="bold"><strong>const</strong></span>;
72  <span class="type">date_type</span> <a href="date.html#id859421-bb"><span class="bold"><strong>operator</strong></span>+</a>(<span class="bold"><strong>const</strong></span> duration_type &amp;) <span class="bold"><strong>const</strong></span>;
73  <span class="type">date_type</span> <a href="date.html#id871582-bb"><span class="bold"><strong>operator</strong></span>+=</a>(<span class="bold"><strong>const</strong></span> duration_type &amp;) ;
74};</pre></div>
75<div class="refsect1" lang="en">
76<a name="id1032836"></a><h2>Description</h2>
77<p>The date template represents an interface shell for a date class that is based on a year-month-day system such as the gregorian or iso systems. It provides basic operations to enable calculation and comparisons.</p>
78<p><span class="bold"><strong>Theory</strong></span> </p>
79<p>This date representation fundamentally departs from the C tm struct approach. The goal for this type is to provide efficient date operations (add, subtract) and storage (minimize space to represent) in a concrete class. Thus, the date uses a count internally to represent a particular date. The calendar parameter defines the policies for converting the the year-month-day and internal counted form here. Applications that need to perform heavy formatting of the same date repeatedly will perform better by using the year-month-day representation.</p>
80<p>Internally the date uses a day number to represent the date. This is a monotonic time representation. This representation allows for fast comparison as well as simplifying the creation of writing numeric operations. Essentially, the internal day number is like adjusted julian day. The adjustment is determined by the Epoch date which is represented as day 1 of the calendar. Day 0 is reserved for negative infinity so that any actual date is automatically greater than negative infinity. When a date is constructed from a date or formatted for output, the appropriate conversions are applied to create the year, month, day representations. </p>
81<div class="refsect2" lang="en">
82<a name="id1032856"></a><h3>
83<a name="boost.date_time.dateconstruct-copy-destruct"></a><code class="computeroutput">date</code> construct/copy/destruct</h3>
84<div class="orderedlist"><ol type="1">
85<li><pre class="literallayout"><a name="id871595-bb"></a>date(year_type y, month_type m, day_type d);</pre></li>
86<li><pre class="literallayout"><a name="id767280-bb"></a>date(<span class="bold"><strong>const</strong></span> ymd_type &amp; ymd);</pre></li>
87<li>
88<pre class="literallayout"><a name="id969341-bb"></a>date(date_int_type days);</pre>
89<p>This is a private constructor which allows for the creation of new dates. It is not exposed to users since that would require class users to understand the inner workings of the date class. </p>
90</li>
91<li><pre class="literallayout"><a name="id896756-bb"></a>date(date_rep_type days);</pre></li>
92</ol></div>
93</div>
94<div class="refsect2" lang="en">
95<a name="id1032940"></a><h3>
96<a name="id802680-bb"></a><code class="computeroutput">date</code> public member functions</h3>
97<div class="orderedlist"><ol type="1">
98<li><pre class="literallayout"><span class="type">year_type</span> <a name="id802683-bb"></a>year() <span class="bold"><strong>const</strong></span>;</pre></li>
99<li><pre class="literallayout"><span class="type">month_type</span> <a name="id802691-bb"></a>month() <span class="bold"><strong>const</strong></span>;</pre></li>
100<li><pre class="literallayout"><span class="type">day_type</span> <a name="id755480-bb"></a>day() <span class="bold"><strong>const</strong></span>;</pre></li>
101<li><pre class="literallayout"><span class="type">day_of_week_type</span> <a name="id755488-bb"></a>day_of_week() <span class="bold"><strong>const</strong></span>;</pre></li>
102<li><pre class="literallayout"><span class="type">ymd_type</span> <a name="id755496-bb"></a>year_month_day() <span class="bold"><strong>const</strong></span>;</pre></li>
103<li><pre class="literallayout"><span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id755503-bb"></a><span class="bold"><strong>operator</strong></span>&lt;(<span class="bold"><strong>const</strong></span> date_type &amp; rhs) <span class="bold"><strong>const</strong></span>;</pre></li>
104<li><pre class="literallayout"><span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id892587-bb"></a><span class="bold"><strong>operator</strong></span>==(<span class="bold"><strong>const</strong></span> date_type &amp; rhs) <span class="bold"><strong>const</strong></span>;</pre></li>
105<li><pre class="literallayout"><span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id892600-bb"></a>is_special() <span class="bold"><strong>const</strong></span>;</pre></li>
106<li><pre class="literallayout"><span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id828666-bb"></a>is_not_a_date() <span class="bold"><strong>const</strong></span>;</pre></li>
107<li><pre class="literallayout"><span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id787162-bb"></a>is_infinity() <span class="bold"><strong>const</strong></span>;</pre></li>
108<li><pre class="literallayout"><span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id792920-bb"></a>is_pos_infinity() <span class="bold"><strong>const</strong></span>;</pre></li>
109<li><pre class="literallayout"><span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id646910-bb"></a>is_neg_infinity() <span class="bold"><strong>const</strong></span>;</pre></li>
110<li><pre class="literallayout"><span class="type">special_values</span> <a name="id646921-bb"></a>as_special() <span class="bold"><strong>const</strong></span>;</pre></li>
111<li><pre class="literallayout"><span class="type">duration_type</span> <a name="id646932-bb"></a><span class="bold"><strong>operator</strong></span>-(<span class="bold"><strong>const</strong></span> date_type &amp; d) <span class="bold"><strong>const</strong></span>;</pre></li>
112<li><pre class="literallayout"><span class="type">date_type</span> <a name="id646946-bb"></a><span class="bold"><strong>operator</strong></span>-(<span class="bold"><strong>const</strong></span> duration_type &amp; dd) <span class="bold"><strong>const</strong></span>;</pre></li>
113<li><pre class="literallayout"><span class="type">date_type</span> <a name="id891873-bb"></a><span class="bold"><strong>operator</strong></span>-=(<span class="bold"><strong>const</strong></span> duration_type &amp; dd) ;</pre></li>
114<li><pre class="literallayout"><span class="type">date_rep_type</span> <a name="id859413-bb"></a>day_count() <span class="bold"><strong>const</strong></span>;</pre></li>
115<li><pre class="literallayout"><span class="type">date_type</span> <a name="id859421-bb"></a><span class="bold"><strong>operator</strong></span>+(<span class="bold"><strong>const</strong></span> duration_type &amp; dd) <span class="bold"><strong>const</strong></span>;</pre></li>
116<li><pre class="literallayout"><span class="type">date_type</span> <a name="id871582-bb"></a><span class="bold"><strong>operator</strong></span>+=(<span class="bold"><strong>const</strong></span> duration_type &amp; dd) ;</pre></li>
117</ol></div>
118</div>
119</div>
120</div>
121<table width="100%"><tr>
122<td align="left"></td>
123<td align="right"><small>Copyright © 2001-2005 CrystalClear Software, Inc</small></td>
124</tr></table>
125<hr>
126<div class="spirit-nav">
127<a accesskey="p" href="../CV/simple_exception_policy.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../../date_time/doxy.html#header.boost.date_time.date.hpp"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="day_clock.html"><img src="../../images/next.png" alt="Next"></a>
128</div>
129</body>
130</html>
Note: See TracBrowser for help on using the repository browser.