mirror of
https://gitlab.freedesktop.org/pipewire/wireplumber.git
synced 2026-02-16 12:10:30 +01:00
docs: Write gtk-doc comments for constant variables
This commit is contained in:
parent
1b5df6096a
commit
d9cd0e4fdf
2 changed files with 31 additions and 1 deletions
|
|
@ -327,6 +327,33 @@ class DoxyFunction(DoxyElement):
|
|||
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):
|
||||
xml_dir = None
|
||||
outfile = None
|
||||
|
|
@ -361,6 +388,9 @@ def main(args):
|
|||
for n1 in n0.xpath(".//*/memberdef[@kind='function']"):
|
||||
e = DoxyFunction.from_memberdef(n1)
|
||||
symbols.append(e)
|
||||
for n1 in n0.xpath(".//*/memberdef[@kind='variable']"):
|
||||
e = DoxyVariable.from_memberdef(n1)
|
||||
symbols.append(e)
|
||||
|
||||
if (opts.outfile):
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ if build_gir
|
|||
dependencies: [wp_dep, dummy_dep],
|
||||
namespace: 'Wp',
|
||||
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],
|
||||
includes: ['GLib-2.0', 'GObject-2.0', 'Gio-2.0'],
|
||||
install: true,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue