Commit Graph

12 Commits

Author SHA1 Message Date
Uwe Hermann 0875f11de4 Fix multiple C++ bindings warnings with gcc 8.
bindings/cxx/classes.cpp: In function ‘int sigrok::call_log_callback(void*, int, const char*, __va_list_tag*)’:
  bindings/cxx/classes.cpp:242:17: warning: catching polymorphic type ‘class sigrok::Error’ by value [-Wcatch-value=]
    } catch (Error e) {
                   ^
  In file included from bindings/cxx/classes.cpp:1667:
  bindings/cxx/enums.cpp: In static member function ‘static Glib::VariantBase sigrok::ConfigKey::parse_string(std::__cxx11::string, sr_datatype)’:
  bindings/cxx/enums.cpp:789:13: warning: catching polymorphic type ‘class std::invalid_argument’ by value [-Wcatch-value=]
      } catch (invalid_argument) {
               ^~~~~~~~~~~~~~~~
  bindings/cxx/enums.cpp:804:13: warning: catching polymorphic type ‘class std::invalid_argument’ by value [-Wcatch-value=]
      } catch (invalid_argument) {
               ^~~~~~~~~~~~~~~~
2018-07-22 17:08:44 +02:00
Gerhard Sittig 1e95832b3e bindings/cxx: include config.h as early as possible
Move the inclusion of <config.h> before any other source code.
2018-02-21 11:19:17 +01:00
Gerhard Sittig 61a6d983bd C++ binding: Allow to re-use ConfigKey::parse_string() for Option class
Split the data type detection from the actual data type conversion in
the ConfigKey::parse_string() method. Allow the Option class to re-use
the public ConfigKey method, to share the maximum amount of data type
conversion code for both Driver and InputFormat option specs.

This is the least intrusive yet most reliable and consistent approach in
the libsigrok C++ binding that allows applications to support driver scan
and input file format options from command line arguments.
2017-06-25 20:42:21 +02:00
Martin Ling 4aa9a1e569 C++: Catch exceptions from stoi() and stod().
Fixes bug #483.
2015-10-26 07:17:50 +01:00
Daniel Elstner 21d1bec60e C++: Make most members private instead of protected
Use protected only for members which are actually needed by
sub-classes. Declare all the rest private.
2015-10-26 06:45:56 +01:00
Daniel Elstner 6ec6c43b47 Build: Include <config.h> first in all source files
Since Autoconf places some important feature flags only into the
configuration header, it is necessary to include it globally to
guarantee a consistent build.
2015-09-13 18:54:46 +02:00
Bert Vermeulen 2fb60e2329 Replace sr_config_info with sr_key_info.
The tables defined with this struct can now be used for information
on items other than config keys.

Functions to access these tables have been renamed sr_key_info_[name_]get.
These take an extra argument, keytype, which should be set to SR_KEY_CONFIG
to get the config key tables. Other key types will be added.
2015-08-26 01:08:42 +02:00
Martin Ling 0bc1a7613a bindings: Rename ConfigKey::get(string) to get_by_identifier().
The polymorphism with get(int) causes problems here when a char * is passed.
2014-11-12 02:27:04 +01:00
Martin Ling 3b16108573 bindings: Remove 'get_' prefix from all accessors. 2014-09-11 21:27:32 +01:00
Marcus Comstedt d92de05ad1 C++: Provide fallbacks for missing stoi/stod functions
Notably, Android does not provide these functions.  The fallback
implementation is based on the one in the GNU ISO C++ Library.
2014-08-31 13:31:35 +02:00
Martin Ling 7009a3921a C++: Fix leak of GVariant in ConfigKey::parse_string(). 2014-07-24 23:42:53 +01:00
Martin Ling c23c8659b8 Add C++ bindings. 2014-07-18 20:47:10 +01:00