/usr/include/soci/bind-values.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 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | #ifndef SOCI_BIND_VALUES_H_INCLUDED
#define SOCI_BIND_VALUES_H_INCLUDED
#include "exchange-traits.h"
#include "into-type.h"
#include "into.h"
#include "soci-backend.h"
#include "use-type.h"
#include "use.h"
#ifdef HAVE_BOOST
# include <boost/fusion/algorithm/iteration/for_each.hpp>
# include <boost/mpl/bool.hpp>
#endif // HAVE_BOOST
#include <vector>
namespace soci
{
namespace details
{
class use_type_vector: public std::vector<use_type_base *>
{
public:
~use_type_vector()
{
for(iterator iter = begin(), _end = end();
iter != _end; iter++)
delete *iter;
}
void exchange(use_type_ptr const& u) { push_back(u.get()); u.release(); }
template <typename T, typename Indicator>
void exchange(use_container<T, Indicator> const &uc)
{
#ifdef HAVE_BOOST
exchange_(uc, (typename boost::fusion::traits::is_sequence<T>::type *)NULL);
#else
exchange_(uc, NULL);
#endif // HAVE_BOOST
}
private:
#ifdef HAVE_BOOST
template <typename T, typename Indicator>
struct use_sequence
{
use_sequence(use_type_vector &_p, Indicator &_ind)
:p(_p), ind(_ind) {}
template <typename T2>
void operator()(T2 &t2) const
{
p.exchange(use(t2, ind));
}
use_type_vector &p;
Indicator &ind;
};
template <typename T>
struct use_sequence<T, details::no_indicator>
{
use_sequence(use_type_vector &_p)
:p(_p) {}
template <typename T2>
void operator()(T2 &t2) const
{
p.exchange(use(t2));
}
use_type_vector &p;
};
template <typename T, typename Indicator>
void exchange_(use_container<T, Indicator> const &uc, boost::mpl::true_ * /* fusion sequence */)
{
boost::fusion::for_each(uc.t, use_sequence<T, Indicator>(*this, uc.ind));
}
template <typename T>
void exchange_(use_container<T, details::no_indicator> const &uc, boost::mpl::true_ * /* fusion sequence */)
{
boost::fusion::for_each(uc.t, use_sequence<T, details::no_indicator>(*this));
}
#endif // HAVE_BOOST
template <typename T, typename Indicator>
void exchange_(use_container<T, Indicator> const &uc, ...)
{ exchange(do_use(uc.t, uc.ind, uc.name, typename details::exchange_traits<T>::type_family())); }
template <typename T>
void exchange_(use_container<T, details::no_indicator> const &uc, ...)
{ exchange(do_use(uc.t, uc.name, typename details::exchange_traits<T>::type_family())); }
template <typename T, typename Indicator>
void exchange_(use_container<const T, Indicator> const &uc, ...)
{ exchange(do_use(uc.t, uc.ind, uc.name, typename details::exchange_traits<T>::type_family())); }
template <typename T>
void exchange_(use_container<const T, details::no_indicator> const &uc, ...)
{ exchange(do_use(uc.t, uc.name, typename details::exchange_traits<T>::type_family())); }
};
class into_type_vector: public std::vector<details::into_type_base *>
{
public:
~into_type_vector()
{
for(iterator iter = begin(), _end = end();
iter != _end; iter++)
delete *iter;
}
void exchange(into_type_ptr const& i) { push_back(i.get()); i.release(); }
template <typename T, typename Indicator>
void exchange(into_container<T, Indicator> const &ic)
{
#ifdef HAVE_BOOST
exchange_(ic, (typename boost::fusion::traits::is_sequence<T>::type *)NULL);
#else
exchange_(ic, NULL);
#endif // HAVE_BOOST
}
private:
#ifdef HAVE_BOOST
template <typename T, typename Indicator>
struct into_sequence
{
into_sequence(into_type_vector &_p, Indicator &_ind)
:p(_p), ind(_ind) {}
template <typename T2>
void operator()(T2 &t2) const
{
p.exchange(into(t2, ind));
}
into_type_vector &p;
Indicator &ind;
};
template <typename T>
struct into_sequence<T, details::no_indicator>
{
into_sequence(into_type_vector &_p)
:p(_p) {}
template <typename T2>
void operator()(T2 &t2) const
{
p.exchange(into(t2));
}
into_type_vector &p;
};
template <typename T, typename Indicator>
void exchange_(into_container<T, Indicator> const &ic, boost::mpl::true_ * /* fusion sequence */)
{
boost::fusion::for_each(ic.t, into_sequence<T, Indicator>(*this, ic.ind));
}
template <typename T>
void exchange_(into_container<T, details::no_indicator> const &ic, boost::mpl::true_ * /* fusion sequence */)
{
boost::fusion::for_each(ic.t, into_sequence<T, details::no_indicator>(*this));
}
#endif // HAVE_BOOST
template <typename T, typename Indicator>
void exchange_(into_container<T, Indicator> const &ic, ...)
{ exchange(do_into(ic.t, ic.ind, typename details::exchange_traits<T>::type_family())); }
template <typename T>
void exchange_(into_container<T, details::no_indicator> const &ic, ...)
{ exchange(do_into(ic.t, typename details::exchange_traits<T>::type_family())); }
};
} // namespace details
}// namespace soci
#endif // SOCI_BIND_VALUES_H_INCLUDED
|