/usr/include/sigc++-2.0/sigc++/adaptors/exception_catch.h is in libsigc++-2.0-dev 2.4.0-1.
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 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 | // -*- c++ -*-
/* Do not edit! -- generated file */
#ifndef _SIGC_ADAPTORS_EXCEPTION_CATCH_H_
#define _SIGC_ADAPTORS_EXCEPTION_CATCH_H_
#include <sigc++/adaptors/adaptor_trait.h>
namespace sigc {
/*
functor adaptor: exception_catch(functor, catcher)
usage:
Future directions:
The catcher should be told what type of return it needs to
return for multiple type functors, to do this the user
will need to derive from catcher_base.
*/
/** @defgroup exception_catch exception_catch()
* sigc::exception_catch() catches an exception thrown from within
* the wrapped functor and directs it to a catcher functor.
* This catcher can then rethrow the exception and catch it with the proper type.
*
* Note that the catcher is expected to return the same type
* as the wrapped functor so that normal flow can continue.
*
* Catchers can be cascaded to catch multiple types, because uncaught
* rethrown exceptions proceed to the next catcher adaptor.
*
* @par Examples:
* @code
* struct my_catch
* {
* int operator()()
* {
* try { throw; }
* catch (std::range_error e) // catch what types we know
* { std::cerr << "caught " << e.what() << std::endl; }
* return 1;
* }
* }
* int foo(); // throws std::range_error
* sigc::exception_catch(&foo, my_catch())();
* @endcode
*
* The functor sigc::exception_catch() returns can be directly passed into
* sigc::signal::connect().
*
* @par Example:
* @code
* sigc::signal<int> some_signal;
* some_signal.connect(sigc::exception_catch(&foo, my_catch));
* @endcode
*
* @ingroup adaptors
*/
template <class T_functor, class T_catcher, class T_return = typename adapts<T_functor>::result_type>
struct exception_catch_functor : public adapts<T_functor>
{
typedef typename adapts<T_functor>::adaptor_type adaptor_type;
#ifndef DOXYGEN_SHOULD_SKIP_THIS
template <class T_arg1=void, class T_arg2=void, class T_arg3=void, class T_arg4=void, class T_arg5=void, class T_arg6=void, class T_arg7=void>
struct deduce_result_type
{ typedef typename adaptor_type::template deduce_result_type<typename type_trait<T_arg1>::pass, typename type_trait<T_arg2>::pass, typename type_trait<T_arg3>::pass, typename type_trait<T_arg4>::pass, typename type_trait<T_arg5>::pass, typename type_trait<T_arg6>::pass, typename type_trait<T_arg7>::pass>::type type; };
#endif
typedef T_return result_type;
result_type
operator()();
template <class T_arg1>
typename deduce_result_type<T_arg1>::type
operator()(T_arg1 _A_a1)
{
try
{
return this->functor_.SIGC_WORKAROUND_OPERATOR_PARENTHESES<typename type_trait<T_arg1>::pass>
(_A_a1);
}
catch (...)
{ return catcher_(); }
}
template <class T_arg1, class T_arg2>
typename deduce_result_type<T_arg1, T_arg2>::type
operator()(T_arg1 _A_a1, T_arg2 _A_a2)
{
try
{
return this->functor_.SIGC_WORKAROUND_OPERATOR_PARENTHESES<typename type_trait<T_arg1>::pass, typename type_trait<T_arg2>::pass>
(_A_a1, _A_a2);
}
catch (...)
{ return catcher_(); }
}
template <class T_arg1, class T_arg2, class T_arg3>
typename deduce_result_type<T_arg1, T_arg2, T_arg3>::type
operator()(T_arg1 _A_a1, T_arg2 _A_a2, T_arg3 _A_a3)
{
try
{
return this->functor_.SIGC_WORKAROUND_OPERATOR_PARENTHESES<typename type_trait<T_arg1>::pass, typename type_trait<T_arg2>::pass, typename type_trait<T_arg3>::pass>
(_A_a1, _A_a2, _A_a3);
}
catch (...)
{ return catcher_(); }
}
template <class T_arg1, class T_arg2, class T_arg3, class T_arg4>
typename deduce_result_type<T_arg1, T_arg2, T_arg3, T_arg4>::type
operator()(T_arg1 _A_a1, T_arg2 _A_a2, T_arg3 _A_a3, T_arg4 _A_a4)
{
try
{
return this->functor_.SIGC_WORKAROUND_OPERATOR_PARENTHESES<typename type_trait<T_arg1>::pass, typename type_trait<T_arg2>::pass, typename type_trait<T_arg3>::pass, typename type_trait<T_arg4>::pass>
(_A_a1, _A_a2, _A_a3, _A_a4);
}
catch (...)
{ return catcher_(); }
}
template <class T_arg1, class T_arg2, class T_arg3, class T_arg4, class T_arg5>
typename deduce_result_type<T_arg1, T_arg2, T_arg3, T_arg4, T_arg5>::type
operator()(T_arg1 _A_a1, T_arg2 _A_a2, T_arg3 _A_a3, T_arg4 _A_a4, T_arg5 _A_a5)
{
try
{
return this->functor_.SIGC_WORKAROUND_OPERATOR_PARENTHESES<typename type_trait<T_arg1>::pass, typename type_trait<T_arg2>::pass, typename type_trait<T_arg3>::pass, typename type_trait<T_arg4>::pass, typename type_trait<T_arg5>::pass>
(_A_a1, _A_a2, _A_a3, _A_a4, _A_a5);
}
catch (...)
{ return catcher_(); }
}
template <class T_arg1, class T_arg2, class T_arg3, class T_arg4, class T_arg5, class T_arg6>
typename deduce_result_type<T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6>::type
operator()(T_arg1 _A_a1, T_arg2 _A_a2, T_arg3 _A_a3, T_arg4 _A_a4, T_arg5 _A_a5, T_arg6 _A_a6)
{
try
{
return this->functor_.SIGC_WORKAROUND_OPERATOR_PARENTHESES<typename type_trait<T_arg1>::pass, typename type_trait<T_arg2>::pass, typename type_trait<T_arg3>::pass, typename type_trait<T_arg4>::pass, typename type_trait<T_arg5>::pass, typename type_trait<T_arg6>::pass>
(_A_a1, _A_a2, _A_a3, _A_a4, _A_a5, _A_a6);
}
catch (...)
{ return catcher_(); }
}
template <class T_arg1, class T_arg2, class T_arg3, class T_arg4, class T_arg5, class T_arg6, class T_arg7>
typename deduce_result_type<T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7>::type
operator()(T_arg1 _A_a1, T_arg2 _A_a2, T_arg3 _A_a3, T_arg4 _A_a4, T_arg5 _A_a5, T_arg6 _A_a6, T_arg7 _A_a7)
{
try
{
return this->functor_.SIGC_WORKAROUND_OPERATOR_PARENTHESES<typename type_trait<T_arg1>::pass, typename type_trait<T_arg2>::pass, typename type_trait<T_arg3>::pass, typename type_trait<T_arg4>::pass, typename type_trait<T_arg5>::pass, typename type_trait<T_arg6>::pass, typename type_trait<T_arg7>::pass>
(_A_a1, _A_a2, _A_a3, _A_a4, _A_a5, _A_a6, _A_a7);
}
catch (...)
{ return catcher_(); }
}
exception_catch_functor(const T_functor& _A_func,
const T_catcher& _A_catcher)
: adapts<T_functor>(_A_func), catcher_(_A_catcher)
{}
T_catcher catcher_;
};
template <class T_functor, class T_catcher, class T_return>
typename exception_catch_functor<T_functor, T_catcher, T_return>::result_type
exception_catch_functor<T_functor, T_catcher, T_return>::operator()()
{
try
{ return this->functor_(); }
catch (...)
{ return catcher_(); }
}
// void specialization
template <class T_functor, class T_catcher>
struct exception_catch_functor<T_functor, T_catcher, void> : public adapts<T_functor>
{
typedef void result_type;
typedef typename adapts<T_functor>::adaptor_type adaptor_type;
void
operator()();
template <class T_arg1>
typename deduce_result_type<T_arg1>::type
operator()(T_arg1 _A_a1)
{
try
{
return this->functor_.SIGC_WORKAROUND_OPERATOR_PARENTHESES<typename type_trait<T_arg1>::pass>
(_A_a1);
}
catch (...)
{ return catcher_(); }
}
template <class T_arg1, class T_arg2>
typename deduce_result_type<T_arg1, T_arg2>::type
operator()(T_arg1 _A_a1, T_arg2 _A_a2)
{
try
{
return this->functor_.SIGC_WORKAROUND_OPERATOR_PARENTHESES<typename type_trait<T_arg1>::pass, typename type_trait<T_arg2>::pass>
(_A_a1, _A_a2);
}
catch (...)
{ return catcher_(); }
}
template <class T_arg1, class T_arg2, class T_arg3>
typename deduce_result_type<T_arg1, T_arg2, T_arg3>::type
operator()(T_arg1 _A_a1, T_arg2 _A_a2, T_arg3 _A_a3)
{
try
{
return this->functor_.SIGC_WORKAROUND_OPERATOR_PARENTHESES<typename type_trait<T_arg1>::pass, typename type_trait<T_arg2>::pass, typename type_trait<T_arg3>::pass>
(_A_a1, _A_a2, _A_a3);
}
catch (...)
{ return catcher_(); }
}
template <class T_arg1, class T_arg2, class T_arg3, class T_arg4>
typename deduce_result_type<T_arg1, T_arg2, T_arg3, T_arg4>::type
operator()(T_arg1 _A_a1, T_arg2 _A_a2, T_arg3 _A_a3, T_arg4 _A_a4)
{
try
{
return this->functor_.SIGC_WORKAROUND_OPERATOR_PARENTHESES<typename type_trait<T_arg1>::pass, typename type_trait<T_arg2>::pass, typename type_trait<T_arg3>::pass, typename type_trait<T_arg4>::pass>
(_A_a1, _A_a2, _A_a3, _A_a4);
}
catch (...)
{ return catcher_(); }
}
template <class T_arg1, class T_arg2, class T_arg3, class T_arg4, class T_arg5>
typename deduce_result_type<T_arg1, T_arg2, T_arg3, T_arg4, T_arg5>::type
operator()(T_arg1 _A_a1, T_arg2 _A_a2, T_arg3 _A_a3, T_arg4 _A_a4, T_arg5 _A_a5)
{
try
{
return this->functor_.SIGC_WORKAROUND_OPERATOR_PARENTHESES<typename type_trait<T_arg1>::pass, typename type_trait<T_arg2>::pass, typename type_trait<T_arg3>::pass, typename type_trait<T_arg4>::pass, typename type_trait<T_arg5>::pass>
(_A_a1, _A_a2, _A_a3, _A_a4, _A_a5);
}
catch (...)
{ return catcher_(); }
}
template <class T_arg1, class T_arg2, class T_arg3, class T_arg4, class T_arg5, class T_arg6>
typename deduce_result_type<T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6>::type
operator()(T_arg1 _A_a1, T_arg2 _A_a2, T_arg3 _A_a3, T_arg4 _A_a4, T_arg5 _A_a5, T_arg6 _A_a6)
{
try
{
return this->functor_.SIGC_WORKAROUND_OPERATOR_PARENTHESES<typename type_trait<T_arg1>::pass, typename type_trait<T_arg2>::pass, typename type_trait<T_arg3>::pass, typename type_trait<T_arg4>::pass, typename type_trait<T_arg5>::pass, typename type_trait<T_arg6>::pass>
(_A_a1, _A_a2, _A_a3, _A_a4, _A_a5, _A_a6);
}
catch (...)
{ return catcher_(); }
}
template <class T_arg1, class T_arg2, class T_arg3, class T_arg4, class T_arg5, class T_arg6, class T_arg7>
typename deduce_result_type<T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7>::type
operator()(T_arg1 _A_a1, T_arg2 _A_a2, T_arg3 _A_a3, T_arg4 _A_a4, T_arg5 _A_a5, T_arg6 _A_a6, T_arg7 _A_a7)
{
try
{
return this->functor_.SIGC_WORKAROUND_OPERATOR_PARENTHESES<typename type_trait<T_arg1>::pass, typename type_trait<T_arg2>::pass, typename type_trait<T_arg3>::pass, typename type_trait<T_arg4>::pass, typename type_trait<T_arg5>::pass, typename type_trait<T_arg6>::pass, typename type_trait<T_arg7>::pass>
(_A_a1, _A_a2, _A_a3, _A_a4, _A_a5, _A_a6, _A_a7);
}
catch (...)
{ return catcher_(); }
}
exception_catch_functor() {}
exception_catch_functor(const T_functor& _A_func,
const T_catcher& _A_catcher)
: adapts<T_functor>(_A_func), catcher_(_A_catcher)
{}
~exception_catch_functor() {}
T_catcher catcher_;
};
template <class T_functor, class T_catcher>
void exception_catch_functor<T_functor, T_catcher, void>::operator()()
{
try
{ this->functor_(); } // I don't understand why void return doesn't work here (Martin)
catch (...)
{ this->catcher_(); }
}
#ifndef DOXYGEN_SHOULD_SKIP_THIS
//template specialization of visitor<>::do_visit_each<>(action, functor):
template <class T_functor, class T_catcher, class T_return>
struct visitor<exception_catch_functor<T_functor, T_catcher, T_return> >
{
template <typename T_action>
static void do_visit_each(const T_action& _A_action,
const exception_catch_functor<T_functor, T_catcher, T_return>& _A_target)
{
sigc::visit_each(_A_action, _A_target.functor_);
sigc::visit_each(_A_action, _A_target.catcher_);
}
};
#endif // DOXYGEN_SHOULD_SKIP_THIS
template <class T_functor, class T_catcher>
inline exception_catch_functor<T_functor, T_catcher>
exception_catch(const T_functor& _A_func, const T_catcher& _A_catcher)
{ return exception_catch_functor<T_functor, T_catcher>(_A_func, _A_catcher); }
} /* namespace sigc */
#endif /* _SIGC_ADAPTORS_EXCEPTION_CATCH_H_ */
|