Skip to content

Commit

Permalink
Swig cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
aldenml committed Feb 4, 2016
1 parent 9c9b358 commit 229199f
Show file tree
Hide file tree
Showing 8 changed files with 186 additions and 1,289 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/frostwire/jlibtorrent/demo/LazyRead.java
Expand Up @@ -38,6 +38,6 @@ public static void main(String[] args) throws Throwable {
torrent_info ti = new torrent_info(e, ec);

System.out.println(new Sha1Hash(ti.info_hash()));
System.out.println(libtorrent.print_entry(e));
System.out.println(bdecode_node.to_string(e, false, 0));
}
}
28 changes: 4 additions & 24 deletions src/main/java/com/frostwire/jlibtorrent/swig/bdecode_node.java
Expand Up @@ -51,12 +51,8 @@ public boolean op_bool() {
return libtorrent_jni.bdecode_node_op_bool(swigCPtr, this);
}

public bdecode_node non_owning() {
return new bdecode_node(libtorrent_jni.bdecode_node_non_owning(swigCPtr, this), true);
}

public char_const_ptr_int_pair data_section() {
return new char_const_ptr_int_pair(libtorrent_jni.bdecode_node_data_section(swigCPtr, this), true);
public bdecode_node list_at(int i) {
return new bdecode_node(libtorrent_jni.bdecode_node_list_at(swigCPtr, this, i), true);
}

public String list_string_value_at(int i, String default_val) {
Expand Down Expand Up @@ -131,28 +127,12 @@ public String string_value() {
return libtorrent_jni.bdecode_node_string_value(swigCPtr, this);
}

public String string_ptr() {
return libtorrent_jni.bdecode_node_string_ptr(swigCPtr, this);
}

public int string_length() {
return libtorrent_jni.bdecode_node_string_length(swigCPtr, this);
}

public void clear() {
libtorrent_jni.bdecode_node_clear(swigCPtr, this);
}

public void swap(bdecode_node n) {
libtorrent_jni.bdecode_node_swap(swigCPtr, this, bdecode_node.getCPtr(n), n);
}

public void reserve(int tokens) {
libtorrent_jni.bdecode_node_reserve(swigCPtr, this, tokens);
}

public void switch_underlying_buffer(String buf) {
libtorrent_jni.bdecode_node_switch_underlying_buffer(swigCPtr, this, buf);
public static String to_string(bdecode_node e, boolean single_line, int indent) {
return libtorrent_jni.bdecode_node_to_string(bdecode_node.getCPtr(e), e, single_line, indent);
}

public static int bdecode(char_vector buffer, bdecode_node ret, error_code ec) {
Expand Down

This file was deleted.

12 changes: 0 additions & 12 deletions src/main/java/com/frostwire/jlibtorrent/swig/libtorrent.java
Expand Up @@ -141,18 +141,6 @@ public static error_category get_bdecode_category() {
return new error_category(libtorrent_jni.get_bdecode_category(), false);
}

public static String print_entry(bdecode_node e, boolean single_line, int indent) {
return libtorrent_jni.print_entry__SWIG_0(bdecode_node.getCPtr(e), e, single_line, indent);
}

public static String print_entry(bdecode_node e, boolean single_line) {
return libtorrent_jni.print_entry__SWIG_1(bdecode_node.getCPtr(e), e, single_line);
}

public static String print_entry(bdecode_node e) {
return libtorrent_jni.print_entry__SWIG_2(bdecode_node.getCPtr(e), e);
}

public static String make_magnet_uri(torrent_handle handle) {
return libtorrent_jni.make_magnet_uri__SWIG_0(torrent_handle.getCPtr(handle), handle);
}
Expand Down
20 changes: 2 additions & 18 deletions src/main/java/com/frostwire/jlibtorrent/swig/libtorrent_jni.java
Expand Up @@ -25,14 +25,6 @@ public class libtorrent_jni {
}
}

public final static native long new_char_const_ptr_int_pair__SWIG_0();
public final static native long new_char_const_ptr_int_pair__SWIG_1(String jarg1, int jarg2);
public final static native long new_char_const_ptr_int_pair__SWIG_2(long jarg1, char_const_ptr_int_pair jarg1_);
public final static native void char_const_ptr_int_pair_first_set(long jarg1, char_const_ptr_int_pair jarg1_, String jarg2);
public final static native String char_const_ptr_int_pair_first_get(long jarg1, char_const_ptr_int_pair jarg1_);
public final static native void char_const_ptr_int_pair_second_set(long jarg1, char_const_ptr_int_pair jarg1_, int jarg2);
public final static native int char_const_ptr_int_pair_second_get(long jarg1, char_const_ptr_int_pair jarg1_);
public final static native void delete_char_const_ptr_int_pair(long jarg1);
public final static native long new_int_int_pair__SWIG_0();
public final static native long new_int_int_pair__SWIG_1(int jarg1, int jarg2);
public final static native long new_int_int_pair__SWIG_2(long jarg1, int_int_pair jarg1_);
Expand Down Expand Up @@ -2692,8 +2684,7 @@ public class libtorrent_jni {
public final static native long new_bdecode_node__SWIG_1(long jarg1, bdecode_node jarg1_);
public final static native int bdecode_node_type(long jarg1, bdecode_node jarg1_);
public final static native boolean bdecode_node_op_bool(long jarg1, bdecode_node jarg1_);
public final static native long bdecode_node_non_owning(long jarg1, bdecode_node jarg1_);
public final static native long bdecode_node_data_section(long jarg1, bdecode_node jarg1_);
public final static native long bdecode_node_list_at(long jarg1, bdecode_node jarg1_, int jarg2);
public final static native String bdecode_node_list_string_value_at__SWIG_0(long jarg1, bdecode_node jarg1_, int jarg2, String jarg3);
public final static native String bdecode_node_list_string_value_at__SWIG_1(long jarg1, bdecode_node jarg1_, int jarg2);
public final static native long bdecode_node_list_int_value_at__SWIG_0(long jarg1, bdecode_node jarg1_, int jarg2, long jarg3);
Expand All @@ -2712,17 +2703,10 @@ public class libtorrent_jni {
public final static native int bdecode_node_dict_size(long jarg1, bdecode_node jarg1_);
public final static native long bdecode_node_int_value(long jarg1, bdecode_node jarg1_);
public final static native String bdecode_node_string_value(long jarg1, bdecode_node jarg1_);
public final static native String bdecode_node_string_ptr(long jarg1, bdecode_node jarg1_);
public final static native int bdecode_node_string_length(long jarg1, bdecode_node jarg1_);
public final static native void bdecode_node_clear(long jarg1, bdecode_node jarg1_);
public final static native void bdecode_node_swap(long jarg1, bdecode_node jarg1_, long jarg2, bdecode_node jarg2_);
public final static native void bdecode_node_reserve(long jarg1, bdecode_node jarg1_, int jarg2);
public final static native void bdecode_node_switch_underlying_buffer(long jarg1, bdecode_node jarg1_, String jarg2);
public final static native String bdecode_node_to_string(long jarg1, bdecode_node jarg1_, boolean jarg2, int jarg3);
public final static native int bdecode_node_bdecode(long jarg1, char_vector jarg1_, long jarg2, bdecode_node jarg2_, long jarg3, error_code jarg3_);
public final static native void delete_bdecode_node(long jarg1);
public final static native String print_entry__SWIG_0(long jarg1, bdecode_node jarg1_, boolean jarg2, int jarg3);
public final static native String print_entry__SWIG_1(long jarg1, bdecode_node jarg1_, boolean jarg2);
public final static native String print_entry__SWIG_2(long jarg1, bdecode_node jarg1_);
public final static native String make_magnet_uri__SWIG_0(long jarg1, torrent_handle jarg1_);
public final static native String make_magnet_uri__SWIG_1(long jarg1, torrent_info jarg1_);
public final static native void parse_magnet_uri(String jarg1, long jarg2, add_torrent_params jarg2_, long jarg3, error_code jarg3_);
Expand Down
16 changes: 12 additions & 4 deletions swig/libtorrent.i
Expand Up @@ -356,7 +356,6 @@ namespace std {
typedef long time_t;

namespace std {
%template(char_const_ptr_int_pair) pair<const char *, int>;
%template(int_int_pair) pair<int, int>;
%template(string_int_pair) pair<std::string, int>;
%template(string_string_pair) pair<std::string, std::string>;
Expand Down Expand Up @@ -446,6 +445,7 @@ namespace std {
%ignore libtorrent::block_cache_reference;
%ignore libtorrent::torrent_hot_members;
%ignore libtorrent::storage_piece_set;
%ignore libtorrent::print_entry;

%ignore libtorrent::to_string(size_type);
%ignore libtorrent::read_until;
Expand Down Expand Up @@ -573,10 +573,14 @@ namespace std {
%ignore libtorrent::peer_plugin::on_extended;
%ignore libtorrent::peer_plugin::on_unknown_message;
%ignore libtorrent::bdecode_node::dict_find(char const *) const;
%ignore libtorrent::bdecode_node::list_at(int) const;
%ignore libtorrent::bdecode_node::dict_find(std::string const &);
%ignore libtorrent::bdecode_node::dict_find(std::string const &) const;
%ignore libtorrent::bdecode_node::dict_find_dict(char const *) const;
%ignore libtorrent::bdecode_node::non_owning;
%ignore libtorrent::bdecode_node::data_section;
%ignore libtorrent::bdecode_node::string_ptr;
%ignore libtorrent::bdecode_node::clear;
%ignore libtorrent::bdecode_node::swap;
%ignore libtorrent::bdecode_node::reserve;
%ignore libtorrent::bdecode_node::switch_underlying_buffer;
%ignore libtorrent::errors::make_error_code;
%ignore libtorrent::bdecode_errors::make_error_code;
%ignore libtorrent::set_bits;
Expand Down Expand Up @@ -1023,6 +1027,10 @@ namespace libtorrent {
};

%extend bdecode_node {
static std::string to_string(bdecode_node const& e, bool single_line, int indent) {
return libtorrent::print_entry(e, single_line, indent);
}

static int bdecode(std::vector<char>& buffer, bdecode_node& ret, error_code& ec) {
return libtorrent::bdecode(&buffer[0], &buffer[0] + buffer.size(), ret, ec);
}
Expand Down

0 comments on commit 229199f

Please sign in to comment.