docs: Write gtk-doc comments for constant variables
This commit is contained in:

committed by
George Kiagiadakis

parent
1b5df6096a
commit
d9cd0e4fdf
@@ -327,6 +327,33 @@ class DoxyFunction(DoxyElement):
|
|||||||
return e
|
return e
|
||||||
|
|
||||||
|
|
||||||
|
class DoxyVariable(DoxyElement):
|
||||||
|
@staticmethod
|
||||||
|
def from_memberdef(xml):
|
||||||
|
name = xml.find("name").text
|
||||||
|
d = normalize_text(xml.find("definition").text)
|
||||||
|
d += ";"
|
||||||
|
e = DoxyVariable(name, d)
|
||||||
|
e.add_brief(xml.find("briefdescription"))
|
||||||
|
t = xml.find("type")
|
||||||
|
if t is not None:
|
||||||
|
typestr = "".join(t.itertext()).strip()
|
||||||
|
if typestr.startswith("const "):
|
||||||
|
typestr = typestr[6:]
|
||||||
|
e.type = "("+typestr+") "
|
||||||
|
else:
|
||||||
|
e.type = ""
|
||||||
|
v = xml.find("initializer")
|
||||||
|
e.value = v.text.replace("=","").replace("\n","") if v is not None else ""
|
||||||
|
return e
|
||||||
|
def to_gtkdoc(self):
|
||||||
|
s = super().to_gtkdoc()
|
||||||
|
# need this to get g-ir-scanner to recognize this as a constant
|
||||||
|
s += "#define "+self.name+" ("+self.type+self.value+")\n"
|
||||||
|
s += "#undef "+self.name+"\n"
|
||||||
|
return s
|
||||||
|
|
||||||
|
|
||||||
def main(args):
|
def main(args):
|
||||||
xml_dir = None
|
xml_dir = None
|
||||||
outfile = None
|
outfile = None
|
||||||
@@ -361,6 +388,9 @@ def main(args):
|
|||||||
for n1 in n0.xpath(".//*/memberdef[@kind='function']"):
|
for n1 in n0.xpath(".//*/memberdef[@kind='function']"):
|
||||||
e = DoxyFunction.from_memberdef(n1)
|
e = DoxyFunction.from_memberdef(n1)
|
||||||
symbols.append(e)
|
symbols.append(e)
|
||||||
|
for n1 in n0.xpath(".//*/memberdef[@kind='variable']"):
|
||||||
|
e = DoxyVariable.from_memberdef(n1)
|
||||||
|
symbols.append(e)
|
||||||
|
|
||||||
if (opts.outfile):
|
if (opts.outfile):
|
||||||
try:
|
try:
|
||||||
|
@@ -128,7 +128,7 @@ if build_gir
|
|||||||
dependencies: [wp_dep, dummy_dep],
|
dependencies: [wp_dep, dummy_dep],
|
||||||
namespace: 'Wp',
|
namespace: 'Wp',
|
||||||
nsversion: wireplumber_api_version,
|
nsversion: wireplumber_api_version,
|
||||||
sources: [wpenums_h, wp_lib_headers, wp_gtkdoc_h],
|
sources: [wpenums_h, wp_gtkdoc_h, wp_lib_headers],
|
||||||
include_directories: [wpenums_include_dir],
|
include_directories: [wpenums_include_dir],
|
||||||
includes: ['GLib-2.0', 'GObject-2.0', 'Gio-2.0'],
|
includes: ['GLib-2.0', 'GObject-2.0', 'Gio-2.0'],
|
||||||
install: true,
|
install: true,
|
||||||
|
Reference in New Issue
Block a user