Main Page
Namespaces
Classes
Files
File List
File Members
libism
ISM
soci
src
core
exchange-traits.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_EXCHANGE_TRAITS_H_INCLUDED
9
#define SOCI_EXCHANGE_TRAITS_H_INCLUDED
10
11
#include "
type-conversion-traits.h
"
12
#include "
soci-backend.h
"
13
// std
14
#include <ctime>
15
#include <string>
16
#include <vector>
17
18
namespace
soci
19
{
20
21
namespace
details
22
{
23
24
struct
basic_type_tag
{};
25
struct
user_type_tag
{};
26
27
template
<
typename
T>
28
struct
exchange_traits
29
{
30
// this is used for tag-dispatch between implementations for basic types
31
// and user-defined types
32
typedef
user_type_tag
type_family
;
33
34
enum
// anonymous
35
{
36
x_type =
37
exchange_traits
38
<
39
typename
type_conversion<T>::base_type
40
>::x_type
41
};
42
};
43
44
template
<>
45
struct
exchange_traits
<short>
46
{
47
typedef
basic_type_tag
type_family
;
48
enum
{ x_type =
x_short
};
49
};
50
51
template
<>
52
struct
exchange_traits
<unsigned short> :
exchange_traits
<short>
53
{
54
};
55
56
template
<>
57
struct
exchange_traits
<int>
58
{
59
typedef
basic_type_tag
type_family
;
60
enum
{ x_type =
x_integer
};
61
};
62
63
template
<>
64
struct
exchange_traits
<unsigned int> :
exchange_traits
<int>
65
{
66
};
67
68
template
<>
69
struct
exchange_traits
<char>
70
{
71
typedef
basic_type_tag
type_family
;
72
enum
{ x_type =
x_char
};
73
};
74
75
template
<>
76
struct
exchange_traits
<long long>
77
{
78
typedef
basic_type_tag
type_family
;
79
enum
{ x_type =
x_long_long
};
80
};
81
82
template
<>
83
struct
exchange_traits
<unsigned long long>
84
{
85
typedef
basic_type_tag
type_family
;
86
enum
{ x_type =
x_unsigned_long_long
};
87
};
88
89
// long must be mapped either to x_integer or x_long_long:
90
template
<
int
long
_size>
struct
long_traits_helper
;
91
template
<>
struct
long_traits_helper
<4> {
enum
{ x_type =
x_integer
}; };
92
template
<>
struct
long_traits_helper
<8> {
enum
{ x_type =
x_long_long
}; };
93
94
template
<>
95
struct
exchange_traits
<long int>
96
{
97
typedef
basic_type_tag
type_family
;
98
enum
{ x_type =
long_traits_helper<sizeof(long int)>::x_type
};
99
};
100
101
template
<>
102
struct
exchange_traits
<unsigned long> :
exchange_traits
<long>
103
{
104
};
105
106
template
<>
107
struct
exchange_traits
<double>
108
{
109
typedef
basic_type_tag
type_family
;
110
enum
{ x_type =
x_double
};
111
};
112
113
template
<>
114
struct
exchange_traits
<
std
::string>
115
{
116
typedef
basic_type_tag
type_family
;
117
enum
{ x_type =
x_stdstring
};
118
};
119
120
template
<>
121
struct
exchange_traits
<
std
::tm>
122
{
123
typedef
basic_type_tag
type_family
;
124
enum
{ x_type =
x_stdtm
};
125
};
126
127
template
<
typename
T>
128
struct
exchange_traits
<
std
::vector<T> >
129
{
130
typedef
typename
exchange_traits<T>::type_family
type_family
;
131
enum
{ x_type =
exchange_traits<T>::x_type
};
132
};
133
134
}
// namespace details
135
136
}
// namespace soci
137
138
#endif // SOCI_EXCHANGE_TRAITS_H_INCLUDED
soci::details::exchange_traits< std::vector< T > >::type_family
exchange_traits< T >::type_family type_family
Definition:
exchange-traits.h:130
soci::details::x_stdstring
Definition:
soci-backend.h:39
soci::details::x_char
Definition:
soci-backend.h:38
soci-backend.h
soci::details::x_double
Definition:
soci-backend.h:44
soci::details::exchange_traits< char >::type_family
basic_type_tag type_family
Definition:
exchange-traits.h:71
soci::details::exchange_traits< double >::type_family
basic_type_tag type_family
Definition:
exchange-traits.h:109
std
soci::details::basic_type_tag
Definition:
exchange-traits.h:24
soci::details::exchange_traits< short >::type_family
basic_type_tag type_family
Definition:
exchange-traits.h:47
soci::details::long_traits_helper
Definition:
exchange-traits.h:90
soci::details::exchange_traits< std::tm >::type_family
basic_type_tag type_family
Definition:
exchange-traits.h:123
soci::details::exchange_traits< long int >::type_family
basic_type_tag type_family
Definition:
exchange-traits.h:97
soci::details::exchange_traits< long long >::type_family
basic_type_tag type_family
Definition:
exchange-traits.h:78
soci::details::exchange_traits< std::string >::type_family
basic_type_tag type_family
Definition:
exchange-traits.h:116
soci::details::x_short
Definition:
soci-backend.h:40
soci::details::exchange_traits< unsigned long long >::type_family
basic_type_tag type_family
Definition:
exchange-traits.h:85
soci::details::x_stdtm
Definition:
soci-backend.h:45
soci::details::x_unsigned_long_long
Definition:
soci-backend.h:43
soci::details::x_integer
Definition:
soci-backend.h:41
soci::details::exchange_traits< int >::type_family
basic_type_tag type_family
Definition:
exchange-traits.h:59
soci::details::exchange_traits::type_family
user_type_tag type_family
Definition:
exchange-traits.h:32
soci::details::x_long_long
Definition:
soci-backend.h:42
soci
Definition:
db2/common.h:15
soci::type_conversion
Definition:
type-conversion-traits.h:19
soci::details::user_type_tag
Definition:
exchange-traits.h:25
soci::details::exchange_traits
Definition:
exchange-traits.h:28
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