Documentation: added support for virtual methods

This commit is contained in:
Andrey Kamaev 2012-05-29 13:59:49 +00:00
parent b69e08cf51
commit bb69e03f12

View File

@ -668,13 +668,14 @@ class MemberObjDefExpr(NamedDefExpr):
class FuncDefExpr(NamedDefExpr): class FuncDefExpr(NamedDefExpr):
def __init__(self, name, visibility, static, explicit, rv, def __init__(self, name, visibility, static, explicit, rv,
signature, const, pure_virtual): signature, const, pure_virtual, virtual):
NamedDefExpr.__init__(self, name, visibility, static) NamedDefExpr.__init__(self, name, visibility, static)
self.rv = rv self.rv = rv
self.signature = signature self.signature = signature
self.explicit = explicit self.explicit = explicit
self.const = const self.const = const
self.pure_virtual = pure_virtual self.pure_virtual = pure_virtual
self.virtual = virtual
def get_id(self): def get_id(self):
return u'%s%s%s' % ( return u'%s%s%s' % (
@ -688,6 +689,8 @@ class FuncDefExpr(NamedDefExpr):
buf = self.get_modifiers() buf = self.get_modifiers()
if self.explicit: if self.explicit:
buf.append(u'explicit') buf.append(u'explicit')
if self.virtual:
buf.append(u'virtual')
if self.rv is not None: if self.rv is not None:
buf.append(unicode(self.rv)) buf.append(unicode(self.rv))
buf.append(u'%s(%s)' % (self.name, u', '.join( buf.append(u'%s(%s)' % (self.name, u', '.join(
@ -1074,6 +1077,11 @@ class DefinitionParser(object):
self.skip_ws() self.skip_ws()
else: else:
explicit = False explicit = False
if self.skip_word('virtual'):
virtual = True
self.skip_ws()
else:
virtual = False
rv = self._parse_type() rv = self._parse_type()
self.skip_ws() self.skip_ws()
# some things just don't have return values # some things just don't have return values
@ -1082,8 +1090,8 @@ class DefinitionParser(object):
rv = None rv = None
else: else:
name = self._parse_type() name = self._parse_type()
return FuncDefExpr(name, visibility, static, explicit, rv, return FuncDefExpr(name, visibility, static, explicit, rv,
*self._parse_signature()) *self._parse_signature(), virtual = virtual)
def parse_class(self): def parse_class(self):
visibility, static = self._parse_visibility_static() visibility, static = self._parse_visibility_static()
@ -1347,6 +1355,9 @@ class OCVFunctionObject(OCVObject):
if func.explicit: if func.explicit:
signode += addnodes.desc_annotation('explicit', 'explicit') signode += addnodes.desc_annotation('explicit', 'explicit')
signode += nodes.Text(' ') signode += nodes.Text(' ')
if func.virtual:
signode += addnodes.desc_annotation('virtual', 'virtual')
signode += nodes.Text(' ')
# return value is None for things with a reverse return value # return value is None for things with a reverse return value
# such as casting operator definitions or constructors # such as casting operator definitions or constructors
# and destructors. # and destructors.