Export C++ class data members as Python properties.
These macros create Python properties that provide access to C++ class data through various access patterns: getter/setter methods, free functions, or direct public member access.
Macro names follow the regular grammar (see Python Macro Name Conventions), but there are no _QUALIFIED versions.
Member Method Properties | |
Use C++ methods as getter/setter to define a Python property
Although Python doesn't know the concept of constness, Python Shadow Classes may contain a reference to a constant shadowee instance. Getters may be overloaded on this constness and the class Foo
{
public:
lass::util::SharedPtr<const Bar> bar() const;
lass::util::SharedPtr<Bar> bar();
};
PY_SHADOW_CLASS(DLL_EXPORT, PyFoo, Foo)
PY_SHADOW_CASTERS(PyFoo)
PY_DECLARE_CLASS_NAME(PyFoo, "Foo")
PY_CLASS_MEMBER_R(PyFoo, bar) // will return SharedPtr<const Bar> or SharedPtr<Bar> depending on Foo constness
#define PY_DECLARE_CLASS_NAME(t_cppClass, s_name) Declare a Python class with custom name but no documentation. Definition pyobject_macros.h:3856 #define PY_CLASS_MEMBER_R(i_cppClass, i_cppGetter) Export a getter as a read-only Python property. Definition pyobject_macros.h:9952 #define PY_SHADOW_CASTERS(t_ShadowObject) Define lass::python::ShadoweeTraits for shadow class. Definition pyshadow_object.h:961 #define PY_SHADOW_CLASS(dllInterface, i_PyObjectShadowClass, t_CppClass) Declare Python shadow class with util::SharedPtr as default shadowee pointer type. Definition pyshadow_object.h:880 This also works in combination with a setter, using the
Setters may have one of following signatures:
See example below.
{
public:
bool isAlive() const;
const std::string& name() const;
void setName(const std::string& name); // setter with parameter
float price() const;
float& price(); // setter through non-const reference
};
PY_DECLARE_CLASS(Parrot)
PY_CLASS_MEMBER_RW(Parrot, name, setName) // p.name
PY_CLASS_MEMBER_RW(Parrot, price, price) // p.price
#define PY_DECLARE_CLASS(i_cppClass) Declare a Python class with automatic name and no documentation. Definition pyobject_macros.h:3891 #define PY_CLASS_MEMBER_R_NAME_DOC(i_cppClass, i_cppGetter, s_memberName, s_doc) Export a getter as a read-only Python property, with custom name and docstring. Definition pyobject_macros.h:9901 #define PY_CLASS_MEMBER_RW(i_cppClass, i_cppGetter, i_cppSetter) Export a getter/setter pair as a Python property. Definition pyobject_macros.h:9832 #define PY_HEADER(t_parentClass) Place as first line of your Pythonized class. Definition pyobject_plus.h:57
| |
| #define | PY_CLASS_MEMBER_RW_EX(t_cppClass, i_cppGetter, i_cppSetter, s_memberName, s_doc, i_dispatcher) |
| Export a getter/setter pair as a Python property, with full control. | |
| #define | PY_CLASS_MEMBER_RW_NAME_DOC(i_cppClass, i_cppGetter, i_cppSetter, s_memberName, s_doc) |
| Export a getter/setter pair as a Python property, with custom name and docstring. | |
| #define | PY_CLASS_MEMBER_RW_NAME(i_cppClass, i_cppGetter, i_cppSetter, s_memberName) |
| Export a getter/setter pair as a Python property, with custom Python name. | |
| #define | PY_CLASS_MEMBER_RW_DOC(i_cppClass, i_cppGetter, i_cppSetter, s_doc) |
| Export a getter/setter pair as a Python property, with docstring. | |
| #define | PY_CLASS_MEMBER_RW(i_cppClass, i_cppGetter, i_cppSetter) |
| Export a getter/setter pair as a Python property. | |
| #define | PY_CLASS_MEMBER_R_EX(t_cppClass, i_cppGetter, s_memberName, s_doc, i_dispatcher) |
| Export a getter as a read-only Python property, with full control. | |
| #define | PY_CLASS_MEMBER_R_NAME_DOC(i_cppClass, i_cppGetter, s_memberName, s_doc) |
| Export a getter as a read-only Python property, with custom name and docstring. | |
| #define | PY_CLASS_MEMBER_R_NAME(i_cppClass, i_cppGetter, s_memberName) |
| Export a getter as a read-only Python property, with custom Python name. | |
| #define | PY_CLASS_MEMBER_R_DOC(i_cppClass, i_cppGetter, s_doc) |
| Export a getter as a read-only Python property, with docstring. | |
| #define | PY_CLASS_MEMBER_R(i_cppClass, i_cppGetter) |
| Export a getter as a read-only Python property. | |
Free Function Properties | |
Export C/C++ free functions as Python properties. Use these when the getter/setter can't be a member. This is particularly useful for Python Shadow Classes where adding methods directly to the class is undesirable or impossible.
| |
| #define | PY_CLASS_FREE_MEMBER_RW_EX(t_cppClass, i_cppFreeGetter, i_cppFreeSetter, s_memberName, s_doc, i_dispatcher) |
| Export free accessors as a read-write Python property, with full control. | |
| #define | PY_CLASS_FREE_MEMBER_RW_NAME_DOC(i_cppClass, i_cppFreeGetter, i_cppFreeSetter, s_memberName, s_doc) |
| Export free accessors as a read-write Python property, with custom name and docstring. | |
| #define | PY_CLASS_FREE_MEMBER_RW_NAME(i_cppClass, i_cppFreeGetter, i_cppFreeSetter, s_memberName) |
| Export free accessors as a read-write Python property, with custom Python name. | |
| #define | PY_CLASS_FREE_MEMBER_RW_DOC(i_cppClass, i_cppFreeGetter, i_cppFreeSetter, s_doc) |
| Export free accessors as a read-write Python property, with docstring. | |
| #define | PY_CLASS_FREE_MEMBER_RW(i_cppClass, i_cppFreeGetter, i_cppFreeSetter) |
| Export free accessors as a read-write Python property. | |
| #define | PY_CLASS_FREE_MEMBER_R_EX(t_cppClass, i_cppFreeGetter, s_memberName, s_doc, i_dispatcher) |
| Export a free accessor as a read-only Python property, with full control. | |
| #define | PY_CLASS_FREE_MEMBER_R_NAME_DOC(i_cppClass, i_cppFreeGetter, s_memberName, s_doc) |
| Export a free accessor as a read-only Python property, with custom name and docstring. | |
| #define | PY_CLASS_FREE_MEMBER_R_NAME(i_cppClass, i_cppFreeGetter, s_memberName) |
| Export a free accessor as a read-only Python property, with custom Python name. | |
| #define | PY_CLASS_FREE_MEMBER_R_DOC(i_cppClass, i_cppFreeGetter, s_doc) |
| Export a free accessor as a read-only Python property, with docstring. | |
| #define | PY_CLASS_FREE_MEMBER_R(i_cppClass, i_cppFreeGetter) |
| Export a free accessor as a read-only Python property. | |
Public Member Properties | |
Exports a public data member directly as a Python property, allowing both read and write access. This provides direct access to the C++ member variable without requiring getter/setter methods.
| |
| #define | PY_CLASS_PUBLIC_MEMBER_EX(t_cppClass, i_cppMember, s_memberName, s_doc, i_dispatcher) |
| Export a public member as a read-write Python property, with full control. | |
| #define | PY_CLASS_PUBLIC_MEMBER_NAME_DOC(i_cppClass, i_cppMember, s_memberName, s_doc) |
| Export a public member as a read-write Python property, with custom name and docstring. | |
| #define | PY_CLASS_PUBLIC_MEMBER_NAME(i_cppClass, i_cppMember, s_memberName) |
| Export a public member as a read-write Python property, with custom Python name. | |
| #define | PY_CLASS_PUBLIC_MEMBER_DOC(i_cppClass, i_cppMember, s_doc) |
| Export a public member as a read-write Python property, with docstring. | |
| #define | PY_CLASS_PUBLIC_MEMBER(i_cppClass, i_cppMember) |
| Export a public member as a read-write Python property. | |
| #define | PY_CLASS_PUBLIC_MEMBER_R_EX(t_cppClass, i_cppMember, s_memberName, s_doc, i_dispatcher) |
| Export a public member as a read-only Python property, with full control. | |
| #define | PY_CLASS_PUBLIC_MEMBER_R_NAME_DOC(i_cppClass, i_cppMember, s_memberName, s_doc) |
| Export a public member as a read-only Python property, with custom name and docstring. | |
| #define | PY_CLASS_PUBLIC_MEMBER_R_NAME(i_cppClass, i_cppMember, s_memberName) |
| Export a public member as a read-only Python property, with custom Python name. | |
| #define | PY_CLASS_PUBLIC_MEMBER_R_DOC(i_cppClass, i_cppMember, s_doc) |
| Export a public member as a read-only Python property, with docstring. | |
| #define | PY_CLASS_PUBLIC_MEMBER_R(i_cppClass, i_cppMember) |
| Export a public member as a read-only Python property. | |
| #define PY_CLASS_MEMBER_RW_EX | ( | t_cppClass, | |
| i_cppGetter, | |||
| i_cppSetter, | |||
| s_memberName, | |||
| s_doc, | |||
| i_dispatcher ) |
Export a getter/setter pair as a Python property, with full control.
This is the most flexible read-write member export macro, allowing manual dispatcher naming.
Here you can use a fully qualified class name, at the cost of having to provide a unique suffix.
Exports a pair of C++ getter and setter methods as a Python read/write property.
| t_cppClass | C++ class containing the getter and setter methods |
| i_cppGetter | C++ method name of getter |
| i_cppSetter | C++ method name of setter |
| s_memberName | Python property name (null-terminated C string literal) |
| s_doc | Property documentation string (null-terminated C string literal, may be nullptr) |
| i_dispatcher | Unique identifier for the generated dispatcher functions |
Definition at line 9728 of file pyobject_macros.h.
| #define PY_CLASS_MEMBER_RW_NAME_DOC | ( | i_cppClass, | |
| i_cppGetter, | |||
| i_cppSetter, | |||
| s_memberName, | |||
| s_doc ) |
Export a getter/setter pair as a Python property, with custom name and docstring.
Wraps PY_CLASS_MEMBER_RW_EX() with auto-generated dispatcher name.
| i_cppClass | C++ class containing the getter and setter methods (unqualified name) |
| i_cppGetter | C++ method name of getter |
| i_cppSetter | C++ method name of setter |
| s_memberName | Python property name (null-terminated C string literal) |
| s_doc | Property documentation string (null-terminated C string literal, may be nullptr) |
Definition at line 9778 of file pyobject_macros.h.
| #define PY_CLASS_MEMBER_RW_NAME | ( | i_cppClass, | |
| i_cppGetter, | |||
| i_cppSetter, | |||
| s_memberName ) |
Export a getter/setter pair as a Python property, with custom Python name.
Wraps PY_CLASS_MEMBER_RW_NAME_DOC() with s_doc = nullptr.
| i_cppClass | C++ class containing the getter and setter methods (unqualified name) |
| i_cppGetter | C++ method name of getter |
| i_cppSetter | C++ method name of setter |
| s_memberName | Python property name (null-terminated C string literal) |
Definition at line 9797 of file pyobject_macros.h.
| #define PY_CLASS_MEMBER_RW_DOC | ( | i_cppClass, | |
| i_cppGetter, | |||
| i_cppSetter, | |||
| s_doc ) |
Export a getter/setter pair as a Python property, with docstring.
Wraps PY_CLASS_MEMBER_RW_NAME_DOC() with s_memberName derived from i_cppGetter.
| i_cppClass | C++ class containing the getter and setter methods (unqualified name) |
| i_cppGetter | C++ method name of getter (also used as Python property name) |
| i_cppSetter | C++ method name of setter |
| s_doc | Property documentation string (null-terminated C string literal, may be nullptr) |
Definition at line 9815 of file pyobject_macros.h.
| #define PY_CLASS_MEMBER_RW | ( | i_cppClass, | |
| i_cppGetter, | |||
| i_cppSetter ) |
Export a getter/setter pair as a Python property.
Wraps PY_CLASS_MEMBER_RW_DOC() with s_doc = nullptr.
| i_cppClass | C++ class containing the getter and setter methods (unqualified name) |
| i_cppGetter | C++ method name of getter (also used as Python property name) |
| i_cppSetter | C++ method name of setter |
Definition at line 9832 of file pyobject_macros.h.
| #define PY_CLASS_MEMBER_R_EX | ( | t_cppClass, | |
| i_cppGetter, | |||
| s_memberName, | |||
| s_doc, | |||
| i_dispatcher ) |
Export a getter as a read-only Python property, with full control.
This is the most flexible read-only member export macro, allowing manual dispatcher naming.
Here you can use a fully qualified class name, at the cost of having to provide a unique suffix.
Exports a C++ getter method as a Python read-only property (no setter provided).
| t_cppClass | C++ class containing the getter method |
| i_cppGetter | C++ method name of getter |
| s_memberName | Python property name (null-terminated C string literal) |
| s_doc | Property documentation string (null-terminated C string literal, may be nullptr) |
| i_dispatcher | Unique identifier for the generated dispatcher function |
Definition at line 9857 of file pyobject_macros.h.
| #define PY_CLASS_MEMBER_R_NAME_DOC | ( | i_cppClass, | |
| i_cppGetter, | |||
| s_memberName, | |||
| s_doc ) |
Export a getter as a read-only Python property, with custom name and docstring.
Wraps PY_CLASS_MEMBER_R_EX() with auto-generated dispatcher name.
| i_cppClass | C++ class containing the getter method (unqualified name) |
| i_cppGetter | C++ method name of getter |
| s_memberName | Python property name (null-terminated C string literal) |
| s_doc | Property documentation string (null-terminated C string literal, may be nullptr) |
Definition at line 9901 of file pyobject_macros.h.
| #define PY_CLASS_MEMBER_R_NAME | ( | i_cppClass, | |
| i_cppGetter, | |||
| s_memberName ) |
Export a getter as a read-only Python property, with custom Python name.
Wraps PY_CLASS_MEMBER_R_NAME_DOC() with s_doc = nullptr.
| i_cppClass | C++ class containing the getter method (unqualified name) |
| i_cppGetter | C++ method name of getter |
| s_memberName | Python property name (null-terminated C string literal) |
Definition at line 9919 of file pyobject_macros.h.
| #define PY_CLASS_MEMBER_R_DOC | ( | i_cppClass, | |
| i_cppGetter, | |||
| s_doc ) |
Export a getter as a read-only Python property, with docstring.
Wraps PY_CLASS_MEMBER_R_NAME_DOC() with s_memberName derived from i_cppGetter.
| i_cppClass | C++ class containing the getter method (unqualified name) |
| i_cppGetter | C++ method name of getter (also used as Python property name) |
| s_doc | Property documentation string (null-terminated C string literal, may be nullptr) |
Definition at line 9936 of file pyobject_macros.h.
| #define PY_CLASS_MEMBER_R | ( | i_cppClass, | |
| i_cppGetter ) |
Export a getter as a read-only Python property.
Wraps PY_CLASS_MEMBER_R_DOC() with method name as property name and no documentation.
| i_cppClass | C++ class containing the getter method (unqualified name) |
| i_cppGetter | C++ method name of getter (also used as Python property name) |
Definition at line 9952 of file pyobject_macros.h.
| #define PY_CLASS_FREE_MEMBER_RW_EX | ( | t_cppClass, | |
| i_cppFreeGetter, | |||
| i_cppFreeSetter, | |||
| s_memberName, | |||
| s_doc, | |||
| i_dispatcher ) |
Export free accessors as a read-write Python property, with full control.
Exports a pair of free functions as read/write Python property. Unlike member method-based macros, this uses standalone functions that take the object as their first parameter.
Here you can use a fully qualified class name, at the cost of having to provide a unique suffix.
| t_cppClass | C++ class to add the property to |
| i_cppFreeGetter | Free getter function |
| i_cppFreeSetter | Free setter function |
| s_memberName | Python property name (null-terminated C string literal) |
| s_doc | Property documentation string (null-terminated C string literal, may be nullptr) |
| i_dispatcher | Unique identifier for the generated dispatcher functions |
Definition at line 10015 of file pyobject_macros.h.
| #define PY_CLASS_FREE_MEMBER_RW_NAME_DOC | ( | i_cppClass, | |
| i_cppFreeGetter, | |||
| i_cppFreeSetter, | |||
| s_memberName, | |||
| s_doc ) |
Export free accessors as a read-write Python property, with custom name and docstring.
Wraps PY_CLASS_FREE_MEMBER_RW_EX() with auto-generated dispatcher name.
| i_cppClass | C++ class to add the property to (unqualified name) |
| i_cppFreeGetter | Free getter function |
| i_cppFreeSetter | Free setter function |
| s_memberName | Python property name (null-terminated C string literal) |
| s_doc | Property documentation string (null-terminated C string literal, may be nullptr) |
Definition at line 10049 of file pyobject_macros.h.
| #define PY_CLASS_FREE_MEMBER_RW_NAME | ( | i_cppClass, | |
| i_cppFreeGetter, | |||
| i_cppFreeSetter, | |||
| s_memberName ) |
Export free accessors as a read-write Python property, with custom Python name.
Wraps PY_CLASS_FREE_MEMBER_RW_NAME_DOC() with no documentation.
| i_cppClass | C++ class to add the property to (unqualified name) |
| i_cppFreeGetter | Free getter function |
| i_cppFreeSetter | Free setter function |
| s_memberName | Python property name (null-terminated C string literal) |
Definition at line 10068 of file pyobject_macros.h.
| #define PY_CLASS_FREE_MEMBER_RW_DOC | ( | i_cppClass, | |
| i_cppFreeGetter, | |||
| i_cppFreeSetter, | |||
| s_doc ) |
Export free accessors as a read-write Python property, with docstring.
Wraps PY_CLASS_FREE_MEMBER_RW_NAME_DOC() with function name as property name.
| i_cppClass | C++ class to add the property to (unqualified name) |
| i_cppFreeGetter | Free getter function (also used as Python property name) |
| i_cppFreeSetter | Free setter function |
| s_doc | Property documentation string (null-terminated C string literal, may be nullptr) |
Definition at line 10086 of file pyobject_macros.h.
| #define PY_CLASS_FREE_MEMBER_RW | ( | i_cppClass, | |
| i_cppFreeGetter, | |||
| i_cppFreeSetter ) |
Export free accessors as a read-write Python property.
Wraps PY_CLASS_FREE_MEMBER_RW_DOC() with function name as property name and no documentation.
| i_cppClass | C++ class to add the property to (unqualified name) |
| i_cppFreeGetter | Free getter function (also used as Python property name) |
| i_cppFreeSetter | Free setter function |
Definition at line 10103 of file pyobject_macros.h.
| #define PY_CLASS_FREE_MEMBER_R_EX | ( | t_cppClass, | |
| i_cppFreeGetter, | |||
| s_memberName, | |||
| s_doc, | |||
| i_dispatcher ) |
Export a free accessor as a read-only Python property, with full control.
Exports a free function as read-only Python property. Unlike member method-based macros, this uses a standalone function that takes the object as its first parameter.
Here you can use a fully qualified class name, at the cost of having to provide a unique suffix.
| t_cppClass | C++ class to add the property to |
| i_cppFreeGetter | Free getter function |
| s_memberName | Python property name (null-terminated C string literal) |
| s_doc | Property documentation string (null-terminated C string literal, may be nullptr) |
| i_dispatcher | Unique identifier for the generated dispatcher functions |
Definition at line 10127 of file pyobject_macros.h.
| #define PY_CLASS_FREE_MEMBER_R_NAME_DOC | ( | i_cppClass, | |
| i_cppFreeGetter, | |||
| s_memberName, | |||
| s_doc ) |
Export a free accessor as a read-only Python property, with custom name and docstring.
Wraps PY_CLASS_FREE_MEMBER_R_EX() with auto-generated dispatcher name.
| i_cppClass | C++ class to add the property to (unqualified name) |
| i_cppFreeGetter | Free getter function |
| s_memberName | Python property name (null-terminated C string literal) |
| s_doc | Property documentation string (null-terminated C string literal, may be nullptr) |
Definition at line 10155 of file pyobject_macros.h.
| #define PY_CLASS_FREE_MEMBER_R_NAME | ( | i_cppClass, | |
| i_cppFreeGetter, | |||
| s_memberName ) |
Export a free accessor as a read-only Python property, with custom Python name.
Wraps PY_CLASS_FREE_MEMBER_R_NAME_DOC() with no documentation.
| i_cppClass | C++ class to add the property to (unqualified name) |
| i_cppFreeGetter | Free getter function |
| s_memberName | Python property name (null-terminated C string literal) |
Definition at line 10173 of file pyobject_macros.h.
| #define PY_CLASS_FREE_MEMBER_R_DOC | ( | i_cppClass, | |
| i_cppFreeGetter, | |||
| s_doc ) |
Export a free accessor as a read-only Python property, with docstring.
Wraps PY_CLASS_FREE_MEMBER_R_NAME_DOC() with function name as property name.
| i_cppClass | C++ class to add the property to (unqualified name) |
| i_cppFreeGetter | Free getter function (also used as Python property name) |
| s_doc | Property documentation string (null-terminated C string literal, may be nullptr) |
Definition at line 10190 of file pyobject_macros.h.
| #define PY_CLASS_FREE_MEMBER_R | ( | i_cppClass, | |
| i_cppFreeGetter ) |
Export a free accessor as a read-only Python property.
Wraps PY_CLASS_FREE_MEMBER_R_DOC() with function name as property name and no documentation.
| i_cppClass | C++ class to add the property to (unqualified name) |
| i_cppFreeGetter | Free getter function (also used as Python property name) |
Definition at line 10206 of file pyobject_macros.h.
| #define PY_CLASS_PUBLIC_MEMBER_EX | ( | t_cppClass, | |
| i_cppMember, | |||
| s_memberName, | |||
| s_doc, | |||
| i_dispatcher ) |
Export a public member as a read-write Python property, with full control.
Exports a public data member directly as a Python property, allowing both read and write access. This provides direct access to the C++ member variable without requiring getter/setter methods.
Here you can use a fully qualified class name, at the cost of having to provide a unique suffix.
| t_cppClass | C++ class containing the public member |
| i_cppMember | C++ public data member name to export |
| s_memberName | Python property name (null-terminated C string literal) |
| s_doc | Property documentation string (null-terminated C string literal, may be nullptr) |
| i_dispatcher | Unique identifier for the generated dispatcher functions |
Definition at line 10259 of file pyobject_macros.h.
| #define PY_CLASS_PUBLIC_MEMBER_NAME_DOC | ( | i_cppClass, | |
| i_cppMember, | |||
| s_memberName, | |||
| s_doc ) |
Export a public member as a read-write Python property, with custom name and docstring.
Wraps PY_CLASS_PUBLIC_MEMBER_EX() with auto-generated dispatcher name.
| i_cppClass | C++ class containing the public member (unqualified name) |
| i_cppMember | C++ public data member name to export |
| s_memberName | Python property name (null-terminated C string literal) |
| s_doc | Property documentation string (null-terminated C string literal, may be nullptr) |
Definition at line 10302 of file pyobject_macros.h.
| #define PY_CLASS_PUBLIC_MEMBER_NAME | ( | i_cppClass, | |
| i_cppMember, | |||
| s_memberName ) |
Export a public member as a read-write Python property, with custom Python name.
Wraps PY_CLASS_PUBLIC_MEMBER_NAME_DOC() with no documentation.
| i_cppClass | C++ class containing the public member (unqualified name) |
| i_cppMember | C++ public data member name to export |
| s_memberName | Python property name (null-terminated C string literal) |
Definition at line 10320 of file pyobject_macros.h.
| #define PY_CLASS_PUBLIC_MEMBER_DOC | ( | i_cppClass, | |
| i_cppMember, | |||
| s_doc ) |
Export a public member as a read-write Python property, with docstring.
Wraps PY_CLASS_PUBLIC_MEMBER_NAME_DOC() with member name as property name.
| i_cppClass | C++ class containing the public member (unqualified name) |
| i_cppMember | C++ public data member name to export (also used as Python property name) |
| s_doc | Property documentation string (null-terminated C string literal, may be nullptr) |
Definition at line 10337 of file pyobject_macros.h.
| #define PY_CLASS_PUBLIC_MEMBER | ( | i_cppClass, | |
| i_cppMember ) |
Export a public member as a read-write Python property.
Wraps PY_CLASS_PUBLIC_MEMBER_NAME_DOC() with member name as property name and no documentation.
| i_cppClass | C++ class containing the public member (unqualified name) |
| i_cppMember | C++ public data member name to export (also used as Python property name) |
Definition at line 10353 of file pyobject_macros.h.
| #define PY_CLASS_PUBLIC_MEMBER_R_EX | ( | t_cppClass, | |
| i_cppMember, | |||
| s_memberName, | |||
| s_doc, | |||
| i_dispatcher ) |
Export a public member as a read-only Python property, with full control.
Exports a public data member directly as a read-only Python property, allowing only read access. This provides direct read access to the C++ member variable without requiring a getter method. Useful for const members or when write access should be restricted.
Here you can use a fully qualified class name, at the cost of having to provide a unique suffix.
| t_cppClass | C++ class containing the public member |
| i_cppMember | C++ public data member name to export |
| s_memberName | Python property name (null-terminated C string literal) |
| s_doc | Property documentation string (null-terminated C string literal, may be nullptr) |
| i_dispatcher | Unique identifier for the generated dispatcher functions |
Definition at line 10379 of file pyobject_macros.h.
| #define PY_CLASS_PUBLIC_MEMBER_R_NAME_DOC | ( | i_cppClass, | |
| i_cppMember, | |||
| s_memberName, | |||
| s_doc ) |
Export a public member as a read-only Python property, with custom name and docstring.
Wraps PY_CLASS_PUBLIC_MEMBER_R_EX() with auto-generated dispatcher name.
| i_cppClass | C++ class containing the public member (unqualified name) |
| i_cppMember | C++ public data member name to export |
| s_memberName | Python property name (null-terminated C string literal) |
| s_doc | Property documentation string (null-terminated C string literal, may be nullptr) |
Definition at line 10412 of file pyobject_macros.h.
| #define PY_CLASS_PUBLIC_MEMBER_R_NAME | ( | i_cppClass, | |
| i_cppMember, | |||
| s_memberName ) |
Export a public member as a read-only Python property, with custom Python name.
Wraps PY_CLASS_PUBLIC_MEMBER_R_NAME_DOC() with no documentation.
| i_cppClass | C++ class containing the public member (unqualified name) |
| i_cppMember | C++ public data member name to export |
| s_memberName | Python property name (null-terminated C string literal) |
Definition at line 10430 of file pyobject_macros.h.
| #define PY_CLASS_PUBLIC_MEMBER_R_DOC | ( | i_cppClass, | |
| i_cppMember, | |||
| s_doc ) |
Export a public member as a read-only Python property, with docstring.
Wraps PY_CLASS_PUBLIC_MEMBER_R_NAME_DOC() with member name as property name.
| i_cppClass | C++ class containing the public member (unqualified name) |
| i_cppMember | C++ public data member name to export (also used as Python property name) |
| s_doc | Property documentation string (null-terminated C string literal, may be nullptr) |
Definition at line 10447 of file pyobject_macros.h.
| #define PY_CLASS_PUBLIC_MEMBER_R | ( | i_cppClass, | |
| i_cppMember ) |
Export a public member as a read-only Python property.
Wraps PY_CLASS_PUBLIC_MEMBER_R_NAME_DOC() with member name as property name and no documentation.
| i_cppClass | C++ class containing the public member (unqualified name) |
| i_cppMember | C++ public data member name to export (also used as Python property name) |
Definition at line 10463 of file pyobject_macros.h.