From: Martin Ling Date: Tue, 20 Oct 2015 23:18:03 +0000 (+0100) Subject: java: Remove need for conversion methods on container wrappers. X-Git-Tag: libsigrok-0.4.0~188 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=f3095e7e2e2a4cc034a9253179c04dc5d129e882;p=libsigrok.git java: Remove need for conversion methods on container wrappers. --- diff --git a/bindings/java/org/sigrok/core/classes/classes.i b/bindings/java/org/sigrok/core/classes/classes.i index fb8da272..7e1919e2 100644 --- a/bindings/java/org/sigrok/core/classes/classes.i +++ b/bindings/java/org/sigrok/core/classes/classes.i @@ -54,20 +54,12 @@ namespace Glib { %typemap(jstype) std::vector< CValue > "java.util.Vector" %typemap(javain, - pre=" $javaclassname temp$javainput = $javaclassname.convertVector($javainput);", + pre=" $javaclassname temp$javainput = new $javaclassname(); + for (JValue value : $javainput) + temp$javainput.add(value);", pgcppname="temp$javainput") std::vector< CValue > "$javaclassname.getCPtr(temp$javainput)" -%typemap(javacode) std::vector< CValue > %{ - static $javaclassname convertVector(java.util.Vector in) - { - $javaclassname out = new $javaclassname(); - for (JValue value : in) - out.add(value); - return out; - } -%} - %typemap(javaout) std::vector< CValue > { return (java.util.Vector)$jnicall; } @@ -102,20 +94,12 @@ VECTOR(std::shared_ptr, HardwareDevice) "java.util.Map" %typemap(javain, - pre=" $javaclassname temp$javainput = $javaclassname.convertMap($javainput);", + pre=" $javaclassname temp$javainput = new $javaclassname(); + for (java.util.Map.Entry entry : $javainput.entrySet()) + temp$javainput.set(entry.getKey(), entry.getValue());", pgcppname="temp$javainput") std::map< CKey, CValue > "$javaclassname.getCPtr(temp$javainput)" -%typemap(javacode) std::map< CKey, CValue > %{ - static $javaclassname convertMap(java.util.Map in) - { - $javaclassname out = new $javaclassname(); - for (java.util.Map.Entry entry : in.entrySet()) - out.set(entry.getKey(), entry.getValue()); - return out; - } -%} - %typemap(javaout) std::map< CKey, CValue > { return (java.util.Map)$jnicall; }