]> sigrok.org Git - libsigrok.git/blobdiff - bindings/cxx/enums.py
All Doxyfile files: Set CREATE_SUBDIRS to NO.
[libsigrok.git] / bindings / cxx / enums.py
index 0d2887bc1fa5d257796cbeb0584ede0d7bf40dad..3711334e74f740135a94f58ef70e78e7a8570268 100644 (file)
@@ -40,6 +40,7 @@ mapping = dict([
     ('sr_unit', ('Unit', 'Unit of measurement')),
     ('sr_mqflag', ('QuantityFlag', 'Flag applied to measured quantity')),
     ('sr_configkey', ('ConfigKey', 'Configuration key')),
+    ('sr_configcap', ('Capability', 'Configuration capability')),
     ('sr_datatype', ('DataType', 'Configuration data type')),
     ('sr_channeltype', ('ChannelType', 'Channel type')),
     ('sr_trigger_matches', ('TriggerMatchType', 'Trigger match type')),
@@ -75,8 +76,12 @@ swig = open(os.path.join(outdirname, 'swig/enums.i'), 'w')
 for file in (header, code):
     print("/* Generated file - edit enums.py instead! */", file=file)
 
+print("namespace sigrok {", file=header)
+
 # Template for beginning of class declaration and public members.
 header_public_template = """
+template<> const SR_API std::map<const enum {enumname}, const {classname} * const> EnumValue<{classname}, enum {enumname}>::_values;
+
 /** {brief} */
 class SR_API {classname} : public EnumValue<{classname}, enum {enumname}>
 {{
@@ -168,3 +173,5 @@ for enum, (classname, classbrief) in classes.items():
     filename = os.path.join(dirname, "%s_methods.i" % classname)
     if os.path.exists(filename):
         print(str.join('', open(filename).readlines()), file=swig)
+
+print("}", file=header)