File: _Exception.cpp

package info (click to toggle)
pythonmagick 0.7-5
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 2,284 kB
  • ctags: 377
  • sloc: sh: 9,133; cpp: 2,358; perl: 279; makefile: 100; python: 11
file content (47 lines) | stat: -rw-r--r-- 1,480 bytes parent folder | download | duplicates (9)
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

// Boost Includes ==============================================================
#include <boost/python.hpp>
#include <boost/cstdint.hpp>

// Includes ====================================================================
#include <Magick++/Exception.h>

// Using =======================================================================
using namespace boost::python;

// Declarations ================================================================
namespace  {

struct Magick_Exception_Wrapper: Magick::Exception
{
    Magick_Exception_Wrapper(PyObject* py_self_, const std::string& p0):
        Magick::Exception(p0), py_self(py_self_) {}

    Magick_Exception_Wrapper(PyObject* py_self_, const Magick::Exception& p0):
        Magick::Exception(p0), py_self(py_self_) {}

    const char* what() const throw() {
        return call_method< const char* >(py_self, "what");
    }

    const char* default_what() const {
        return Magick::Exception::what();
    }

    PyObject* py_self;
};


}// namespace 


// Module ======================================================================
void Export_pyste_src_Exception()
{
    class_< Magick::Exception, Magick_Exception_Wrapper >("Exception", init< const std::string& >())
        .def(init< const Magick::Exception& >())
        .def("what", (const char* (Magick::Exception::*)() const throw())&Magick::Exception::what, (const char* (Magick_Exception_Wrapper::*)() const)&Magick_Exception_Wrapper::default_what)
    ;

}