resonance 1.0.1
Loading...
Searching...
No Matches
callable.h
Go to the documentation of this file.
1#pragma once
2
3#include "script/cxx/config.h"
4#include "script/cxx/object.h"
5
6namespace Py {
7
26class Callable : public Object {
27public:
36 explicit Callable(const Object &other) : Object(other) {
37 validate();
38 }
39
48 virtual bool accepts(PyObject *pyob) const {
49 return pyob != nullptr && PyCallable_Check(pyob) != 0;
50 }
51};
52
53} // namespace Py
virtual bool accepts(PyObject *pyob) const
Accept only a callable object.
Definition callable.h:48
Callable(const Object &other)
Narrow an existing handle to a callable one.
Definition callable.h:36
Object(PyObject *pyob=Py_None)
Take a borrowed reference and add a count of its own.
Definition object.h:52
void validate()
Enforce this type's accepts() test on the stored reference.
Definition object.h:237
Configuration header of the PyCXX binding layer.
C++ wrappers for the embedded Python interpreter's objects, types, and extension modules.
Definition attributeerror.h:7