/usr/include/luabind/detail/decorate_type.hpp is in libluabind-dev 0.9.1+dfsg-11.
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 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 | // Copyright (c) 2003 Daniel Wallin and Arvid Norberg
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
// OR OTHER DEALINGS IN THE SOFTWARE.
#ifndef LUABIND_DECORATE_TYPE_HPP_INCLUDED
#define LUABIND_DECORATE_TYPE_HPP_INCLUDED
#include <luabind/config.hpp>
#include <luabind/detail/primitives.hpp>
namespace luabind { namespace detail
{
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
template<class T>
struct decorated_type
{
static by_value<T> t;
static inline by_value<T>& get() { return /*by_value<T>()*/t; }
};
template<class T>
by_value<T> decorated_type<T>::t;
template<class T>
struct decorated_type<T*>
{
static by_pointer<T> t;
static inline by_pointer<T>& get() { return /*by_pointer<T>()*/t; }
};
template<class T>
by_pointer<T> decorated_type<T*>::t;
template<class T>
struct decorated_type<const T*>
{
static by_const_pointer<T> t;
static inline by_const_pointer<T> get() { return /*by_const_pointer<T>()*/t; }
};
template<class T>
by_const_pointer<T> decorated_type<const T*>::t;
template<class T>
struct decorated_type<const T* const>
{
static by_const_pointer<T> t;
static inline by_const_pointer<T>& get() { return /*by_const_pointer<T>()*/t; }
};
template<class T>
by_const_pointer<T> decorated_type<const T* const>::t;
template<class T>
struct decorated_type<T&>
{
static by_reference<T> t;
static inline by_reference<T>& get() { return /*by_reference<T>()*/t; }
};
template<class T>
by_reference<T> decorated_type<T&>::t;
template<class T>
struct decorated_type<const T&>
{
static by_const_reference<T> t;
static inline by_const_reference<T>& get() { return /*by_const_reference<T>()*/t; }
};
template<class T>
by_const_reference<T> decorated_type<const T&>::t;
#define LUABIND_DECORATE_TYPE(t) luabind::detail::decorated_type<t>::get()
#else
#include <boost/type_traits/is_array.hpp>
namespace
{
LUABIND_ANONYMOUS_FIX char decorated_type_array[64];
}
template<class T>
struct decorated_type_cref_impl
{
#if defined(BOOST_MSVC) && BOOST_MSVC == 1200
template<class U>
static by_const_reference<U> get(const U&)
{
return by_const_reference<U>();
}
static T data() { return reinterpret_cast<T>(decorated_type_array); }
#else
static void(*data())(T)
{ return (void(*)(T))0; }
template<class U>
static by_const_reference<U> get(void(*f)(const U&))
{ return by_const_reference<U>(); }
#endif
};
template<class T>
struct decorated_type_ref_impl
{
#if defined(BOOST_MSVC) && BOOST_MSVC == 1200
template<class U>
static by_reference<U> get(U&)
{
return by_reference<U>();
}
static T data() { return reinterpret_cast<T>(decorated_type_array); }
#else
static void(*data())(T)
{ return (void(*)(T))0; }
template<class U>
static by_reference<U> get(void(*)(U&))
{ return by_reference<U>(); }
#endif
};
template<class T>
struct decorated_type_cptr_impl
{
#if defined(BOOST_MSVC) && BOOST_MSVC == 1200
template<class U>
static by_const_pointer<U> get(const U*)
{
return by_const_pointer<U>();
}
static T& data() { return reinterpret_cast<T&>(decorated_type_array); }
#else
static void(*data())(T)
{ return (void(*)(T))0; }
template<class U>
static by_const_pointer<U> get(void(*)(const U*))
{ return by_const_pointer<U>(); }
#endif
};
template<class T>
struct decorated_type_ptr_impl
{
#if defined(BOOST_MSVC) && BOOST_MSVC == 1200
template<class U>
static by_pointer<U> get(U*)
{
return by_pointer<U>();
}
static T& data() { return reinterpret_cast<T&>(decorated_type_array); }
#else
static void(*data())(T)
{ return (void(*)(T))0; }
template<class U>
static by_pointer<U> get(void(*)(U*))
{ return by_pointer<U>(); }
#endif
};
template<class T>
struct decorated_type_value_impl
{
#if defined(BOOST_MSVC) && BOOST_MSVC == 1200
template<class U>
static by_value<U> get(U&)
{
return by_value<U>();
}
static T& data() { return reinterpret_cast<T&>(decorated_type_array); }
#else
static void(*data())(T&)
{ return (void(*)(T&))0; }
template<class U>
static by_value<U> get(void(*)(U&))
{ return by_value<U>(); }
#endif
};
template<>
struct decorated_type_value_impl<void>
{
static by_value<void> get(int)
{
return by_value<void>();
}
static int data() { return 0; }
};
template<class T>
struct decorated_type_array_impl
{
template<class U>
static by_pointer<U> get(U*)
{
return by_pointer<U>();
}
template<class U>
static by_pointer<U> get(void(*)(U))
{ return by_pointer<U>(); }
static T& data() { return reinterpret_cast<T&>(decorated_type_array); }
};
template<class T>
struct decorated_type
// : boost::mpl::if_<boost::is_array<T>
// , decorated_type_array_impl<T>
: boost::mpl::if_<luabind::detail::is_const_reference<T>
, decorated_type_cref_impl<T>
, typename boost::mpl::if_<luabind::detail::is_nonconst_reference<T>
, decorated_type_ref_impl<T>
, typename boost::mpl::if_<luabind::detail::is_nonconst_pointer<T>
, decorated_type_ptr_impl<T>
, typename boost::mpl::if_<luabind::detail::is_const_pointer<T>
, decorated_type_cptr_impl<T>
, decorated_type_value_impl<T>
>::type
>::type
>::type
>::type
// >::type
{
};
#if defined(BOOST_MSVC) && BOOST_MSVC == 1200
#define LUABIND_DECORATE_TYPE(t) luabind::detail::decorated_type<t>::get(luabind::detail::decorated_type<t>::data())
#else
// #define LUABIND_DECORATE_TYPE(t) luabind::detail::decorated_type<t>::get((void(*)(type<t>))0)
#define LUABIND_DECORATE_TYPE(t) luabind::detail::decorated_type<t>::get(luabind::detail::decorated_type<t>::data())
//#define LUABIND_DECORATE_TYPE(t) luabind::detail::decorated_type<t>::get(type<t>())
#endif
#endif
}}
#endif // LUABIND_DECORATE_TYPE_HPP_INCLUDED
|