Sha256: 67ac9a8aaecc52a58acbe05b2704fd05b640ca8d3559f8b56ae3e79096a8255b

Contents?: true

Size: 941 Bytes

Versions: 3

Compression:

Stored size: 941 Bytes

Contents

#ifndef Rice__protect__hpp_
#define Rice__protect__hpp_

// This causes problems with certain C++ libraries
#undef TYPE

#include "Object_defn.hpp"

namespace Rice
{

/*! \file
 *  \brief A collection of functions (overloaded on number of
 *  arguments) for calling C functions that might raise Ruby exceptions.
 */

//! Call the C function f with arguments (arg1, arg2, ...).
/*! E.g.:
 *  \code
 *    VALUE x = protect(rb_ary_new);
 *    protect(rb_ary_push, x, INT2NUM(42));
 *  \endcode
 *
 *  Note that this function makes copies of all of its arguments; it
 *  does not take anything by reference.  All of the copies are const so
 *  that protect will not work if f takes a non-const
 *  reference to any of its arguments (though you can use non-const
 *  pointers).
 */
template<typename Fun, typename ...ArgT>
VALUE protect(Fun fun, ArgT const &... args);

} // namespace Rice

#include "protect.ipp"

#endif // Rice__protect__hpp_

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
rice-3.0.0 rice/protect.hpp
rice2-2.2.1 rice/protect.hpp
rice2-2.2.0 rice/protect.hpp