1 """Class method and static method instantiators."""
3 from typing
import Iterable
7 instantiate_return_type)
12 Instantiate method with template parameters.
21 original: parser.Method,
22 instantiations: Iterable[parser.Typename] = ()):
31 self.
args = original.args
41 def construct(cls, original, typenames, class_instantiations,
42 method_instantiations, instantiated_args, parent):
43 """Class method to construct object as required by InstantiationHelper."""
44 method = parser.Method(
45 template=original.template,
48 original.return_type, typenames,
49 class_instantiations + method_instantiations,
50 parent.cpp_typename()),
51 args=parser.ArgumentList(instantiated_args),
52 is_const=original.is_const,
58 """Generate the C++ code for wrapping."""
64 ",".join(instantiation_list))
75 Instantiate static method with template parameters.
78 original: parser.StaticMethod,
79 instantiations: Iterable[parser.Typename] = ()):
87 self.
parent = original.parent
93 def construct(cls, original, typenames, class_instantiations,
94 method_instantiations, instantiated_args, parent):
95 """Class method to construct object as required by InstantiationHelper."""
96 method = parser.StaticMethod(
100 class_instantiations +
101 method_instantiations,
102 parent.cpp_typename(),
103 instantiated_class=parent),
104 args=parser.ArgumentList(instantiated_args),
105 template=original.template,
109 instantiations=method_instantiations)
112 """Generate the C++ code for wrapping."""
118 ",".join(instantiation_list))