mirror of
https://github.com/opencv/opencv.git
synced 2024-11-27 20:50:25 +08:00
Merge pull request #9698 from abratchik:parse.doxygen
Support @deprecated tag in java wrappers (#9698)
This commit is contained in:
parent
65061948af
commit
0608227e10
@ -9,7 +9,6 @@ import org.opencv.core.Scalar;
|
||||
import org.opencv.core.Size;
|
||||
import org.opencv.dnn.DictValue;
|
||||
import org.opencv.dnn.Dnn;
|
||||
import org.opencv.dnn.Importer;
|
||||
import org.opencv.dnn.Layer;
|
||||
import org.opencv.dnn.Net;
|
||||
import org.opencv.imgcodecs.Imgcodecs;
|
||||
|
@ -12,6 +12,9 @@
|
||||
namespace cv
|
||||
{
|
||||
|
||||
/**
|
||||
* @deprecated Please use direct instantiation of Feature2D classes
|
||||
*/
|
||||
class CV_EXPORTS_AS(FeatureDetector) javaFeatureDetector
|
||||
{
|
||||
public:
|
||||
@ -87,8 +90,11 @@ public:
|
||||
DYNAMIC_AKAZE = DYNAMICDETECTOR + AKAZE
|
||||
};
|
||||
|
||||
//supported: FAST STAR SIFT SURF ORB MSER GFTT HARRIS BRISK AKAZE Grid(XXXX) Pyramid(XXXX) Dynamic(XXXX)
|
||||
//not supported: SimpleBlob, Dense
|
||||
/**
|
||||
* supported: FAST STAR SIFT SURF ORB MSER GFTT HARRIS BRISK AKAZE Grid(XXXX) Pyramid(XXXX) Dynamic(XXXX)
|
||||
* not supported: SimpleBlob, Dense
|
||||
* @deprecated
|
||||
*/
|
||||
CV_WRAP static Ptr<javaFeatureDetector> create( int detectorType )
|
||||
{
|
||||
//String name;
|
||||
@ -179,6 +185,9 @@ private:
|
||||
Ptr<FeatureDetector> wrapped;
|
||||
};
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
class CV_EXPORTS_AS(DescriptorExtractor) javaDescriptorExtractor
|
||||
{
|
||||
public:
|
||||
|
@ -91,8 +91,8 @@ package org.opencv.$module;
|
||||
|
||||
$imports
|
||||
|
||||
// C++: class $name
|
||||
//javadoc: $name
|
||||
$docs
|
||||
$annotation
|
||||
public class $jname extends $base {
|
||||
|
||||
protected $jname(long addr) { super(addr); }
|
||||
@ -107,8 +107,8 @@ package org.opencv.$module;
|
||||
|
||||
$imports
|
||||
|
||||
// C++: class $name
|
||||
//javadoc: $name
|
||||
$docs
|
||||
$annotation
|
||||
public class $jname {
|
||||
|
||||
protected final long nativeObj;
|
||||
@ -125,6 +125,8 @@ package org.opencv.$module;
|
||||
|
||||
$imports
|
||||
|
||||
$docs
|
||||
$annotation
|
||||
public class $jname {
|
||||
"""
|
||||
|
||||
@ -182,8 +184,22 @@ $code
|
||||
"""
|
||||
|
||||
class GeneralInfo():
|
||||
def __init__(self, name, namespaces):
|
||||
self.namespace, self.classpath, self.classname, self.name = self.parseName(name, namespaces)
|
||||
def __init__(self, type, decl, namespaces):
|
||||
self.namespace, self.classpath, self.classname, self.name = self.parseName(decl[0], namespaces)
|
||||
|
||||
# parse doxygen comments
|
||||
self.params={}
|
||||
self.annotation=[]
|
||||
if type == "class":
|
||||
docstring="// C++: class " + self.name + "\n//javadoc: " + self.name
|
||||
else:
|
||||
docstring=""
|
||||
if len(decl)>5 and decl[5]:
|
||||
logging.info('docstring: %s', decl[5])
|
||||
if re.search("(@|\\\\)deprecated", decl[5]):
|
||||
self.annotation.append("@Deprecated")
|
||||
|
||||
self.docstring = docstring
|
||||
|
||||
def parseName(self, name, namespaces):
|
||||
'''
|
||||
@ -218,7 +234,7 @@ class GeneralInfo():
|
||||
|
||||
class ConstInfo(GeneralInfo):
|
||||
def __init__(self, decl, addedManually=False, namespaces=[]):
|
||||
GeneralInfo.__init__(self, decl[0], namespaces)
|
||||
GeneralInfo.__init__(self, "const", decl, namespaces)
|
||||
self.cname = self.name.replace(".", "::")
|
||||
self.value = decl[1]
|
||||
self.addedManually = addedManually
|
||||
@ -245,7 +261,7 @@ class ClassPropInfo():
|
||||
|
||||
class ClassInfo(GeneralInfo):
|
||||
def __init__(self, decl, namespaces=[]): # [ 'class/struct cname', ': base', [modlist] ]
|
||||
GeneralInfo.__init__(self, decl[0], namespaces)
|
||||
GeneralInfo.__init__(self, "class", decl, namespaces)
|
||||
self.cname = self.name.replace(".", "::")
|
||||
self.methods = []
|
||||
self.methods_suffixes = {}
|
||||
@ -335,6 +351,8 @@ class ClassInfo(GeneralInfo):
|
||||
name = self.name,
|
||||
jname = self.jname,
|
||||
imports = "\n".join(self.getAllImports(M)),
|
||||
docs = self.docstring,
|
||||
annotation = "\n".join(self.annotation),
|
||||
base = self.base)
|
||||
|
||||
def generateCppCode(self):
|
||||
@ -364,7 +382,7 @@ class ArgInfo():
|
||||
|
||||
class FuncInfo(GeneralInfo):
|
||||
def __init__(self, decl, namespaces=[]): # [ funcname, return_ctype, [modifiers], [args] ]
|
||||
GeneralInfo.__init__(self, decl[0], namespaces)
|
||||
GeneralInfo.__init__(self, "func", decl, namespaces)
|
||||
self.cname = self.name.replace(".", "::")
|
||||
self.jname = self.name
|
||||
self.isconstructor = self.name == self.classname
|
||||
@ -741,6 +759,13 @@ class JavaWrapperGenerator(object):
|
||||
java_doc = "//javadoc: " + f_name + "(%s)" % ", ".join([a.name for a in args if a.ctype])
|
||||
j_code.write(" "*4 + java_doc + "\n")
|
||||
|
||||
if fi.docstring:
|
||||
lines = StringIO(fi.docstring)
|
||||
for line in lines:
|
||||
j_code.write(" "*4 + line + "\n")
|
||||
if fi.annotation:
|
||||
j_code.write(" "*4 + "\n".join(fi.annotation) + "\n")
|
||||
|
||||
# public java wrapper method impl (calling native one above)
|
||||
# e.g.
|
||||
# public static void add( Mat src1, Mat src2, Mat dst, Mat mask, int dtype )
|
||||
|
Loading…
Reference in New Issue
Block a user