/usr/include/soci/exchange-traits.h is in libsoci-dev 3.2.3-2ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | //
// Copyright (C) 2004-2008 Maciej Sobczak, Stephen Hutton
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef SOCI_EXCHANGE_TRAITS_H_INCLUDED
#define SOCI_EXCHANGE_TRAITS_H_INCLUDED
#include "type-conversion-traits.h"
#include "soci-backend.h"
// std
#include <ctime>
#include <string>
#include <vector>
namespace soci
{
namespace details
{
struct basic_type_tag {};
struct user_type_tag {};
template <typename T>
struct exchange_traits
{
// this is used for tag-dispatch between implementations for basic types
// and user-defined types
typedef user_type_tag type_family;
enum // anonymous
{
x_type =
exchange_traits
<
typename type_conversion<T>::base_type
>::x_type
};
};
template <>
struct exchange_traits<short>
{
typedef basic_type_tag type_family;
enum { x_type = x_short };
};
template <>
struct exchange_traits<unsigned short> : exchange_traits<short>
{
};
template <>
struct exchange_traits<int>
{
typedef basic_type_tag type_family;
enum { x_type = x_integer };
};
template <>
struct exchange_traits<unsigned int> : exchange_traits<int>
{
};
template <>
struct exchange_traits<char>
{
typedef basic_type_tag type_family;
enum { x_type = x_char };
};
template <>
struct exchange_traits<long long>
{
typedef basic_type_tag type_family;
enum { x_type = x_long_long };
};
template <>
struct exchange_traits<unsigned long long>
{
typedef basic_type_tag type_family;
enum { x_type = x_unsigned_long_long };
};
// long must be mapped either to x_integer or x_long_long:
template<int long_size> struct long_traits_helper;
template<> struct long_traits_helper<4> { enum { x_type = x_integer }; };
template<> struct long_traits_helper<8> { enum { x_type = x_long_long }; };
template <>
struct exchange_traits<long int>
{
typedef basic_type_tag type_family;
enum { x_type = long_traits_helper<sizeof(long int)>::x_type };
};
template <>
struct exchange_traits<unsigned long> : exchange_traits<long>
{
};
template <>
struct exchange_traits<double>
{
typedef basic_type_tag type_family;
enum { x_type = x_double };
};
template <>
struct exchange_traits<std::string>
{
typedef basic_type_tag type_family;
enum { x_type = x_stdstring };
};
template <>
struct exchange_traits<std::tm>
{
typedef basic_type_tag type_family;
enum { x_type = x_stdtm };
};
template <typename T>
struct exchange_traits<std::vector<T> >
{
typedef typename exchange_traits<T>::type_family type_family;
enum { x_type = exchange_traits<T>::x_type };
};
} // namespace details
} // namespace soci
#endif // SOCI_EXCHANGE_TRAITS_H_INCLUDED
|