Main Page
Namespaces
Classes
Files
File List
File Members
libism
ISM
soci
src
core
boost-optional.h
Go to the documentation of this file.
1
//
2
// Copyright (C) 2004-2008 Maciej Sobczak, Stephen Hutton
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_OPTIONAL_H_INCLUDED
9
#define SOCI_BOOST_OPTIONAL_H_INCLUDED
10
11
#include "
type-conversion-traits.h
"
12
// boost
13
#include <boost/optional.hpp>
14
15
namespace
soci
16
{
17
18
// simple fall-back for boost::optional
19
template
<
typename
T>
20
struct
type_conversion
<boost::optional<T> >
21
{
22
typedef
typename
type_conversion<T>::base_type
base_type
;
23
24
static
void
from_base
(base_type
const
& in,
indicator
ind,
25
boost::optional<T> & out)
26
{
27
if
(ind ==
i_null
)
28
{
29
out.reset();
30
}
31
else
32
{
33
T tmp;
34
type_conversion<T>::from_base
(in, ind, tmp);
35
out = tmp;
36
}
37
}
38
39
static
void
to_base
(boost::optional<T>
const
& in,
40
base_type & out,
indicator
& ind)
41
{
42
if
(in.is_initialized())
43
{
44
type_conversion<T>::to_base
(in.get(), out, ind);
45
}
46
else
47
{
48
ind =
i_null
;
49
}
50
}
51
};
52
53
}
// namespace soci
54
55
#endif // SOCI_BOOST_OPTIONAL_H_INCLUDED
soci::type_conversion< boost::optional< T > >::base_type
type_conversion< T >::base_type base_type
Definition:
boost-optional.h:22
soci::i_null
Definition:
soci-backend.h:28
soci::type_conversion::to_base
static void to_base(T const &in, base_type &out, indicator &ind)
Definition:
type-conversion-traits.h:32
soci::type_conversion< boost::optional< T > >::from_base
static void from_base(base_type const &in, indicator ind, boost::optional< T > &out)
Definition:
boost-optional.h:24
soci::type_conversion::from_base
static void from_base(base_type const &in, indicator ind, T &out)
Definition:
type-conversion-traits.h:23
soci::type_conversion< boost::optional< T > >::to_base
static void to_base(boost::optional< T > const &in, base_type &out, indicator &ind)
Definition:
boost-optional.h:39
soci::indicator
indicator
Definition:
soci-backend.h:28
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