Code generator configuration classes
pygccxml.declarations package contains classes, which describe C++ declarations. This package contains classes that derive from the pygccxml.declarations classes. The classes in this package allow you to configure the code generator.
Bases: pygccxml.declarations.decl_factory.decl_factory_t
declarations factory class
Contains few unrelated algorithms, which works on code creators tree
creates Python identifier from a string
As input this functions takes valid C++ nameidentifier and replaces all illegal characters.
Illegal characters are introduced by a template instantiation.
find all relevant code creators, which influence on code generated by “me”.
C++ allows to define aliases to namespaces. Py++ allows user to define aliases to the namespace and will take this aliases into account when it generates the code.
Example:
[a b c d e f g]
|
+ [k l m]
|
+ [y x] <-- we are here ( x )
return value is: [y,l,k,d,c,b,a]
class-namespace, introduce few functions, which deals with functions registration order problem: http://www.language-binding.net/pyplusplus/documentation/functions/registration_order.html
contains classes that allow to configure code generation for freemember functions, operators and etc.
Bases: pyplusplus.decl_wrappers.decl_wrapper.decl_wrapper_t
base class, for code generator configuration, for function declaration classes.
Boost.Python configuration macro value.
A function has more than BOOST_PYTHON_MAX_ARITY arguments, will not compile. You should adjust BOOST_PYTHON_MAX_ARITY macro. For more information see: http://mail.python.org/pipermail/c++-sig/2002-June/001554.html
add new function transformation.
transformer_creators - list of transformer creators, which should be applied on the function keywd - keyword arguments for function_transformers.function_transformation_t class initialization
returns True, if function - wrapper is needed
The functionality by this function is incomplete. So please don’t use it in your code.
mark this function as final - user will not be able to override it from Python
Not all functions could be overridden from Python, for example virtual function that returns non const reference to a member variable. Py++ allows you to mark these functions and provide and explanation to the user.
Bases: pygccxml.declarations.calldef.casting_operator_t, pyplusplus.decl_wrappers.calldef_wrapper.calldef_t
defines a set of properties, that will instruct Py++ how to expose the casting operator
Bases: pygccxml.declarations.calldef.constructor_t, pyplusplus.decl_wrappers.calldef_wrapper.calldef_t
defines a set of properties, that will instruct Py++ how to expose the constructor
returns true if the constructor can take part in implicit conversions.
For more information see:
Bases: pygccxml.declarations.calldef.destructor_t, pyplusplus.decl_wrappers.calldef_wrapper.calldef_t
you may ignore this class for he time being.
In future it will contain “body” property, that will allow to insert user code to class-wrapper destructor.
Bases: pygccxml.declarations.calldef.free_function_t, pyplusplus.decl_wrappers.calldef_wrapper.calldef_t
defines a set of properties, that will instruct Py++ how to expose the free function
Bases: pygccxml.declarations.calldef.free_operator_t, pyplusplus.decl_wrappers.calldef_wrapper.calldef_t
defines a set of properties, that will instruct Py++ how to expose the free operator
Bases: pygccxml.declarations.calldef.member_function_t, pyplusplus.decl_wrappers.calldef_wrapper.calldef_t
defines a set of properties, that will instruct Py++ how to expose the member function
Bases: pygccxml.declarations.calldef.member_operator_t, pyplusplus.decl_wrappers.calldef_wrapper.calldef_t
defines a set of properties, that will instruct Py++ how to expose the member operator
helps Py++ to deal with C++ operators
Contains definition of call policies classes
Bases: object
base class for all classes, which generate “call policies” code
Creates code from the call policies class instance. :param function_creator: parent code creator :type function_creator: code_creators.function_t or code_creators.constructor_t
| Parameter: | creation_policy (decl_wrappers.CREATION_POLICY) – indicates whether we this call policy used as template argument or as an instance |
|---|
Bases: pyplusplus.decl_wrappers.call_policies.call_policy_t
base class for all call policies, except the default one
Bases: pyplusplus.decl_wrappers.call_policies.compound_policy_t
implements code generation for Py++ defined “as_tuple” value policy
For complete documentation and usage example see “Call policies” document.
Bases: pyplusplus.decl_wrappers.call_policies.call_policy_t
implements code generation for user defined call policies
Bases: pyplusplus.decl_wrappers.call_policies.call_policy_t
implements code generation for boost::python::default_call_policies
implements code generation for Py++ defined memory managers
For complete documentation and usage example see “Call policies” document.
Bases: pyplusplus.decl_wrappers.call_policies.compound_policy_t
implements code generation for boost::python::return_argument call policies
Bases: pyplusplus.decl_wrappers.call_policies.compound_policy_t
implements code generation for boost::python::return_internal_reference call policies
Bases: pyplusplus.decl_wrappers.call_policies.call_policy_t
implements code generation for Py++ defined “return_range” call policies
For complete documentation and usage example see “Call policies” document.
Bases: pyplusplus.decl_wrappers.call_policies.compound_policy_t
implements code generation for boost::python::return_value_policy call policies
Bases: pyplusplus.decl_wrappers.call_policies.with_custodian_and_ward_t
implements code generation for boost::python::with_custodian_and_ward_postcall call policies
Bases: pyplusplus.decl_wrappers.call_policies.compound_policy_t
implements code generation for boost::python::with_custodian_and_ward call policies
defines class that configure class definition and class declaration exposing
Bases: object
defines pygccxml.declarations.class_declaration_t and pygccxml.declarations.class_t classes common properties
reference to indexing suite configuration class.
If the class is not STD container, this property will contain None”
Bases: pyplusplus.decl_wrappers.class_wrapper.class_common_details_t, pyplusplus.decl_wrappers.scopedef_wrapper.scopedef_t, pygccxml.declarations.class_declaration.class_t
adds the code to the class registration section
| Parameters: |
|
|---|
f - reference to a calldef_t object or list of them
boost::python::make_constructor allows to register a C++ function, as a class constructor.
adds new property to the class
| Parameters: |
|
|---|
adds the code to the class registration section
| Parameters: |
|
|---|
exception argument name for translate exception function
If you don’t understand what this argument is, please take a look on Boost.Python documentation: http://www.boost.org/libs/python/doc/v2/exception_translator.html
returns True, if during exposing this class, new scope will be created
For example, anonymous structs will be exposed in a parent scope.
returns an explanation( list of str ) why wrapper is needed.
If wrapper is not needed than [] will be returned.
returns list of member functions that should be defined in the class wrapper
It comes useful in 3 tier hierarchy:
struct base{
virtual void do_nothing() = 0;
};
struct derived{
virtual void do_something() = 0;
};
struct concrete{
virtual void do_nothing(){}
virtual void do_something(){}
};
The wrapper for class derived, should define do_nothing function, otherwise the generated code will not compile
registers exception translation to string
| Parameters: |
|
|---|
defines base class for all code generator configuration classes
Bases: object
code generator declaration configuration base class
This class contains configuration that could be applied to all declarations.
disable messages - Py++ will not report the disabled messages Usage example:
decl.disable_messages( messages.W1001, messages.W1040 )
disable messages - Py++ will not report the disabled messages Usage example:
decl.disable_messages( messages.W1001, messages.W1040 )
exclude “self” and child declarations from being exposed.
If compile_time_errors is True, than only declarations, which will cause compilation error will be excluded
Code generators: ctypes, Boost.Python
include “self” and child declarations to be exposed.
Code generators: ctypes, Boost.Python.
return important information( hints/tips/warning message ) Py++ has about this declaration.
skip_ignored argument allows you to control the information reported to you. For more information please read: http://www.language-binding.net/pyplusplus/documentation/warnings.html
give new name to the declaration, under which Python will know the declaration
Code generators: ctypes, Boost.Python
change “exportable” status
This function should be use in case Py++ made a mistake and signed the declaration as non-exportable.
return the reason( string ) that explains why this declaration could not be exported
If declaration could be exported, than method will return None
defines class that will print in a user friendly format declarations tree and declarations Py++ configuration instructions
Bases: pygccxml.declarations.decl_printer.decl_printer_t
Helper class for printing declarations tree and Py++ configuration instructions
print declarations tree
| Parameter: | decls – could be single pygccxml.declarations.declaration_t object or list of them |
|---|
defines documentation extractor class interface
Bases: object
defines documentation extractor interface
returns documentation text for the declaration
This function should be implemented in derived class.
Using decl.location.file_name and decl.location.line variables you can find out the location of declaration within source file
defines class that configure enumeration declaration exposing
Bases: pyplusplus.decl_wrappers.decl_wrapper.decl_wrapper_t, pygccxml.declarations.enumeration.enumeration_t
defines a set of properties, that will instruct Py++ how to expose the enumeration
By default, Py++ will export all enumeration values.
defines interface for exposing STD containers, using current version of indexing suite
Bases: object
This class helps user to export STD containers, using built-in Boost.Python indexing suite.
defines interface for exposing STD containers, using next version of indexing suite
Bases: object
This class helps user to export STD containers, using Boost.Python indexing suite V2.
defines class that configure namespace exposing.
Bases: pyplusplus.decl_wrappers.scopedef_wrapper.scopedef_t, pygccxml.declarations.namespace.namespace_t
defines a set of properties, that will instruct Py++ how to expose the namespace
Today, Py++ does not exposes namespaces, but this could be changed in future. The future direction I see here, is to expose every namespace as sub-module of the main one.
defines property_t helper class
Bases: pyplusplus.decl_wrappers.properties.property_recognizer_i
defines few “type traits” functions related to C++ Python bindings
defines base class for decl_wrappers.class_t and decl_wrappers.namespace_t classes
Bases: pyplusplus.decl_wrappers.decl_wrapper.decl_wrapper_t
base class for decl_wrappers.class_t and decl_wrappers.namespace_t classes
It provides convenience functionality: includeexclude all internal declarations (not) to be exported.
exclude “self” and child declarations from being exposed.
If compile_time_errors is True, than only declarations, which will cause compilation error will be excluded
defines class that configure typedef exposing
Bases: pyplusplus.decl_wrappers.decl_wrapper.decl_wrapper_t, pygccxml.declarations.typedef.typedef_t
defines a set of properties, that will instruct Py++ how to expose the typedef
Today, Py++ does not exposes typedefs, but this could be changed in future. In C++, it is a common practices to give an aliases to the class. May be in future, Py++ will generate code, that will register all those aliases.
defines few classes, used by decl_wrapper.class_t class to keep user code
Bases: pyplusplus.decl_wrappers.user_text.user_text_t
keeps reference to user code that belongs to registration section
works_on_instance: If true, the custom code can be applied directly to obj inst. Ex: ObjInst.”CustomCode”
defines class that configure global and member variable exposing
Bases: pyplusplus.decl_wrappers.decl_wrapper.decl_wrapper_t, pygccxml.declarations.variable.variable_t
defines a set of properties, that will instruct Py++ how to expose the variable
Generate code using make_getter and make_setter functions
Basically you don’t need to use this, untill you have one of the following use-cases:
- member variable is smart pointer - in this case Boost.Python has small problem to expose it right. Using get/set functions is a work-around.
- member variable defined custom r-value converter - may be you don’t know but the conversion is applied only on functions arguments. So you need to use make_getter/make_setter functions, allow users to enjoy from the conversion.
Setting apply_smart_ptr_wa and/or use_make_functions to “True” will tell Py++ to generate such code.
There are some cases when Boost.Python doesn’t provide a convenient way to expose the variable to Python. For example:
double* x[10]; //or char* buffer; //in case you want to modify the buffer in place
In this cases Py++ doesn’t help too. In these cases it is possible to expose the actual address of the variable. After that, you can use built-in “ctypes” package to edit the content of the variable.
Boost.Python is not able to expose unions. Using ctypes module it is possible to get access to the data stored in a variable, which has some union type.
This property controls whether Py++ should expose the variable value or not. In case, this variable has type union, this property will be False.
returns an explanation( list of str ) why wrapper is needed.
If wrapper is not needed than [] will be returned.
Generate code using make_getter and make_setter functions
Basically you don’t need to use this, untill you have one of the following use-cases:
- member variable is smart pointer - in this case Boost.Python has small problem to expose it right. Using get/set functions is a work-around.
- member variable defined custom r-value converter - may be you don’t know but the conversion is applied only on functions arguments. So you need to use make_getter/make_setter functions, allow users to enjoy from the conversion.
Setting apply_smart_ptr_wa and/or use_make_functions to “True” will tell Py++ to generate such code.