|
|
|
@ -992,6 +992,11 @@ class DefinitionParser(object): |
|
|
|
|
return rv |
|
|
|
|
|
|
|
|
|
def _parse_signature(self): |
|
|
|
|
if r'CvStatModel::train' in self.definition: |
|
|
|
|
# hack to skip parsing of problematic definition |
|
|
|
|
self.pos = self.end |
|
|
|
|
return [ArgumentDefExpr("const Mat&", "train_data", None), ArgumentDefExpr(None, self.definition[self.definition.find("["):-1], None)], False, True |
|
|
|
|
|
|
|
|
|
self.skip_ws() |
|
|
|
|
if not self.skip_string('('): |
|
|
|
|
self.fail('expected parentheses for function') |
|
|
|
@ -1075,6 +1080,17 @@ class DefinitionParser(object): |
|
|
|
|
value = None |
|
|
|
|
return MemberObjDefExpr(name, visibility, static, typename, value) |
|
|
|
|
|
|
|
|
|
def parse_enum_member_object(self): |
|
|
|
|
visibility, static = self._parse_visibility_static() |
|
|
|
|
typename = None |
|
|
|
|
name = self._parse_type() |
|
|
|
|
self.skip_ws() |
|
|
|
|
if self.skip_string('='): |
|
|
|
|
value = self.read_rest().strip() |
|
|
|
|
else: |
|
|
|
|
value = None |
|
|
|
|
return MemberObjDefExpr(name, visibility, static, typename, value) |
|
|
|
|
|
|
|
|
|
def parse_function(self): |
|
|
|
|
visibility, static = self._parse_visibility_static() |
|
|
|
|
if self.skip_word('explicit'): |
|
|
|
@ -1180,6 +1196,8 @@ class OCVObject(ObjectDescription): |
|
|
|
|
def add_target_and_index(self, sigobj, sig, signode): |
|
|
|
|
theid = sig#obj.get_id() |
|
|
|
|
theid = re.sub(r" +", " ", theid) |
|
|
|
|
if self.objtype == 'emember': |
|
|
|
|
theid = re.sub(r" ?=.*", "", theid) |
|
|
|
|
theid = re.sub(r"=[^,()]+\([^)]*?\)[^,)]*(,|\))", "\\1", theid) |
|
|
|
|
theid = re.sub(r"=\w*[^,)(]+(,|\))", "\\1", theid) |
|
|
|
|
theid = theid.replace("( ", "(").replace(" )", ")") |
|
|
|
@ -1293,6 +1311,25 @@ class OCVTypeObject(OCVObject): |
|
|
|
|
signode += nodes.Text(' ') |
|
|
|
|
self.attach_name(signode, obj.name) |
|
|
|
|
|
|
|
|
|
class OCVEnumObject(OCVObject): |
|
|
|
|
|
|
|
|
|
def get_index_text(self, name): |
|
|
|
|
if self.objtype == 'enum': |
|
|
|
|
return _('%s (enum)') % name |
|
|
|
|
return '' |
|
|
|
|
|
|
|
|
|
def parse_definition(self, parser): |
|
|
|
|
return parser.parse_type_object() |
|
|
|
|
|
|
|
|
|
def describe_signature(self, signode, obj): |
|
|
|
|
self.attach_modifiers(signode, obj) |
|
|
|
|
signode += addnodes.desc_annotation('enum ', 'enum ') |
|
|
|
|
if obj.typename is not None: |
|
|
|
|
self.attach_type(signode, obj.typename) |
|
|
|
|
signode += nodes.Text(' ') |
|
|
|
|
self.attach_name(signode, obj.name) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class OCVMemberObject(OCVObject): |
|
|
|
|
ismember = True |
|
|
|
|
|
|
|
|
@ -1309,12 +1346,20 @@ class OCVMemberObject(OCVObject): |
|
|
|
|
|
|
|
|
|
def describe_signature(self, signode, obj): |
|
|
|
|
self.attach_modifiers(signode, obj) |
|
|
|
|
self.attach_type(signode, obj.typename) |
|
|
|
|
signode += nodes.Text(' ') |
|
|
|
|
if obj.typename: |
|
|
|
|
self.attach_type(signode, obj.typename) |
|
|
|
|
signode += nodes.Text(' ') |
|
|
|
|
self.attach_name(signode, obj.name) |
|
|
|
|
if obj.value is not None: |
|
|
|
|
signode += nodes.Text(u' = ' + obj.value) |
|
|
|
|
|
|
|
|
|
class OCVEnumMemberObject(OCVMemberObject): |
|
|
|
|
def parse_definition(self, parser): |
|
|
|
|
# parent_class = self.env.temp_data.get('ocv:parent') |
|
|
|
|
# if parent_class is None: |
|
|
|
|
# parser.fail("missing parent structure/class") |
|
|
|
|
return parser.parse_enum_member_object() |
|
|
|
|
|
|
|
|
|
class OCVFunctionObject(OCVObject): |
|
|
|
|
|
|
|
|
|
def attach_function(self, node, func): |
|
|
|
@ -1448,7 +1493,9 @@ class OCVDomain(Domain): |
|
|
|
|
'pyfunction': ObjType(l_('pyfunction'), 'pyfunc'), |
|
|
|
|
'pyoldfunction': ObjType(l_('pyoldfunction'), 'pyoldfunc'), |
|
|
|
|
'member': ObjType(l_('member'), 'member'), |
|
|
|
|
'type': ObjType(l_('type'), 'type') |
|
|
|
|
'emember': ObjType(l_('emember'), 'emember'), |
|
|
|
|
'type': ObjType(l_('type'), 'type'), |
|
|
|
|
'enum': ObjType(l_('enum'), 'enum') |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
directives = { |
|
|
|
@ -1460,7 +1507,9 @@ class OCVDomain(Domain): |
|
|
|
|
'pyfunction': OCVPyModulelevel, |
|
|
|
|
'pyoldfunction': OCVPyOldModulelevel, |
|
|
|
|
'member': OCVMemberObject, |
|
|
|
|
'emember': OCVEnumMemberObject, |
|
|
|
|
'type': OCVTypeObject, |
|
|
|
|
'enum': OCVEnumObject, |
|
|
|
|
'namespace': OCVCurrentNamespace |
|
|
|
|
} |
|
|
|
|
roles = { |
|
|
|
@ -1475,7 +1524,9 @@ class OCVDomain(Domain): |
|
|
|
|
'pyfunc' : OCVPyXRefRole(), |
|
|
|
|
'pyoldfunc' : OCVPyXRefRole(), |
|
|
|
|
'member': OCVXRefRole(), |
|
|
|
|
'type': OCVXRefRole() |
|
|
|
|
'emember': OCVXRefRole(), |
|
|
|
|
'type': OCVXRefRole(), |
|
|
|
|
'enum': OCVXRefRole() |
|
|
|
|
} |
|
|
|
|
initial_data = { |
|
|
|
|
'objects': {}, # fullname -> docname, objtype |
|
|
|
@ -1563,7 +1614,9 @@ class OCVDomain(Domain): |
|
|
|
|
'pyfunction': _('Python function'), |
|
|
|
|
'pyoldfunction': _('Legacy Python function'), |
|
|
|
|
'member': _('C++ member'), |
|
|
|
|
'emember': _('enum member'), |
|
|
|
|
'type': _('C/C++ type'), |
|
|
|
|
'enum': _('C/C++ enum'), |
|
|
|
|
'namespace': _('C++ namespace'), |
|
|
|
|
}.get(type.lname, _('%s %s') % (self.label, type.lname)) |
|
|
|
|
|
|
|
|
|