BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bdlt_datetimeimputil.h
Go to the documentation of this file.
1/// @file bdlt_datetimeimputil.h
2///
3/// The content of this file has been pre-processed for Doxygen.
4///
5
6
7// bdlt_datetimeimputil.h -*-C++-*-
8#ifndef INCLUDED_BDLT_DATETIMEIMPUTIL
9#define INCLUDED_BDLT_DATETIMEIMPUTIL
10
11#include <bsls_ident.h>
12BSLS_IDENT("$Id: $")
13
14/// @defgroup bdlt_datetimeimputil bdlt_datetimeimputil
15/// @brief Provide constants useful for encoding datetimes.
16/// @addtogroup bdl
17/// @{
18/// @addtogroup bdlt
19/// @{
20/// @addtogroup bdlt_datetimeimputil
21/// @{
22///
23/// <h1> Outline </h1>
24/// * <a href="#bdlt_datetimeimputil-purpose"> Purpose</a>
25/// * <a href="#bdlt_datetimeimputil-classes"> Classes </a>
26/// * <a href="#bdlt_datetimeimputil-description"> Description </a>
27/// * <a href="#bdlt_datetimeimputil-usage"> Usage </a>
28/// * <a href="#bdlt_datetimeimputil-example-1-basic-syntax"> Example 1: Basic Syntax </a>
29///
30/// # Purpose {#bdlt_datetimeimputil-purpose}
31/// Provide constants useful for encoding datetimes.
32///
33/// # Classes {#bdlt_datetimeimputil-classes}
34///
35/// - bdlt::DatetimeImpUtil: namespace for datetime encoding constants
36///
37/// # Description {#bdlt_datetimeimputil-description}
38/// This component implements a utility `struct`,
39/// `bdlt::DatetimeImpUtil`, that defines a namespace for obtaining constants
40/// and `bdlt::Datetime *` to constant values that are useful to encoding
41/// datetimes at static-initilaization time. The assumptions for this encoding
42/// are that a collection of unset values, one per day over the valid range of
43/// `bdlt::Date`, are encoded in the lowest values, and then microsecond
44/// resolution over the entire `bdlt::Date` range.
45///
46/// ## Usage {#bdlt_datetimeimputil-usage}
47///
48///
49/// This section illustrates intended use of this component.
50///
51/// ### Example 1: Basic Syntax {#bdlt_datetimeimputil-example-1-basic-syntax}
52///
53///
54/// To obtain the `bdlt::Datetime` internal value for 0001/01/01 at
55/// static-initialization time:
56/// @code
57/// static const bdlt::Datetime *firstDatetime =
58/// bdlt::DatetimeImpUtil::epoch_0001_01_01();
59///
60/// assert(reinterpret_cast<const bdlt::Datetime *>(
61/// &bdlt::DatetimeImpUtil::k_0001_01_01_VALUE) == firstDatetime);
62/// @endcode
63/// @}
64/** @} */
65/** @} */
66
67/** @addtogroup bdl
68 * @{
69 */
70/** @addtogroup bdlt
71 * @{
72 */
73/** @addtogroup bdlt_datetimeimputil
74 * @{
75 */
76
77#include <bdlscm_version.h>
78
79#include <bsls_types.h>
80
81
82namespace bdlt {
83
84class Datetime;
85
86 // ======================
87 // struct DatetimeImpUtil
88 // ======================
89
90/// This `struct` provides a namespace for datetime encoding constants.
92
93 // CLASS DATA
97
98 // CLASS METHODS
99
100 /// Return a pointer to a `bdlt::Datetime` with value
101 /// `bdlt::Datetime(1, 1, 1)` suitable for use during static
102 /// initialization.
103 static const Datetime *epoch_0001_01_01();
104
105 /// Return a pointer to a `bdlt::Datetime` with value
106 /// `bdlt::Datetime(1970, 1, 1)` suitable for use during static
107 /// initialization.
108 static const Datetime *epoch_1970_01_01();
109
110 /// Return a pointer to a `bdlt::Datetime` with value
111 /// `bdlt::Datetime(9999, 12, 31, 24)` suitable for use during static
112 /// initialization.
113 static const Datetime *epoch_max();
114};
115
116} // close package namespace
117
118
119#endif
120
121// ----------------------------------------------------------------------------
122// Copyright 2016 Bloomberg Finance L.P.
123//
124// Licensed under the Apache License, Version 2.0 (the "License");
125// you may not use this file except in compliance with the License.
126// You may obtain a copy of the License at
127//
128// http://www.apache.org/licenses/LICENSE-2.0
129//
130// Unless required by applicable law or agreed to in writing, software
131// distributed under the License is distributed on an "AS IS" BASIS,
132// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
133// See the License for the specific language governing permissions and
134// limitations under the License.
135// ----------------------------- END-OF-FILE ----------------------------------
136
137/** @} */
138/** @} */
139/** @} */
Definition bdlt_datetime.h:331
#define BSLS_IDENT(str)
Definition bsls_ident.h:195
Definition bbldc_basicisma30360.h:112
This struct provides a namespace for datetime encoding constants.
Definition bdlt_datetimeimputil.h:91
static const Datetime * epoch_0001_01_01()
static const bsls::Types::Uint64 k_MAX_VALUE
Definition bdlt_datetimeimputil.h:96
static const bsls::Types::Uint64 k_0001_01_01_VALUE
Definition bdlt_datetimeimputil.h:94
static const bsls::Types::Uint64 k_1970_01_01_VALUE
Definition bdlt_datetimeimputil.h:95
static const Datetime * epoch_max()
static const Datetime * epoch_1970_01_01()
unsigned long long Uint64
Definition bsls_types.h:137