java: Fix SWIG warnings due to dodgy %extend redefinitions.
If we're going to %extend these methods, we need to firstly ignore the originals, and secondly implement all possible argument combinations. This fixes the rest of bug #417.
This commit is contained in:
parent
e66728886f
commit
85aa1b599f
|
@ -208,31 +208,69 @@ MAP_COMMON(const sigrok::ConfigKey *, Glib::VariantBase, ConfigKey, Variant)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Support Driver.scan() with no arguments. */
|
/* Support Driver.scan() with no arguments. */
|
||||||
|
%ignore sigrok::Driver::scan;
|
||||||
|
|
||||||
%extend sigrok::Driver {
|
%extend sigrok::Driver {
|
||||||
std::vector<std::shared_ptr<sigrok::HardwareDevice> > scan()
|
std::vector<std::shared_ptr<sigrok::HardwareDevice> > scan()
|
||||||
{
|
{
|
||||||
std::map<const sigrok::ConfigKey *, Glib::VariantBase> options;
|
std::map<const sigrok::ConfigKey *, Glib::VariantBase> options;
|
||||||
return $self->scan(options);
|
return $self->scan(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<std::shared_ptr<sigrok::HardwareDevice> > scan(
|
||||||
|
std::map<const sigrok::ConfigKey *, Glib::VariantBase> options)
|
||||||
|
{
|
||||||
|
return $self->scan(options);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Support InputFormat.create_input() with no options. */
|
/* Support InputFormat.create_input() with or without options. */
|
||||||
|
%ignore sigrok::InputFormat::create_input;
|
||||||
|
|
||||||
%extend sigrok::InputFormat {
|
%extend sigrok::InputFormat {
|
||||||
std::shared_ptr<sigrok::Input> create_input()
|
std::shared_ptr<sigrok::Input> create_input()
|
||||||
{
|
{
|
||||||
std::map<std::string, Glib::VariantBase> options;
|
return $self->create_input();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<sigrok::Input> create_input(
|
||||||
|
std::map<std::string, Glib::VariantBase> options)
|
||||||
|
{
|
||||||
return $self->create_input(options);
|
return $self->create_input(options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Support OutputFormat.create_output(device) with no options. */
|
/* Support OutputFormat.create_output() with or without options. */
|
||||||
|
%ignore sigrok::OutputFormat::create_output;
|
||||||
|
|
||||||
%extend sigrok::OutputFormat {
|
%extend sigrok::OutputFormat {
|
||||||
std::shared_ptr<sigrok::Output> create_output(
|
std::shared_ptr<sigrok::Output> create_output(
|
||||||
std::shared_ptr<sigrok::Device> device)
|
std::shared_ptr<sigrok::Device> device)
|
||||||
{
|
{
|
||||||
std::map<std::string, Glib::VariantBase> options;
|
return $self->create_output(device);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<sigrok::Output> create_output(
|
||||||
|
std::shared_ptr<sigrok::Device> device,
|
||||||
|
std::map<std::string, Glib::VariantBase> options)
|
||||||
|
{
|
||||||
return $self->create_output(device, options);
|
return $self->create_output(device, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<sigrok::Output> create_output(
|
||||||
|
std::string filename,
|
||||||
|
std::shared_ptr<sigrok::Device> device)
|
||||||
|
{
|
||||||
|
return $self->create_output(filename, device);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<sigrok::Output> create_output(
|
||||||
|
std::string filename,
|
||||||
|
std::shared_ptr<sigrok::Device> device,
|
||||||
|
std::map<std::string, Glib::VariantBase> options)
|
||||||
|
{
|
||||||
|
return $self->create_output(filename, device, options);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Pass JNIEnv parameter to C++ extension methods requiring it. */
|
/* Pass JNIEnv parameter to C++ extension methods requiring it. */
|
||||||
|
|
Loading…
Reference in New Issue