mirror of
https://github.com/kiwix/java-libkiwix.git
synced 2025-09-11 08:08:46 -04:00
Make METHOD
macro not using libzim by default.
(Adapt only libzim part)
This commit is contained in:
parent
4e840ba5a9
commit
ee5a6b3eeb
@ -116,8 +116,7 @@ Java_org_kiwix_libzim_Archive_dispose(JNIEnv* env, jobject thisObj)
|
||||
}
|
||||
|
||||
#define THIS GET_PTR(zim::Archive)
|
||||
#define GETTER(retType, name) JNIEXPORT retType JNICALL \
|
||||
Java_org_kiwix_libzim_Archive_##name (JNIEnv* env, jobject thisObj) \
|
||||
#define GETTER(retType, name) METHOD0(retType, libzim_Archive, name) \
|
||||
{ \
|
||||
return TO_JNI(THIS->name()); \
|
||||
}
|
||||
@ -130,15 +129,15 @@ GETTER(jint, getEntryCount)
|
||||
GETTER(jint, getArticleCount)
|
||||
GETTER(jint, getMediaCount)
|
||||
|
||||
METHOD0(jstring, Archive, getUuid) {
|
||||
METHOD0(jstring, libzim_Archive, getUuid) {
|
||||
return TO_JNI(std::string(THIS->getUuid()));
|
||||
}
|
||||
|
||||
METHOD(jstring, Archive, getMetadata, jstring name) {
|
||||
METHOD(jstring, libzim_Archive, getMetadata, jstring name) {
|
||||
return TO_JNI(THIS->getMetadata(TO_C(name)));
|
||||
}
|
||||
|
||||
METHOD(jobject, Archive, getMetadataItem, jstring name) {
|
||||
METHOD(jobject, libzim_Archive, getMetadataItem, jstring name) {
|
||||
auto obj = NEW_OBJECT("org/kiwix/libzim/Item");
|
||||
SET_HANDLE(zim::Item, obj, THIS->getMetadataItem(TO_C(name)));
|
||||
return obj;
|
||||
@ -146,71 +145,71 @@ METHOD(jobject, Archive, getMetadataItem, jstring name) {
|
||||
|
||||
GETTER(jobjectArray, getMetadataKeys)
|
||||
|
||||
METHOD(jobject, Archive, getIllustrationItem, jint size) {
|
||||
METHOD(jobject, libzim_Archive, getIllustrationItem, jint size) {
|
||||
auto obj = NEW_OBJECT("org/kiwix/libzim/Item");
|
||||
SET_HANDLE(zim::Item, obj, THIS->getIllustrationItem(TO_C(size)));
|
||||
return obj;
|
||||
}
|
||||
|
||||
METHOD(jboolean, Archive, hasIllustration, jint size) {
|
||||
METHOD(jboolean, libzim_Archive, hasIllustration, jint size) {
|
||||
return TO_JNI(THIS->hasIllustration(TO_C(size)));
|
||||
}
|
||||
|
||||
GETTER(jlongArray, getIllustrationSizes)
|
||||
|
||||
METHOD(jobject, Archive, getEntryByPath, jlong index) {
|
||||
METHOD(jobject, libzim_Archive, getEntryByPath, jlong index) {
|
||||
auto obj = NEW_OBJECT("org/kiwix/libzim/Entry");
|
||||
SET_HANDLE(zim::Entry, obj, THIS->getEntryByPath(TO_C(index)));
|
||||
return obj;
|
||||
}
|
||||
|
||||
METHOD(jobject, Archive, getEntryByPath, jstring path) {
|
||||
METHOD(jobject, libzim_Archive, getEntryByPath, jstring path) {
|
||||
auto obj = NEW_OBJECT("org/kiwix/libzim/Entry");
|
||||
SET_HANDLE(zim::Entry, obj, THIS->getEntryByPath(TO_C(path)));
|
||||
return obj;
|
||||
}
|
||||
|
||||
METHOD(jobject, Archive, getEntryByTitle, jlong index) {
|
||||
METHOD(jobject, libzim_Archive, getEntryByTitle, jlong index) {
|
||||
auto obj = NEW_OBJECT("org/kiwix/libzim/Entry");
|
||||
SET_HANDLE(zim::Entry, obj, THIS->getEntryByTitle(TO_C(index)));
|
||||
return obj;
|
||||
}
|
||||
|
||||
METHOD(jobject, Archive, getEntryByTitle, jstring title) {
|
||||
METHOD(jobject, libzim_Archive, getEntryByTitle, jstring title) {
|
||||
auto obj = NEW_OBJECT("org/kiwix/libzim/Entry");
|
||||
SET_HANDLE(zim::Entry, obj, THIS->getEntryByTitle(TO_C(title)));
|
||||
return obj;
|
||||
}
|
||||
|
||||
METHOD(jobject, Archive, getEntryByClusterOrder, jlong index) {
|
||||
METHOD(jobject, libzim_Archive, getEntryByClusterOrder, jlong index) {
|
||||
auto obj = NEW_OBJECT("org/kiwix/libzim/Entry");
|
||||
SET_HANDLE(zim::Entry, obj, THIS->getEntryByClusterOrder(TO_C(index)));
|
||||
return obj;
|
||||
}
|
||||
|
||||
METHOD0(jobject, Archive, getMainEntry) {
|
||||
METHOD0(jobject, libzim_Archive, getMainEntry) {
|
||||
auto obj = NEW_OBJECT("org/kiwix/libzim/Entry");
|
||||
SET_HANDLE(zim::Entry, obj, THIS->getMainEntry());
|
||||
return obj;
|
||||
}
|
||||
|
||||
METHOD0(jobject, Archive, getRandomEntry) {
|
||||
METHOD0(jobject, libzim_Archive, getRandomEntry) {
|
||||
auto obj = NEW_OBJECT("org/kiwix/libzim/Entry");
|
||||
SET_HANDLE(zim::Entry, obj, THIS->getRandomEntry());
|
||||
return obj;
|
||||
}
|
||||
|
||||
METHOD(jboolean, Archive, hasEntryByPath, jstring path) {
|
||||
METHOD(jboolean, libzim_Archive, hasEntryByPath, jstring path) {
|
||||
return TO_JNI(THIS->hasEntryByPath(TO_C(path)));
|
||||
}
|
||||
|
||||
METHOD(jboolean, Archive, hasEntryByTitle, jstring title) {
|
||||
METHOD(jboolean, libzim_Archive, hasEntryByTitle, jstring title) {
|
||||
return TO_JNI(THIS->hasEntryByPath(TO_C(title)));
|
||||
}
|
||||
|
||||
GETTER(jboolean, hasMainEntry)
|
||||
|
||||
METHOD(jboolean, Archive, hasIllustration, jlong size) {
|
||||
METHOD(jboolean, libzim_Archive, hasIllustration, jlong size) {
|
||||
return TO_JNI(THIS->hasIllustration(TO_C(size)));
|
||||
}
|
||||
|
||||
@ -226,7 +225,7 @@ GETTER(jboolean, hasNewNamespaceScheme)
|
||||
#define ITER_BY_PATH 0
|
||||
#define ITER_BY_TITLE 1
|
||||
#define ITER_EFFICIENT 2
|
||||
METHOD0(jobject, Archive, iterByPath) {
|
||||
METHOD0(jobject, libzim_Archive, iterByPath) {
|
||||
auto range = THIS->iterByPath();
|
||||
jclass objClass = env->FindClass("org/kiwix/libzim/EntryIterator");
|
||||
jmethodID initMethod = env->GetMethodID(objClass, "<init>", "(I)V");
|
||||
@ -238,7 +237,7 @@ METHOD0(jobject, Archive, iterByPath) {
|
||||
return obj;
|
||||
}
|
||||
|
||||
METHOD0(jobject, Archive, iterByTitle) {
|
||||
METHOD0(jobject, libzim_Archive, iterByTitle) {
|
||||
auto range = THIS->iterByTitle();
|
||||
jclass objClass = env->FindClass("org/kiwix/libzim/EntryIterator");
|
||||
jmethodID initMethod = env->GetMethodID(objClass, "<init>", "(I)V");
|
||||
@ -250,7 +249,7 @@ METHOD0(jobject, Archive, iterByTitle) {
|
||||
return obj;
|
||||
}
|
||||
|
||||
METHOD0(jobject, Archive, iterEfficient) {
|
||||
METHOD0(jobject, libzim_Archive, iterEfficient) {
|
||||
auto range = THIS->iterEfficient();
|
||||
jclass objClass = env->FindClass("org/kiwix/libzim/EntryIterator");
|
||||
jmethodID initMethod = env->GetMethodID(objClass, "<init>", "(I)V");
|
||||
@ -262,7 +261,7 @@ METHOD0(jobject, Archive, iterEfficient) {
|
||||
return obj;
|
||||
}
|
||||
|
||||
METHOD(jobject, Archive, findByPath, jstring path) {
|
||||
METHOD(jobject, libzim_Archive, findByPath, jstring path) {
|
||||
auto range = THIS->findByPath(TO_C(path));
|
||||
jclass objClass = env->FindClass("org/kiwix/libzim/EntryIterator");
|
||||
jmethodID initMethod = env->GetMethodID(objClass, "<init>", "(I)V");
|
||||
@ -274,7 +273,7 @@ METHOD(jobject, Archive, findByPath, jstring path) {
|
||||
return obj;
|
||||
}
|
||||
|
||||
METHOD(jobject, Archive, findByTitle, jstring title) {
|
||||
METHOD(jobject, libzim_Archive, findByTitle, jstring title) {
|
||||
auto range = THIS->findByTitle(TO_C(title));
|
||||
jclass objClass = env->FindClass("org/kiwix/libzim/EntryIterator");
|
||||
jmethodID initMethod = env->GetMethodID(objClass, "<init>", "(I)V");
|
||||
|
@ -36,13 +36,12 @@ Java_org_kiwix_kiwixlib_libzim_Blob_dispose(JNIEnv* env, jobject thisObj)
|
||||
dispose<NATIVE_TYPE>(env, thisObj);
|
||||
}
|
||||
#define THIS GET_PTR(NATIVE_TYPE)
|
||||
#define GETTER(retType, name) JNIEXPORT retType JNICALL \
|
||||
Java_org_kiwix_libzim_Blob__##name (JNIEnv* env, jobject thisObj) \
|
||||
#define GETTER(retType, name) METHOD0(retType, libzim_Blob, name) \
|
||||
{ \
|
||||
return TO_JNI(THIS->name()); \
|
||||
}
|
||||
|
||||
METHOD0(jstring, Blob, getData) {
|
||||
METHOD0(jstring, libzim_Blob, getData) {
|
||||
return TO_JNI(std::string(*THIS));
|
||||
}
|
||||
GETTER(jlong, size)
|
||||
|
@ -38,8 +38,7 @@ Java_org_kiwix_kiwixlib_libzim_Entry_dispose(JNIEnv* env, jobject thisObj)
|
||||
}
|
||||
|
||||
#define THIS GET_PTR(NATIVE_TYPE)
|
||||
#define GETTER(retType, name) JNIEXPORT retType JNICALL \
|
||||
Java_org_kiwix_libzim_Entry__##name (JNIEnv* env, jobject thisObj) \
|
||||
#define GETTER(retType, name) METHOD0(retType, libzim_Entry, name) \
|
||||
{ \
|
||||
return TO_JNI(THIS->name()); \
|
||||
}
|
||||
@ -48,19 +47,19 @@ Java_org_kiwix_libzim_Entry__##name (JNIEnv* env, jobject thisObj) \
|
||||
GETTER(jboolean, isRedirect)
|
||||
GETTER(jstring, getTitle)
|
||||
GETTER(jstring, getPath)
|
||||
METHOD(jobject, Entry, getItem, jboolean follow) {
|
||||
METHOD(jobject, libzim_Entry, getItem, jboolean follow) {
|
||||
auto obj = NEW_OBJECT("org/kiwix/libzim/Item");
|
||||
SET_HANDLE(zim::Item, obj, THIS->getItem(TO_C(follow)));
|
||||
return obj;
|
||||
}
|
||||
|
||||
METHOD0(jobject, Entry, getRedirect) {
|
||||
METHOD0(jobject, libzim_Entry, getRedirect) {
|
||||
auto obj = NEW_OBJECT("org/kiwix/libzim/Item");
|
||||
SET_HANDLE(zim::Item, obj, THIS->getRedirect());
|
||||
return obj;
|
||||
}
|
||||
|
||||
METHOD0(jobject, Entry, getRedirectEntry) {
|
||||
METHOD0(jobject, libzim_Entry, getRedirectEntry) {
|
||||
auto obj = NEW_OBJECT("org/kiwix/libzim/Entry");
|
||||
SET_HANDLE(zim::Entry, obj, THIS->getRedirectEntry());
|
||||
return obj;
|
||||
|
@ -39,8 +39,7 @@ inline int get_order(JNIEnv* env, jobject thisObj) {
|
||||
return TO_C(env->GetIntField(thisObj, fieldId));
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_kiwix_kiwixlib_libzim_EntryIterotar_dispose(JNIEnv* env, jobject thisObj)
|
||||
METHOD0(void, libzim_EntryIterotar, dispose)
|
||||
{
|
||||
// Delete end iterator
|
||||
switch (get_order(env, thisObj)) {
|
||||
@ -60,7 +59,7 @@ Java_org_kiwix_kiwixlib_libzim_EntryIterotar_dispose(JNIEnv* env, jobject thisOb
|
||||
}
|
||||
|
||||
|
||||
METHOD0(jboolean, EntryIterator, hasNext) {
|
||||
METHOD0(jboolean, libzim_EntryIterator, hasNext) {
|
||||
switch (get_order(env, thisObj)) {
|
||||
case 0: {
|
||||
PATH_NATIVE_TYPE next(*GET_PTR(PATH_NATIVE_TYPE));
|
||||
@ -83,7 +82,7 @@ METHOD0(jboolean, EntryIterator, hasNext) {
|
||||
}
|
||||
}
|
||||
|
||||
METHOD0(jobject, EntryIterator, next) {
|
||||
METHOD0(jobject, libzim_EntryIterator, next) {
|
||||
switch (get_order(env, thisObj)) {
|
||||
case 0: {
|
||||
(*GET_PTR(PATH_NATIVE_TYPE))++;
|
||||
|
@ -37,8 +37,7 @@ Java_org_kiwix_kiwixlib_libzim_Item_dispose(JNIEnv* env, jobject thisObj)
|
||||
}
|
||||
|
||||
#define THIS GET_PTR(NATIVE_TYPE)
|
||||
#define GETTER(retType, name) JNIEXPORT retType JNICALL \
|
||||
Java_org_kiwix_libzim_Item__##name (JNIEnv* env, jobject thisObj) \
|
||||
#define GETTER(retType, name) METHOD0(retType, libzim_Item, name) \
|
||||
{ \
|
||||
return TO_JNI(THIS->name()); \
|
||||
}
|
||||
@ -47,7 +46,7 @@ GETTER(jstring, getTitle)
|
||||
GETTER(jstring, getPath)
|
||||
GETTER(jstring, getMimetype)
|
||||
|
||||
METHOD0(jobject, Item, getData) {
|
||||
METHOD0(jobject, libzim_Item, getData) {
|
||||
auto obj = NEW_OBJECT("org/kiwix/libzim/Blob");
|
||||
SET_HANDLE(zim::Blob, obj, THIS->getData());
|
||||
return obj;
|
||||
|
@ -53,12 +53,12 @@ Java_org_kiwix_kiwixlib_libzim_Query_dispose(JNIEnv* env, jobject thisObj)
|
||||
|
||||
#define THIS GET_PTR(NATIVE_TYPE)
|
||||
|
||||
METHOD(jobject, Query, setQuery, jstring query) {
|
||||
METHOD(jobject, libzim_Query, setQuery, jstring query) {
|
||||
THIS->setQuery(TO_C(query));
|
||||
return thisObj;
|
||||
}
|
||||
|
||||
METHOD(jobject, Query, setGeorange, jfloat latitude, jfloat longitude, jfloat distance) {
|
||||
METHOD(jobject, libzim_Query, setGeorange, jfloat latitude, jfloat longitude, jfloat distance) {
|
||||
THIS->setGeorange(TO_C(latitude), TO_C(longitude), TO_C(distance));
|
||||
return thisObj;
|
||||
}
|
||||
|
@ -30,15 +30,14 @@
|
||||
|
||||
#define NATIVE_TYPE zim::Search
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_kiwix_kiwixlib_libzim_Search_dispose(JNIEnv* env, jobject thisObj)
|
||||
METHOD0(void, libzim_Search, dispose)
|
||||
{
|
||||
dispose<NATIVE_TYPE>(env, thisObj);
|
||||
}
|
||||
|
||||
#define THIS GET_PTR(NATIVE_TYPE)
|
||||
|
||||
METHOD(jobject, Search, getResults, jint start, jint maxResults) {
|
||||
METHOD(jobject, libzim_Search, getResults, jint start, jint maxResults) {
|
||||
auto results = THIS->getResults(TO_C(start), TO_C(maxResults));
|
||||
auto obj = NEW_OBJECT("ork/kiwix/libzim/SearchIterator");
|
||||
SET_HANDLE(zim::SearchIterator, obj, results.begin());
|
||||
@ -49,7 +48,7 @@ METHOD(jobject, Search, getResults, jint start, jint maxResults) {
|
||||
return obj;
|
||||
}
|
||||
|
||||
METHOD0(jlong, Search, getEstimatedMatches) {
|
||||
METHOD0(jlong, libzim_Search, getEstimatedMatches) {
|
||||
return TO_JNI(THIS->getEstimatedMatches());
|
||||
}
|
||||
|
||||
|
@ -31,8 +31,7 @@
|
||||
|
||||
#define NATIVE_TYPE zim::SearchIterator
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_kiwix_kiwixlib_libzim_SearchIterotar_dispose(JNIEnv* env, jobject thisObj)
|
||||
METHOD0(void, libzim_SearchIterator, dispose)
|
||||
{
|
||||
// Delete end iterator
|
||||
dispose<NATIVE_TYPE>(env, thisObj, "nativeHandleEnd");
|
||||
@ -40,8 +39,7 @@ Java_org_kiwix_kiwixlib_libzim_SearchIterotar_dispose(JNIEnv* env, jobject thisO
|
||||
}
|
||||
|
||||
#define THIS GET_PTR(NATIVE_TYPE)
|
||||
#define GETTER(retType, name) JNIEXPORT retType JNICALL \
|
||||
Java_org_kiwix_libzim_SearchIterator__##name (JNIEnv* env, jobject thisObj) \
|
||||
#define GETTER(retType, name) METHOD0(retType, libzim_SearchIterator, name) \
|
||||
{ \
|
||||
return TO_JNI(THIS->name()); \
|
||||
}
|
||||
@ -54,18 +52,18 @@ GETTER(jint, getWordCount)
|
||||
GETTER(jint, getFileIndex)
|
||||
GETTER(jint, getSize)
|
||||
|
||||
METHOD0(jstring, SearchIterator, getZimId) {
|
||||
METHOD0(jstring, libzim_SearchIterator, getZimId) {
|
||||
return TO_JNI(std::string(THIS->getZimId()));
|
||||
}
|
||||
|
||||
METHOD0(jboolean, SearchIterator, hasNext) {
|
||||
METHOD0(jboolean, libzim_SearchIterator, hasNext) {
|
||||
zim::SearchIterator next(*THIS);
|
||||
next++;
|
||||
auto end = getPtr<NATIVE_TYPE>(env, thisObj, "nativeHandleEnd");
|
||||
return next == *end;
|
||||
}
|
||||
|
||||
METHOD0(jobject, SearchIterator, next) {
|
||||
METHOD0(jobject, libzim_SearchIterator, next) {
|
||||
(*THIS)++;
|
||||
zim::Entry entry = **THIS;
|
||||
auto obj = NEW_OBJECT("org/kiwix/libzim/Entry");
|
||||
|
@ -46,33 +46,31 @@ JNIEXPORT void JNICALL Java_org_kiwix_libzim_Searcher_setNativeSearcher(
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_kiwix_kiwixlib_libzim_Searcher_dispose(JNIEnv* env, jobject thisObj)
|
||||
METHOD0(void, libzim_Searcher, dispose)
|
||||
{
|
||||
dispose<NATIVE_TYPE>(env, thisObj);
|
||||
}
|
||||
|
||||
#define THIS GET_PTR(NATIVE_TYPE)
|
||||
#define GETTER(retType, name) JNIEXPORT retType JNICALL \
|
||||
Java_org_kiwix_libzim_Searcher__##name (JNIEnv* env, jobject thisObj) \
|
||||
#define GETTER(retType, name) METHOD0(retType, libzim_Searcher, name) \
|
||||
{ \
|
||||
return TO_JNI(THIS->name()); \
|
||||
}
|
||||
|
||||
METHOD(jobject, Searcher, addArchive, jobject archive) {
|
||||
METHOD(jobject, libzim_Searcher, addArchive, jobject archive) {
|
||||
auto cArchive = getPtr<zim::Archive>(env, archive);
|
||||
THIS->addArchive(*cArchive);
|
||||
return thisObj;
|
||||
}
|
||||
|
||||
METHOD(jobject, Searcher, search, jobject query) {
|
||||
METHOD(jobject, libzim_Searcher, search, jobject query) {
|
||||
auto cQuery = getPtr<zim::Query>(env, query);
|
||||
auto obj = NEW_OBJECT("org/kiwix/libzim/Search");
|
||||
SET_HANDLE(zim::Search, obj, THIS->search(*cQuery));
|
||||
return obj;
|
||||
}
|
||||
|
||||
METHOD(void, Searcher, setVerbose, jboolean verbose) {
|
||||
METHOD(void, libzim_Searcher, setVerbose, jboolean verbose) {
|
||||
THIS->setVerbose(TO_C(verbose));
|
||||
}
|
||||
|
||||
|
@ -30,15 +30,13 @@
|
||||
|
||||
#define NATIVE_TYPE zim::SuggestionItem
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_kiwix_kiwixlib_libzim_SuggestionItem_dispose(JNIEnv* env, jobject thisObj)
|
||||
METHOD0(void, libzim_SuggestionItem, dispose)
|
||||
{
|
||||
dispose<NATIVE_TYPE>(env, thisObj);
|
||||
}
|
||||
|
||||
#define THIS GET_PTR(NATIVE_TYPE)
|
||||
#define GETTER(retType, name) JNIEXPORT retType JNICALL \
|
||||
Java_org_kiwix_libzim_SuggestionItem__##name (JNIEnv* env, jobject thisObj) \
|
||||
#define GETTER(retType, name) METHOD0(retType, libzim_SuggestionItem, name) \
|
||||
{ \
|
||||
return TO_JNI(THIS->name()); \
|
||||
}
|
||||
|
@ -30,8 +30,7 @@
|
||||
|
||||
#define NATIVE_TYPE zim::SuggestionIterator
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_kiwix_kiwixlib_libzim_SuggestionIterator_dispose(JNIEnv* env, jobject thisObj)
|
||||
METHOD0(void, libzim_SuggestionIterator, dispose)
|
||||
{
|
||||
// Delete end iterator
|
||||
dispose<NATIVE_TYPE>(env, thisObj, "nativeHandleEnd");
|
||||
@ -39,20 +38,19 @@ Java_org_kiwix_kiwixlib_libzim_SuggestionIterator_dispose(JNIEnv* env, jobject t
|
||||
}
|
||||
|
||||
#define THIS GET_PTR(NATIVE_TYPE)
|
||||
#define GETTER(retType, name) JNIEXPORT retType JNICALL \
|
||||
Java_org_kiwix_libzim_SuggestionIterator__##name (JNIEnv* env, jobject thisObj) \
|
||||
#define GETTER(retType, name) METHOD0(retType, libzim_SuggestionIterator, name) \
|
||||
{ \
|
||||
return TO_JNI(THIS->name()); \
|
||||
}
|
||||
|
||||
METHOD0(jboolean, SearchIterator, hasNext) {
|
||||
METHOD0(jboolean, libzim_SearchIterator, hasNext) {
|
||||
NATIVE_TYPE next(*THIS);
|
||||
next++;
|
||||
auto end = getPtr<NATIVE_TYPE>(env, thisObj, "nativeHandleEnd");
|
||||
return next == *end;
|
||||
}
|
||||
|
||||
METHOD0(jobject, SearchIterator, next) {
|
||||
METHOD0(jobject, libzim_SearchIterator, next) {
|
||||
(*THIS)++;
|
||||
zim::SuggestionItem item = **THIS;
|
||||
auto obj = NEW_OBJECT("org/kiwix/libzim/SuggestionItem");
|
||||
|
@ -30,15 +30,14 @@
|
||||
|
||||
#define NATIVE_TYPE zim::SuggestionSearch
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_kiwix_kiwixlib_libzim_SuggestionSearch_dispose(JNIEnv* env, jobject thisObj)
|
||||
METHOD0(void, libzim_SuggestionSearch, dispose)
|
||||
{
|
||||
dispose<NATIVE_TYPE>(env, thisObj);
|
||||
}
|
||||
|
||||
#define THIS GET_PTR(NATIVE_TYPE)
|
||||
|
||||
METHOD(jobject, SuggestionSearch, getResults, jint start, jint maxResults) {
|
||||
METHOD(jobject, libzim_SuggestionSearch, getResults, jint start, jint maxResults) {
|
||||
auto results = THIS->getResults(TO_C(start), TO_C(maxResults));
|
||||
auto obj = NEW_OBJECT("ork/kiwix/libzim/SuggestionIterator");
|
||||
SET_HANDLE(zim::SuggestionIterator, obj, results.begin());
|
||||
@ -49,7 +48,7 @@ METHOD(jobject, SuggestionSearch, getResults, jint start, jint maxResults) {
|
||||
return obj;
|
||||
}
|
||||
|
||||
METHOD0(jlong, SuggestionSearch, getEstimatedMatches) {
|
||||
METHOD0(jlong, libzim_SuggestionSearch, getEstimatedMatches) {
|
||||
return TO_JNI(THIS->getEstimatedMatches());
|
||||
}
|
||||
|
||||
|
@ -46,26 +46,24 @@ JNIEXPORT void JNICALL Java_org_kiwix_libzim_SuggestionSearcher_setNativeSearche
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_kiwix_kiwixlib_libzim_SuggestionSearcher_dispose(JNIEnv* env, jobject thisObj)
|
||||
METHOD0(void, libzim_SuggestionSearcher, dispose)
|
||||
{
|
||||
dispose<NATIVE_TYPE>(env, thisObj);
|
||||
}
|
||||
|
||||
#define THIS GET_PTR(NATIVE_TYPE)
|
||||
#define GETTER(retType, name) JNIEXPORT retType JNICALL \
|
||||
Java_org_kiwix_libzim_SuggestionSearcher__##name (JNIEnv* env, jobject thisObj) \
|
||||
#define GETTER(retType, name) METHOD0(retType, libzim_SuggestionSearcher, name) \
|
||||
{ \
|
||||
return TO_JNI(THIS->name()); \
|
||||
}
|
||||
|
||||
METHOD(jobject, SuggestionSearcher, suggest, jstring query) {
|
||||
METHOD(jobject, libzim_SuggestionSearcher, suggest, jstring query) {
|
||||
auto obj = NEW_OBJECT("org/kiwix/libzim/SuggestionSearch");
|
||||
SET_HANDLE(zim::SuggestionSearch, obj, THIS->suggest(TO_C(query)));
|
||||
return obj;
|
||||
}
|
||||
|
||||
METHOD(void, SuggestionSearcher, setVerbose, jboolean verbose) {
|
||||
METHOD(void, libzim_SuggestionSearcher, setVerbose, jboolean verbose) {
|
||||
THIS->setVerbose(TO_C(verbose));
|
||||
}
|
||||
|
||||
|
@ -109,11 +109,11 @@ void dispose(JNIEnv* env, jobject thisObj, const char* handleName = "nativeHandl
|
||||
}
|
||||
|
||||
#define METHOD0(retType, class, name) \
|
||||
JNIEXPORT retType JNICALL Java_org_kiwix_libzim_##class##_##name( \
|
||||
JNIEXPORT retType JNICALL Java_org_kiwix_##class##_##name( \
|
||||
JNIEnv* env, jobject thisObj)
|
||||
|
||||
#define METHOD(retType, class, name, ...) \
|
||||
JNIEXPORT retType JNICALL Java_org_kiwix_libzim_##class##_##name( \
|
||||
JNIEXPORT retType JNICALL Java_org_kiwix_##class##_##name( \
|
||||
JNIEnv* env, jobject thisObj, __VA_ARGS__)
|
||||
|
||||
inline jfieldID getHandleField(JNIEnv* env, jobject obj, const char* handleName)
|
||||
|
Loading…
x
Reference in New Issue
Block a user