From: Martin Ling Date: Sun, 25 Oct 2015 01:39:16 +0000 (+0000) Subject: java: Make enum values available as normal constants. X-Git-Tag: libsigrok-0.4.0~163 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=e5c22906e804f540647ab182d9538499964eb633;p=libsigrok.git java: Make enum values available as normal constants. --- diff --git a/bindings/cxx/enums.py b/bindings/cxx/enums.py index 0d2887bc..4e6be7ba 100644 --- a/bindings/cxx/enums.py +++ b/bindings/cxx/enums.py @@ -134,11 +134,19 @@ for enum, (classname, classbrief) in classes.items(): classname, classname, trimmed_name, classname, name, trimmed_name), file=code) + print('%%typemap(javacode) sigrok::%s %%{' % classname, file=swig) + # Define public pointers for each enum value for trimmed_name in trimmed_names: print('const %s * const %s::%s = &%s::_%s;' % ( classname, classname, trimmed_name, classname, trimmed_name), file=code) + print('public static final %s %s = new %s(classesJNI.%s_%s_get(), false);' % ( + classname, trimmed_name, classname, classname, trimmed_name), + file=swig) + + print ('%}', file=swig) + # Define map of enum values to constants print('template<> const SR_API std::map EnumValue<%s, enum %s>::_values = {' % (