From 723b42e0dabae5b79628c654dd17b09be40d83a0 Mon Sep 17 00:00:00 2001 From: Marek Smigielski Date: Fri, 5 Aug 2016 15:34:57 +0200 Subject: [PATCH] Add namespaces and proper support of the pointers --- modules/java/generator/gen_java.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/java/generator/gen_java.py b/modules/java/generator/gen_java.py index f8d3f7d0a5..f5e7aef94b 100755 --- a/modules/java/generator/gen_java.py +++ b/modules/java/generator/gen_java.py @@ -795,7 +795,7 @@ class ClassInfo(GeneralInfo): self.base = re.sub(r"^.*:", "", decl[1].split(",")[0]).strip().replace(self.jname, "") def __repr__(self): - return Template("CLASS $namespace.$classpath.$name : $base").substitute(**self.__dict__) + return Template("CLASS $namespace::$classpath.$name : $base").substitute(**self.__dict__) def getAllImports(self, module): return ["import %s;" % c for c in sorted(self.imports) if not c.startswith('org.opencv.'+module)] @@ -1406,6 +1406,8 @@ class JavaWrapperGenerator(object): clazz = ci.jname cpp_code.write ( Template( \ """ +${namespace} + JNIEXPORT $rtype JNICALL Java_org_opencv_${module}_${clazz}_$fname ($argst); JNIEXPORT $rtype JNICALL Java_org_opencv_${module}_${clazz}_$fname @@ -1440,6 +1442,7 @@ JNIEXPORT $rtype JNICALL Java_org_opencv_${module}_${clazz}_$fname cvargs = ", ".join(cvargs), \ default = default, \ retval = retval, \ + namespace = ('using namespace ' + ci.namespace.replace('.', '::') + ';') if ci.namespace else '' ) ) # processing args with default values @@ -1535,7 +1538,7 @@ JNIEXPORT void JNICALL Java_org_opencv_%(module)s_%(j_cls)s_delete ''' Check if class stores Ptr* instead of T* in nativeObj field ''' - return self.isWrapped(classname) and self.classes[classname].base + return False def smartWrap(self, name, fullname): '''