resonance 1.0.1
Loading...
Searching...
No Matches
type.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
22class Type : public Object {
23public:
31 explicit Type(PyObject *pyob) : Object(pyob) {
32 validate();
33 }
34
43 virtual bool accepts(PyObject *pyob) const {
44 return pyob != nullptr && PyType_Check(pyob);
45 }
46};
47
48} // namespace Py
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
virtual bool accepts(PyObject *pyob) const
Accept only a type object.
Definition type.h:43
Type(PyObject *pyob)
Take a borrowed reference to an existing type object.
Definition type.h:31
Configuration header of the PyCXX binding layer.
C++ wrappers for the embedded Python interpreter's objects, types, and extension modules.
Definition attributeerror.h:7