summaryrefslogtreecommitdiffstats
path: root/src/configgen.py
diff options
context:
space:
mode:
authorDimitri van Heesch <doxygen@gmail.com>2021-05-15 17:29:42 (GMT)
committerDimitri van Heesch <doxygen@gmail.com>2021-05-15 17:29:42 (GMT)
commite6f54449c5b688cdc6647f80558d67dcaa03b30d (patch)
treed2ee863521a7e62707eb8e7482eb5d410b6c4e22 /src/configgen.py
parent378be4c7f3150e6440993e0bf07235b65fe44870 (diff)
downloadDoxygen-e6f54449c5b688cdc6647f80558d67dcaa03b30d.zip
Doxygen-e6f54449c5b688cdc6647f80558d67dcaa03b30d.tar.gz
Doxygen-e6f54449c5b688cdc6647f80558d67dcaa03b30d.tar.bz2
Template engine: allow listing list and struct variables as strings
For easier debugging one can do e.g. `{% msg %}value={{ variable }}{% endmsg %}` to list the value of a variable also when it is a list or struct.
Diffstat (limited to 'src/configgen.py')
-rwxr-xr-xsrc/configgen.py67
1 files changed, 44 insertions, 23 deletions
diff --git a/src/configgen.py b/src/configgen.py
index 5c4c39a..b7736c4 100755
--- a/src/configgen.py
+++ b/src/configgen.py
@@ -696,34 +696,35 @@ def main():
print(" static ConfigValues &instance() { static ConfigValues theInstance; return theInstance; }")
for n in elem.childNodes:
if n.nodeType == Node.ELEMENT_NODE:
- if (n.nodeName == "group"):
+ if n.nodeName == "group":
parseGroupMapGetter(n)
for n in elem.childNodes:
if n.nodeType == Node.ELEMENT_NODE:
- if (n.nodeName == "group"):
+ if n.nodeName == "group":
parseGroupMapSetter(n)
print(" void init();")
- print(" struct Info");
- print(" {");
- print(" enum Type { Bool, Int, String, List, Unknown };");
- print(" Info(Type t,bool ConfigValues::*b) : type(t), value(b) {}");
- print(" Info(Type t,int ConfigValues::*i) : type(t), value(i) {}");
- print(" Info(Type t,QCString ConfigValues::*s) : type(t), value(s) {}");
- print(" Info(Type t,StringVector ConfigValues::*l) : type(t), value(l) {}");
- print(" Type type;");
- print(" union Item");
- print(" {");
- print(" Item(bool ConfigValues::*v) : b(v) {}");
- print(" Item(int ConfigValues::*v) : i(v) {}");
- print(" Item(QCString ConfigValues::*v) : s(v) {}");
- print(" Item(StringVector ConfigValues::*v) : l(v) {}");
- print(" bool ConfigValues::*b;");
- print(" int ConfigValues::*i;");
- print(" QCString ConfigValues::*s;");
- print(" StringVector ConfigValues::*l;");
- print(" } value;");
- print(" };");
- print(" const Info *get(const QCString &tag) const;");
+ print(" StringVector fields() const;")
+ print(" struct Info")
+ print(" {")
+ print(" enum Type { Bool, Int, String, List, Unknown };")
+ print(" Info(Type t,bool ConfigValues::*b) : type(t), value(b) {}")
+ print(" Info(Type t,int ConfigValues::*i) : type(t), value(i) {}")
+ print(" Info(Type t,QCString ConfigValues::*s) : type(t), value(s) {}")
+ print(" Info(Type t,StringVector ConfigValues::*l) : type(t), value(l) {}")
+ print(" Type type;")
+ print(" union Item")
+ print(" {")
+ print(" Item(bool ConfigValues::*v) : b(v) {}")
+ print(" Item(int ConfigValues::*v) : i(v) {}")
+ print(" Item(QCString ConfigValues::*v) : s(v) {}")
+ print(" Item(StringVector ConfigValues::*v) : l(v) {}")
+ print(" bool ConfigValues::*b;")
+ print(" int ConfigValues::*i;")
+ print(" QCString ConfigValues::*s;")
+ print(" StringVector ConfigValues::*l;")
+ print(" } value;")
+ print(" };")
+ print(" const Info *get(const QCString &tag) const;")
print(" private:")
for n in elem.childNodes:
if n.nodeType == Node.ELEMENT_NODE:
@@ -765,6 +766,26 @@ def main():
if (n.nodeName == "group"):
parseGroupInit(n)
print("}")
+ print("")
+ print("StringVector ConfigValues::fields() const")
+ print("{")
+ print(" return {");
+ first=True
+ for n in elem.childNodes:
+ if n.nodeType == Node.ELEMENT_NODE:
+ if (n.nodeName == "group"):
+ for c in n.childNodes:
+ if c.nodeType == Node.ELEMENT_NODE:
+ name = c.getAttribute('id')
+ type = c.getAttribute('type')
+ if type!='obsolete':
+ if not first:
+ print(",")
+ first=False
+ sys.stdout.write(' "'+name+'"')
+ print("")
+ print(" };")
+ print("}")
elif (sys.argv[1] == "-cpp"):
print("/* WARNING: This file is generated!")
print(" * Do not edit this file, but edit config.xml instead and run")