5 #ifndef ODB_WRAPPER_TRAITS_HXX
6 #define ODB_WRAPPER_TRAITS_HXX
14 #include <odb/details/config.hxx>
15 #include <odb/details/meta/remove-const.hxx>
36 typedef T wrapped_type;
37 typedef T* wrapper_type;
42 typename details::meta::remove_const<T>::result
43 unrestricted_wrapped_type;
45 static const bool null_handler =
true;
46 static const bool null_default =
false;
49 get_null (
const wrapper_type& p)
55 set_null (wrapper_type& p)
61 static const wrapped_type&
62 get_ref (
const wrapper_type& p)
67 static unrestricted_wrapped_type&
68 set_ref (wrapper_type& p)
71 p =
new unrestricted_wrapped_type;
73 return const_cast<unrestricted_wrapped_type&
> (*p);
92 typename odb::details::meta::remove_const<T>::result
95 static const bool null_handler =
true;
96 static const bool null_default =
false;
101 return p.get () == 0;
110 static const wrapped_type&
116 static unrestricted_wrapped_type&
120 p.reset (
new unrestricted_wrapped_type ());
122 return const_cast<unrestricted_wrapped_type&
> (*p);
130 template <
typename T,
typename D>
131 class wrapper_traits<std::unique_ptr<T, D>>
136 typedef T wrapped_type;
137 typedef std::unique_ptr<T, D> wrapper_type;
142 typename odb::details::meta::remove_const<T>::result
143 unrestricted_wrapped_type;
145 static const bool null_handler =
true;
146 static const bool null_default =
false;
149 get_null (
const wrapper_type& p)
155 set_null (wrapper_type& p)
160 static const wrapped_type&
161 get_ref (
const wrapper_type& p)
166 static unrestricted_wrapped_type&
167 set_ref (wrapper_type& p)
170 p.reset (
new unrestricted_wrapped_type ());
172 return const_cast<unrestricted_wrapped_type&
> (*p);
178 template <
typename T>
179 class wrapper_traits<std::shared_ptr<T>>
182 typedef T wrapped_type;
183 typedef std::shared_ptr<T> wrapper_type;
188 typename odb::details::meta::remove_const<T>::result
189 unrestricted_wrapped_type;
191 static const bool null_handler =
true;
192 static const bool null_default =
false;
195 get_null (
const wrapper_type& p)
201 set_null (wrapper_type& p)
206 static const wrapped_type&
207 get_ref (
const wrapper_type& p)
212 static unrestricted_wrapped_type&
213 set_ref (wrapper_type& p)
216 p.reset (
new unrestricted_wrapped_type);
218 return const_cast<unrestricted_wrapped_type&
> (*p);
226 template <
typename T>
238 typename odb::details::meta::remove_const<T>::result
241 static const bool null_handler =
true;
242 static const bool null_default =
true;
256 static const wrapped_type&
262 static unrestricted_wrapped_type&
266 n = unrestricted_wrapped_type ();
268 return const_cast<unrestricted_wrapped_type&
> (*n);
275 #endif // ODB_WRAPPER_TRAITS_HXX
static unrestricted_wrapped_type & set_ref(wrapper_type &p)
Definition: wrapper-traits.hxx:117
bool null() const
Definition: nullable.hxx:139
static const wrapped_type & get_ref(const wrapper_type &p)
Definition: wrapper-traits.hxx:111
static unrestricted_wrapped_type & set_ref(wrapper_type &n)
Definition: wrapper-traits.hxx:263
T wrapped_type
Definition: wrapper-traits.hxx:86
Definition: wrapper-traits.hxx:20
T wrapped_type
Definition: wrapper-traits.hxx:232
static void set_null(wrapper_type &p)
Definition: wrapper-traits.hxx:105
Definition: nullable.hxx:15
nullable< T > wrapper_type
Definition: wrapper-traits.hxx:233
void reset()
Definition: nullable.hxx:188
static bool get_null(const wrapper_type &p)
Definition: wrapper-traits.hxx:99
odb::details::meta::remove_const< T >::result unrestricted_wrapped_type
Definition: wrapper-traits.hxx:239
odb::details::meta::remove_const< T >::result unrestricted_wrapped_type
Definition: wrapper-traits.hxx:93
static void set_null(wrapper_type &n)
Definition: wrapper-traits.hxx:251
static bool get_null(const wrapper_type &n)
Definition: wrapper-traits.hxx:245
static const wrapped_type & get_ref(const wrapper_type &n)
Definition: wrapper-traits.hxx:257
std::auto_ptr< T > wrapper_type
Definition: wrapper-traits.hxx:87