diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2021-03-23 20:43:47 +0400 |
---|---|---|
committer | Emmanuele Bassi <ebassi@gmail.com> | 2021-06-20 21:28:02 +0000 |
commit | b8880276b257d584f2d7120a05daba19093de319 (patch) | |
tree | 637cb2307181f7df08ef3ca15adcad693b1ecfbd /giscanner | |
parent | 01821d5e4986a36d7a8de9278540205e54144e1d (diff) | |
download | gobject-introspection-b8880276b257d584f2d7120a05daba19093de319.tar.gz |
Add glib:name to enum member
This member will contain the string from the GEnumValue/GFlagsValue
'value_name' introspection dump.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Diffstat (limited to 'giscanner')
-rw-r--r-- | giscanner/ast.py | 3 | ||||
-rw-r--r-- | giscanner/gdumpparser.py | 3 | ||||
-rw-r--r-- | giscanner/girparser.py | 3 | ||||
-rw-r--r-- | giscanner/girwriter.py | 2 | ||||
-rw-r--r-- | giscanner/transformer.py | 4 |
5 files changed, 9 insertions, 6 deletions
diff --git a/giscanner/ast.py b/giscanner/ast.py index 593969f2..9a0d95c7 100644 --- a/giscanner/ast.py +++ b/giscanner/ast.py @@ -972,12 +972,13 @@ class Bitfield(Node, Registered): class Member(Annotated): - def __init__(self, name, value, symbol, nick): + def __init__(self, name, value, symbol, nick=None, dump_name=None): Annotated.__init__(self) self.name = name self.value = value self.symbol = symbol self.nick = nick + self.dump_name = dump_name self.parent = None def _compare(self, other, op): diff --git a/giscanner/gdumpparser.py b/giscanner/gdumpparser.py index ada1503d..03a4ecc3 100644 --- a/giscanner/gdumpparser.py +++ b/giscanner/gdumpparser.py @@ -285,7 +285,8 @@ blob containing data gleaned from GObject's primitive introspection.""" members.append(ast.Member(name, value, symbol, - member.attrib['nick'])) + member.attrib['nick'], + member.attrib['name'])) if xmlnode.tag == 'flags': klass = ast.Bitfield diff --git a/giscanner/girparser.py b/giscanner/girparser.py index d229b164..da200a65 100644 --- a/giscanner/girparser.py +++ b/giscanner/girparser.py @@ -609,7 +609,8 @@ class GIRParser(object): member = ast.Member(node.attrib['name'], node.attrib['value'], node.attrib.get(_cns('identifier')), - node.attrib.get(_glibns('nick'))) + node.attrib.get(_glibns('nick')), + node.attrib.get(_glibns('name'))) self._parse_generic_attribs(node, member) return member diff --git a/giscanner/girwriter.py b/giscanner/girwriter.py index 2b837362..54c957c0 100644 --- a/giscanner/girwriter.py +++ b/giscanner/girwriter.py @@ -442,6 +442,8 @@ class GIRWriter(XMLWriter): self._append_version(member, attrs) if member.nick is not None: attrs.append(('glib:nick', member.nick)) + if member.dump_name is not None: + attrs.append(('glib:name', member.dump_name)) with self.tagcontext('member', attrs): self._write_generic(member) diff --git a/giscanner/transformer.py b/giscanner/transformer.py index bcabdedc..ad2a87f4 100644 --- a/giscanner/transformer.py +++ b/giscanner/transformer.py @@ -432,9 +432,7 @@ raise ValueError.""" name = self._strip_symbol(child) members.append(ast.Member(name.lower(), child.const_int, - child.ident, - None)) - + child.ident)) enum_name = self.strip_identifier(symbol.ident) if symbol.base_type.is_bitfield: klass = ast.Bitfield |