diff options
author | Cosimo Alfarano <cosimo.alfarano@collabora.co.uk> | 2010-04-19 13:25:51 +0100 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2010-04-20 16:09:45 +0100 |
commit | 26999c1619c494d2506e086d0f014b34984ce29c (patch) | |
tree | c46cdc36bf7df46f444093d83ec0c0ef4c1934d1 /tools | |
parent | a98e30303b5e7ebaf2753f3ea11e62ab826430ed (diff) | |
download | telepathy-glib-26999c1619c494d2506e086d0f014b34984ce29c.tar.gz |
tools/glib-interfaces-gen.py: add automatic string constant generation for TP_TOKEN_*
Generate code for "contact-attribute" and "tp:hct" elements (ignoring
"is-family=yes" matching elements for the latter) creating constant of the form
TP_TOKEN_${INTERFACE}_${TOKEN}
gtk-doc: add TP_TOKEN_* to docs/reference/telepathy-glib-sections.txt
Closes fdo#26211
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/glib-interfaces-gen.py | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/tools/glib-interfaces-gen.py b/tools/glib-interfaces-gen.py index 95439687e..2321aac31 100644 --- a/tools/glib-interfaces-gen.py +++ b/tools/glib-interfaces-gen.py @@ -114,6 +114,44 @@ GQuark 'prop' : prop.getAttribute('name'), }) + + for prop in iface.getElementsByTagNameNS(NS_TP, 'contact-attribute'): + self.decls.write(""" +/** + * %(TOKEN_PREFIX)s_%(TOKEN_UC)s: + * + * The fully-qualified contact attribute token name "%(name)s.%(prop)s" + */ +#define %(TOKEN_PREFIX)s_%(TOKEN_UC)s \\ +"%(name)s.%(prop)s" +""" % {'TOKEN_PREFIX' : (self.prefix + 'TOKEN_' + \ + parent_name).upper().replace('/', ''), + 'TOKEN_UC': prop.getAttributeNS(None, "name").upper().replace("-", "_").replace(".", "_"), + 'name' : iface.getAttribute('name'), + 'prop' : prop.getAttribute('name'), + }) + + + + for prop in iface.getElementsByTagNameNS(NS_TP, 'hct'): + if (prop.getAttribute('is-family') != "yes"): + self.decls.write(""" +/** + * %(TOKEN_PREFIX)s_%(TOKEN_UC)s: + * + * The fully-qualified capability token name "%(name)s.%(prop)s" + */ +#define %(TOKEN_PREFIX)s_%(TOKEN_UC)s \\ +"%(name)s.%(prop)s" +""" % {'TOKEN_PREFIX' : (self.prefix + 'TOKEN_' + \ + parent_name).upper().replace('/', ''), + 'TOKEN_UC': prop.getAttributeNS(None, "name").upper().replace("-", "_").replace(".", "_"), + 'name' : iface.getAttribute('name'), + 'prop' : prop.getAttribute('name'), + }) + + self.decls.write("\n") + if __name__ == '__main__': argv = argv[1:] Generator(argv[0], argv[1], argv[2], xml.dom.minidom.parse(argv[3]))() |