Skip to content

Commit

Permalink
Swig cleanup and doc
Browse files Browse the repository at this point in the history
  • Loading branch information
aldenml committed Apr 29, 2016
1 parent 6b6fa81 commit ea98794
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 28 deletions.
74 changes: 73 additions & 1 deletion src/main/java/com/frostwire/jlibtorrent/Address.java
Expand Up @@ -13,10 +13,19 @@ public final class Address implements Comparable<Address> {

private final address addr;

/**
* @param addr
*/
public Address(address addr) {
this.addr = addr;
}

/**
* Create an address from an IPv4 address string in dotted decimal form,
* or from an IPv6 address in hexadecimal notation.
*
* @param ip
*/
public Address(String ip) {
error_code ec = new error_code();
this.addr = address.from_string(ip, ec);
Expand All @@ -25,48 +34,111 @@ public Address(String ip) {
}
}

/**
*
*/
public Address() {
this(new address());
}

/**
* @return
*/
public address swig() {
return addr;
}

/**
* Get whether the address is an IP version 4 address.
*
* @return
*/
public boolean isV4() {
return addr.is_v4();
}

/**
* Get whether the address is an IP version 6 address.
*
* @return
*/
public boolean isV6() {
return addr.is_v6();
}

/**
* Get the address as an IP version 4 address.
*
* @return
*/
public address_v4 toV4() {
return addr.to_v4();
}

/**
* Get the address as an IP version 6 address.
*
* @return
*/
public address_v6 toV6() {
return addr.to_v6();
}

/**
* Determine whether the address is a loopback address.
*
* @return
*/
public boolean isLoopback() {
return addr.is_loopback();
}

/**
* Determine whether the address is unspecified.
*
* @return
*/
public boolean isUnspecified() {
return addr.is_unspecified();
}

/**
* Determine whether the address is a multicast address.
*
* @return
*/
public boolean isMulticast() {
return addr.is_multicast();
}

/**
* Compare addresses for ordering.
*
* @param o
* @return
*/
@Override
public int compareTo(Address o) {
return compare(this, o);
}

/**
* Get the address as a string in dotted decimal format.
*
* @return
*/
@Override
public String toString() {
return toString(addr);
}

/**
* Compare addresses for ordering.
*
* @param a1
* @param a2
* @return
*/
public static int compare(Address a1, Address a2) {
return address.compare(a1.addr, a2.addr);
}
Expand All @@ -75,7 +147,7 @@ static String toString(address a) {
error_code ec = new error_code();
String s = a.to_string(ec);
if (ec.value() != 0) {
s = "invalid";
s = "<invalid address>";
}
return s;
}
Expand Down
8 changes: 0 additions & 8 deletions swig/libtorrent.i
Expand Up @@ -53,7 +53,6 @@
#include "libtorrent/alert.hpp"
#include "libtorrent/alert_types.hpp"
#include "libtorrent/alert_manager.hpp"
#include "libtorrent/disk_io_thread.hpp"
#include "libtorrent/peer_info.hpp"
#include "libtorrent/session_status.hpp"
#include "libtorrent/session_settings.hpp"
Expand Down Expand Up @@ -299,11 +298,7 @@ namespace std {
%ignore get_file_attributes;
%ignore get_symlink_path;

%ignore libtorrent::partial_hash;
%ignore libtorrent::piece_manager;
%ignore libtorrent::disk_io_thread;
%ignore libtorrent::cached_piece_info;
%ignore libtorrent::cache_status;
%ignore libtorrent::request_callback;
%ignore libtorrent::timeout_handler;
%ignore libtorrent::parse_int;
Expand All @@ -324,7 +319,6 @@ namespace std {
%ignore libtorrent::time_critical_piece;
%ignore libtorrent::disk_buffer_pool;
%ignore libtorrent::buffer_allocator_interface;
%ignore libtorrent::block_cache_reference;
%ignore libtorrent::torrent_hot_members;
%ignore libtorrent::storage_piece_set;
%ignore libtorrent::print_entry;
Expand Down Expand Up @@ -508,7 +502,6 @@ namespace std {
%ignore libtorrent::detail::nop;
%ignore libtorrent::storage_params::pool;
%ignore libtorrent::storage_params::priorities;
%ignore libtorrent::cached_piece_info::storage;
%ignore libtorrent::ipv6_peer::addr;
%ignore libtorrent::announce_entry::failed;
%ignore libtorrent::announce_entry::next_announce;
Expand Down Expand Up @@ -623,7 +616,6 @@ namespace std {
%include "libtorrent/alert.hpp"
%include "libtorrent/alert_types.hpp"
%include "libtorrent/alert_manager.hpp"
%include "libtorrent/disk_io_thread.hpp"
%include "libtorrent/peer_info.hpp"
%include "libtorrent/session_status.hpp"
%include "libtorrent/session_settings.hpp"
Expand Down
3 changes: 1 addition & 2 deletions swig/libtorrent_jni.cpp
Expand Up @@ -710,7 +710,6 @@ namespace Swig {
#include "libtorrent/alert.hpp"
#include "libtorrent/alert_types.hpp"
#include "libtorrent/alert_manager.hpp"
#include "libtorrent/disk_io_thread.hpp"
#include "libtorrent/peer_info.hpp"
#include "libtorrent/session_status.hpp"
#include "libtorrent/session_settings.hpp"
Expand Down Expand Up @@ -60503,7 +60502,7 @@ SWIGEXPORT jstring JNICALL Java_com_frostwire_jlibtorrent_swig_libtorrent_1jni_J

(void)jenv;
(void)jcls;
result = (char *)("9a14a73fb524da7ddc572c91c7f311c617c70072");
result = (char *)("6b6fa8142786e5d5778fe4a3855e54c84413e099");
if (result) jresult = jenv->NewStringUTF((const char *)result);
return jresult;
}
Expand Down
28 changes: 11 additions & 17 deletions swig/libtorrent_node.cpp
Expand Up @@ -1690,17 +1690,16 @@ SWIGRUNTIME void JS_veto_set_variable(v8::Local<v8::String> property, v8::Local<
#define SWIGTYPE_p_swig_plugin swig_types[209]
#define SWIGTYPE_p_swig_storage swig_types[210]
#define SWIGTYPE_p_swig_torrent_plugin swig_types[211]
#define SWIGTYPE_p_tailqueueT_libtorrent__disk_io_job_t swig_types[212]
#define SWIGTYPE_p_tcp__endpoint swig_types[213]
#define SWIGTYPE_p_udp__endpoint swig_types[214]
#define SWIGTYPE_p_unsigned_char swig_types[215]
#define SWIGTYPE_p_unsigned_int swig_types[216]
#define SWIGTYPE_p_unsigned_long_long swig_types[217]
#define SWIGTYPE_p_unsigned_short swig_types[218]
#define SWIGTYPE_p_unspecified_bool_type swig_types[219]
#define SWIGTYPE_p_value_type swig_types[220]
static swig_type_info *swig_types[222];
static swig_module_info swig_module = {swig_types, 221, 0, 0, 0, 0};
#define SWIGTYPE_p_tcp__endpoint swig_types[212]
#define SWIGTYPE_p_udp__endpoint swig_types[213]
#define SWIGTYPE_p_unsigned_char swig_types[214]
#define SWIGTYPE_p_unsigned_int swig_types[215]
#define SWIGTYPE_p_unsigned_long_long swig_types[216]
#define SWIGTYPE_p_unsigned_short swig_types[217]
#define SWIGTYPE_p_unspecified_bool_type swig_types[218]
#define SWIGTYPE_p_value_type swig_types[219]
static swig_type_info *swig_types[221];
static swig_module_info swig_module = {swig_types, 220, 0, 0, 0, 0};
#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)

Expand Down Expand Up @@ -1749,7 +1748,6 @@ static swig_module_info swig_module = {swig_types, 221, 0, 0, 0, 0};
#include "libtorrent/alert.hpp"
#include "libtorrent/alert_types.hpp"
#include "libtorrent/alert_manager.hpp"
#include "libtorrent/disk_io_thread.hpp"
#include "libtorrent/peer_info.hpp"
#include "libtorrent/session_status.hpp"
#include "libtorrent/session_settings.hpp"
Expand Down Expand Up @@ -102361,7 +102359,7 @@ static SwigV8ReturnValue _wrap_JLIBTORRENT_REVISION_SHA1(v8::Local<v8::String> p

v8::Handle<v8::Value> jsresult;

jsresult = SWIG_FromCharPtr((const char *)"9a14a73fb524da7ddc572c91c7f311c617c70072");
jsresult = SWIG_FromCharPtr((const char *)"6b6fa8142786e5d5778fe4a3855e54c84413e099");

SWIGV8_RETURN_INFO(jsresult, info);

Expand Down Expand Up @@ -108045,7 +108043,6 @@ static swig_type_info _swigt__p_swig_peer_plugin = {"_p_swig_peer_plugin", "p_sw
static swig_type_info _swigt__p_swig_plugin = {"_p_swig_plugin", "p_swig_plugin|swig_plugin *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_swig_storage = {"_p_swig_storage", "swig_storage *|p_swig_storage", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_swig_torrent_plugin = {"_p_swig_torrent_plugin", "p_swig_torrent_plugin|swig_torrent_plugin *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_tailqueueT_libtorrent__disk_io_job_t = {"_p_tailqueueT_libtorrent__disk_io_job_t", "tailqueue< libtorrent::disk_io_job > *|libtorrent::jobqueue_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_tcp__endpoint = {"_p_tcp__endpoint", "std::vector< tcp::endpoint >::value_type *|tcp::endpoint *|p_tcp__endpoint", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_udp__endpoint = {"_p_udp__endpoint", "udp::endpoint *|p_udp__endpoint", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_unsigned_char = {"_p_unsigned_char", "unsigned char *|libtorrent::peer_class_t *|uint_least8_t *|uint_fast8_t *|uint8_t *", 0, 0, (void*)0, 0};
Expand Down Expand Up @@ -108268,7 +108265,6 @@ static swig_type_info *swig_type_initial[] = {
&_swigt__p_swig_plugin,
&_swigt__p_swig_storage,
&_swigt__p_swig_torrent_plugin,
&_swigt__p_tailqueueT_libtorrent__disk_io_job_t,
&_swigt__p_tcp__endpoint,
&_swigt__p_udp__endpoint,
&_swigt__p_unsigned_char,
Expand Down Expand Up @@ -108491,7 +108487,6 @@ static swig_cast_info _swigc__p_swig_peer_plugin[] = { {&_swigt__p_swig_peer_pl
static swig_cast_info _swigc__p_swig_plugin[] = { {&_swigt__p_swig_plugin, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_swig_storage[] = { {&_swigt__p_swig_storage, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_swig_torrent_plugin[] = { {&_swigt__p_swig_torrent_plugin, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_tailqueueT_libtorrent__disk_io_job_t[] = { {&_swigt__p_tailqueueT_libtorrent__disk_io_job_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_tcp__endpoint[] = { {&_swigt__p_tcp__endpoint, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_udp__endpoint[] = { {&_swigt__p_udp__endpoint, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_unsigned_char[] = { {&_swigt__p_unsigned_char, 0, 0, 0},{0, 0, 0, 0}};
Expand Down Expand Up @@ -108714,7 +108709,6 @@ static swig_cast_info *swig_cast_initial[] = {
_swigc__p_swig_plugin,
_swigc__p_swig_storage,
_swigc__p_swig_torrent_plugin,
_swigc__p_tailqueueT_libtorrent__disk_io_job_t,
_swigc__p_tcp__endpoint,
_swigc__p_udp__endpoint,
_swigc__p_unsigned_char,
Expand Down

0 comments on commit ea98794

Please sign in to comment.