[Java] Add a wrapper on method to update book from another book or reader.

This commit is contained in:
Matthieu Gautier 2020-02-11 17:38:15 +01:00
parent b53f531f2b
commit ea29557a33
2 changed files with 14 additions and 0 deletions

View File

@ -39,6 +39,16 @@ Java_org_kiwix_kiwixlib_Book_dispose(JNIEnv* env, jobject thisObj)
#define BOOK (getPtr<kiwix::Book>(env, thisObj)) #define BOOK (getPtr<kiwix::Book>(env, thisObj))
METHOD(void, Book, update__Lorg_kiwix_kiwixlib_Book_2, jobject otherBook)
{
BOOK->update(*getPtr<kiwix::Book>(env, otherBook));
}
METHOD(void, Book, update__Lorg_kiwix_kiwixlib_JNIKiwixReader_2, jobject reader)
{
BOOK->update(**Handle<kiwix::Reader>::getHandle(env, reader));
}
#define GETTER(retType, name) JNIEXPORT retType JNICALL \ #define GETTER(retType, name) JNIEXPORT retType JNICALL \
Java_org_kiwix_kiwixlib_Book_##name (JNIEnv* env, jobject thisObj) \ Java_org_kiwix_kiwixlib_Book_##name (JNIEnv* env, jobject thisObj) \
{ \ { \

View File

@ -5,6 +5,10 @@ public class Book
{ {
public Book() { allocate(); } public Book() { allocate(); }
public native void update(Book book);
public native void update(JNIKiwixReader reader);
@Override @Override
protected void finalize() { dispose(); } protected void finalize() { dispose(); }