Main Page
Namespaces
Classes
Files
File List
File Members
libism
ISM
soci
src
core
boost-gregorian-date.h
Go to the documentation of this file.
1
//
2
// Copyright (C) 2008 Maciej Sobczak
3
// Distributed under the Boost Software License, Version 1.0.
4
// (See accompanying file LICENSE_1_0.txt or copy at
5
// http://www.boost.org/LICENSE_1_0.txt)
6
//
7
8
#ifndef SOCI_BOOST_GREGORIAN_DATE_H_INCLUDED
9
#define SOCI_BOOST_GREGORIAN_DATE_H_INCLUDED
10
11
#include "
type-conversion-traits.h
"
12
// boost
13
#include <boost/date_time/gregorian/gregorian_types.hpp>
14
#include <boost/date_time/gregorian/conversion.hpp>
15
// std
16
#include <ctime>
17
18
namespace
soci
19
{
20
21
template
<>
22
struct
type_conversion
<boost::gregorian::date>
23
{
24
typedef
std::tm
base_type
;
25
26
static
void
from_base
(
27
base_type
const
& in,
indicator
ind, boost::gregorian::date & out)
28
{
29
if
(ind ==
i_null
)
30
{
31
throw
soci_error
(
"Null value not allowed for this type"
);
32
}
33
34
out = boost::gregorian::date_from_tm(in);
35
}
36
37
static
void
to_base
(
38
boost::gregorian::date
const
& in, base_type & out,
indicator
& ind)
39
{
40
out = boost::gregorian::to_tm(in);
41
ind =
i_ok
;
42
}
43
};
44
45
}
// namespace soci
46
47
#endif // SOCI_BOOST_GREGORIAN_DATE_H_INCLUDED
soci::type_conversion< boost::gregorian::date >::to_base
static void to_base(boost::gregorian::date const &in, base_type &out, indicator &ind)
Definition:
boost-gregorian-date.h:37
soci::type_conversion< boost::gregorian::date >::base_type
std::tm base_type
Definition:
boost-gregorian-date.h:24
soci::i_null
Definition:
soci-backend.h:28
soci::soci_error
Definition:
core/error.h:19
soci::i_ok
Definition:
soci-backend.h:28
soci::indicator
indicator
Definition:
soci-backend.h:28
soci::type_conversion< boost::gregorian::date >::from_base
static void from_base(base_type const &in, indicator ind, boost::gregorian::date &out)
Definition:
boost-gregorian-date.h:26
soci
Definition:
db2/common.h:15
soci::type_conversion
Definition:
type-conversion-traits.h:19
type-conversion-traits.h
asr_lib_ism
Author(s): Hanselmann Fabian, Heller Florian, Heizmann Heinrich, Kübler Marcel, Mehlhaus Jonas, Meißner Pascal, Qattan Mohamad, Reckling Reno, Stroh Daniel
autogenerated on Wed Jan 8 2020 04:02:40