Using annotations in the C++ sources

clair’s behaviour can be modified by simple annotations to functions or classes directly in the C++ source code. These macros are simple aliases for C++ annotations, which are ignored by the C++ compiler, but picked up by clair during its analysis.

Annotation

Description

C2PY_IGNORE

Ignore the function/class.

Example

C2PY_RENAME(new_name_in_python)

Rename the function/class. Overrules the default name deduction.

Example

C2PY_WRAP_AS_METHOD

Transform a function into a method to the first argument’s class.

Example

C2PY_MODULE_INIT

Mark a function to be called when the module is imported.

Example

C2PY_PROPERTY_GET(name)

Expose a no-argument, non-void method as the getter of the Python property name.

C2PY_PROPERTY_SET(name)

Expose a method as the setter of the Python property name.

C2PY_DEPRECATED_PARAMETER_NAME(old:new, ...)

Keep accepting deprecated parameter names, mapping each old name to its current new name.

Note

These annotations overrule any options in the TOML file (Cf Using a TOML configuration file).