mirror of https://github.com/kiwix/libkiwix.git
commit
cc2b5e63ca
|
@ -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) \
|
||||||
{ \
|
{ \
|
||||||
|
@ -68,7 +78,7 @@ GETTER(jstring, getFaviconUrl)
|
||||||
GETTER(jstring, getFaviconMimeType)
|
GETTER(jstring, getFaviconMimeType)
|
||||||
|
|
||||||
METHOD(jstring, Book, getTagStr, jstring tagName) try {
|
METHOD(jstring, Book, getTagStr, jstring tagName) try {
|
||||||
auto cRet = Book->getTagStr(jni2c(tagName, env));
|
auto cRet = BOOK->getTagStr(jni2c(tagName, env));
|
||||||
return c2jni(cRet, env);
|
return c2jni(cRet, env);
|
||||||
} catch(...) {
|
} catch(...) {
|
||||||
return c2jni<std::string>("", env);
|
return c2jni<std::string>("", env);
|
||||||
|
|
|
@ -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(); }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue