| 1 |
|
| 2 |
|
| 3 |
import sys |
| 4 |
|
| 5 |
import pybindgen |
| 6 |
from pybindgen import ReturnValue, Parameter, Module, Function, FileCodeSink |
| 7 |
from pybindgen import CppMethod, CppConstructor, CppClass, Enum |
| 8 |
from pybindgen import cppclass |
| 9 |
|
| 10 |
def my_module_gen(out_file): |
| 11 |
|
| 12 |
mod = Module('e') |
| 13 |
mod.add_include('"e.h"') |
| 14 |
|
| 15 |
E = mod.add_class('E', memory_policy=cppclass.ReferenceCountingMethodsPolicy(decref_method='Unref', incref_method='Ref')) |
| 16 |
if 1: |
| 17 |
E.add_function_as_constructor("E::CreateWithRef", ReturnValue.new("E*", caller_owns_return=True), []) |
| 18 |
else: |
| 19 |
|
| 20 |
E.add_function_as_constructor("E::CreateWithoutRef", ReturnValue.new("E*", caller_owns_return=False), []) |
| 21 |
E.add_method("Do", None, []) |
| 22 |
|
| 23 |
|
| 24 |
mod.generate(FileCodeSink(out_file) ) |
| 25 |
|
| 26 |
if __name__ == '__main__': |
| 27 |
my_module_gen(sys.stdout) |