signode['ids'].append(fullname)
signode['first'] = (not self.names)
self.state.document.note_explicit_target(signode)
- objects = self.env.domaindata['py']['objects']
+ objects = self.env.domaindata['ocv']['objects']
if fullname in objects:
self.env.warn(
self.env.docname,
self.env.doc2path(objects[fullname][0]) +
', use :noindex: for one of them',
self.lineno)
- objects[fullname] = (self.env.docname, self.objtype)
+ objects.setdefault(fullname, (self.env.docname, self.objtype, name_cls[0]))
indextext = self.get_index_text(modname, name_cls)
if indextext:
u'.'.join(x.get_id() for x in self.signature) or u'',
self.const and u'C' or u''
)
-
+
def __unicode__(self):
buf = self.get_modifiers()
if self.explicit:
node += nodes.Text(' ')
def add_target_and_index(self, sigobj, sig, signode):
- theid = sigobj.get_id()
+ theid = sig#obj.get_id()
+ theid = re.sub(r" +", " ", theid)
+ theid = re.sub(r"=[^,()]+\([^)]*?\)[^,)]*(,|\))", "\\1", theid)
+ theid = re.sub(r"=[^,)]+(,|\))", "\\1", theid)
+ theid = theid.replace("( ", "(").replace(" )", ")")
name = unicode(sigobj.name)
if theid not in self.state.document.ids:
signode['names'].append(theid)
signode['first'] = (not self.names)
self.state.document.note_explicit_target(signode)
- self.env.domaindata['ocv']['objects'].setdefault(name,
+ #self.env.domaindata['ocv']['objects'].setdefault(name,
+ #(self.env.docname, self.objtype, theid))
+ self.env.domaindata['ocv']['objects'].setdefault(theid,
(self.env.docname, self.objtype, theid))
indextext = self.get_index_text(name)
raise DefinitionError('')
except DefinitionError:
refdoc = node.get('refdoc', fromdocname)
- env.warn(refdoc, 'unparseable C++ definition: %r' % target,
+ env.warn(refdoc, 'unparseable1 C++ definition: %r' % target,
node.line)
return None
def get_objects(self):
for refname, (docname, type, theid) in self.data['objects'].iteritems():
yield (refname, refname, type, docname, refname, 1)
-
+
+ def get_type_name(self, type, primary=False):
+ """
+ Return full name for given ObjType.
+ """
+ if primary:
+ return type.lname
+
+ return {
+ 'class': _('C++ class'),
+ 'struct': _('C/C++ struct'),
+ 'function': _('C++ function'),
+ 'cfunction': _('C function'),
+ 'jfunction': _('Java method'),
+ 'pyfunction': _('Python function'),
+ 'pyoldfunction': _('Legacy Python function'),
+ 'member': _('C++ member'),
+ 'type': _('C/C++ type'),
+ 'namespace': _('C++ namespace'),
+ }.get(type.lname, _('%s %s') % (self.label, type.lname))
+
def setup(app):
app.add_domain(OCVDomain)