|
|
|
@ -236,6 +236,11 @@ class ArgInfo(object): |
|
|
|
|
self.tp = "std::vector<cv::Mat>&" |
|
|
|
|
elif self.inputarg: |
|
|
|
|
self.tp = "const std::vector<cv::Mat>&" |
|
|
|
|
if self.tp == "vector_string": |
|
|
|
|
if self.outputarg: |
|
|
|
|
self.tp = "std::vector<std::string>&" |
|
|
|
|
elif self.inputarg: |
|
|
|
|
self.tp = "const std::vector<std::string>&" |
|
|
|
|
self.tp = handle_vector(self.tp).strip() |
|
|
|
|
if self.const: |
|
|
|
|
self.tp = "const " + self.tp |
|
|
|
@ -319,19 +324,31 @@ class JSWrapperGenerator(object): |
|
|
|
|
sys.exit(-1) |
|
|
|
|
self.classes[class_info.name] = class_info |
|
|
|
|
|
|
|
|
|
if class_info.bases: |
|
|
|
|
chunks = class_info.bases[0].split('::') |
|
|
|
|
base = '_'.join(chunks) |
|
|
|
|
while base not in self.classes and len(chunks) > 1: |
|
|
|
|
del chunks[-2] |
|
|
|
|
def resolve_class_inheritance(self): |
|
|
|
|
new_classes = {} |
|
|
|
|
for name, class_info in self.classes.items(): |
|
|
|
|
|
|
|
|
|
if not hasattr(class_info, 'bases'): |
|
|
|
|
new_classes[name] = class_info |
|
|
|
|
continue # not class |
|
|
|
|
|
|
|
|
|
if class_info.bases: |
|
|
|
|
chunks = class_info.bases[0].split('::') |
|
|
|
|
base = '_'.join(chunks) |
|
|
|
|
if base not in self.classes: |
|
|
|
|
print("Generator error: unable to resolve base %s for %s" |
|
|
|
|
% (class_info.bases[0], class_info.name)) |
|
|
|
|
sys.exit(-1) |
|
|
|
|
else: |
|
|
|
|
class_info.bases[0] = "::".join(chunks) |
|
|
|
|
class_info.isalgorithm |= self.classes[base].isalgorithm |
|
|
|
|
while base not in self.classes and len(chunks) > 1: |
|
|
|
|
del chunks[-2] |
|
|
|
|
base = '_'.join(chunks) |
|
|
|
|
if base not in self.classes: |
|
|
|
|
print("Generator error: unable to resolve base %s for %s" |
|
|
|
|
% (class_info.bases[0], class_info.name)) |
|
|
|
|
sys.exit(-1) |
|
|
|
|
else: |
|
|
|
|
class_info.bases[0] = "::".join(chunks) |
|
|
|
|
class_info.isalgorithm |= self.classes[base].isalgorithm |
|
|
|
|
|
|
|
|
|
new_classes[name] = class_info |
|
|
|
|
|
|
|
|
|
self.classes = new_classes |
|
|
|
|
|
|
|
|
|
def split_decl_name(self, name): |
|
|
|
|
chunks = name.split('.') |
|
|
|
@ -759,6 +776,8 @@ class JSWrapperGenerator(object): |
|
|
|
|
else: # class/global function |
|
|
|
|
self.add_func(decl) |
|
|
|
|
|
|
|
|
|
self.resolve_class_inheritance() |
|
|
|
|
|
|
|
|
|
# step 2: generate bindings |
|
|
|
|
# Global functions |
|
|
|
|
for ns_name, ns in sorted(self.namespaces.items()): |
|
|
|
|