bindings: Wrap EnumValue base class.

This commit is contained in:
Martin Ling 2014-10-29 14:36:45 +00:00 committed by Uwe Hermann
parent 0bc1a7613a
commit fe4096fde6
3 changed files with 7 additions and 0 deletions

1
.gitignore vendored
View File

@ -49,6 +49,7 @@ bindings/cxx/doxy/
bindings/cxx/include/libsigrok/enums.hpp
bindings/cxx/enums.cpp
bindings/cxx/enums.timestamp
bindings/swig/enums.i
# Files generated by building Python bindings
*.pyc

View File

@ -66,6 +66,7 @@ for compound in index.findall('compound'):
header = open(os.path.join(outdirname, 'include/libsigrok/enums.hpp'), 'w')
code = open(os.path.join(outdirname, 'enums.cpp'), 'w')
swig = open(os.path.join(outdirname, '../swig/enums.i'), 'w')
for file in (header, code):
print >> file, "/* Generated file - edit enums.py instead! */"
@ -144,3 +145,7 @@ for enum, (classname, classbrief) in classes.items():
filename = os.path.join(dirname, "%s_methods.cpp" % classname)
if os.path.exists(filename):
print >> code, str.join('', open(filename).readlines())
# Instantiate EnumValue template for SWIG wrappers
print >> swig, '%%template(EnumValue%s) EnumValue<%s, enum %s>;' % (
classname, classname, enum_name)

View File

@ -273,5 +273,6 @@ typedef std::map<const sigrok::ConfigKey *, Glib::VariantBase>
%include "libsigrok/libsigrok.hpp"
namespace sigrok {
%include "enums.i"
%include "libsigrok/enums.hpp"
}