From 74bd4823359aeb69c0fe159fbec8744b149c3a16 Mon Sep 17 00:00:00 2001 From: Aditya-Sood Date: Wed, 3 Jul 2019 17:20:51 +0530 Subject: [PATCH 1/5] Preliminary work --- .idea/encodings.xml | 4 + .idea/kiwix-lib.iml | 9 + .idea/modules.xml | 8 + .idea/workspace.xml | 194 ++++++++++++++++++ .vscode/c_cpp_properties.json | 16 ++ .../ipch/68a3c1a579621cc7/mmap_address.bin | Bin 0 -> 8 bytes .../ipch/eae59a4735b0c0b5/mmap_address.bin | Bin 0 -> 8 bytes src/android/kiwixreader.cpp | 24 +++ .../org/kiwix/kiwixlib/JNIKiwixReader.java | 2 + 9 files changed, 257 insertions(+) create mode 100644 .idea/encodings.xml create mode 100644 .idea/kiwix-lib.iml create mode 100644 .idea/modules.xml create mode 100644 .idea/workspace.xml create mode 100644 .vscode/c_cpp_properties.json create mode 100644 .vscode/ipch/68a3c1a579621cc7/mmap_address.bin create mode 100644 .vscode/ipch/eae59a4735b0c0b5/mmap_address.bin diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 00000000..15a15b21 --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/kiwix-lib.iml b/.idea/kiwix-lib.iml new file mode 100644 index 00000000..d6ebd480 --- /dev/null +++ b/.idea/kiwix-lib.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 00000000..94813f59 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 00000000..aeff9e02 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,194 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - 1562150865430 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json deleted file mode 100644 index 0b0eed01..00000000 --- a/.vscode/c_cpp_properties.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "configurations": [ - { - "name": "Linux", - "includePath": [ - "${workspaceFolder}/**" - ], - "defines": [], - "compilerPath": "/usr/bin/gcc", - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "clang-x64" - } - ], - "version": 4 -} \ No newline at end of file diff --git a/.vscode/ipch/68a3c1a579621cc7/mmap_address.bin b/.vscode/ipch/68a3c1a579621cc7/mmap_address.bin deleted file mode 100644 index d17d016293ea490ae3171cd93e509b477fe0dab5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8 PcmZQzVEA&oo`C@X3AF-G diff --git a/.vscode/ipch/eae59a4735b0c0b5/mmap_address.bin b/.vscode/ipch/eae59a4735b0c0b5/mmap_address.bin deleted file mode 100644 index 5ed7d809d809cbe14e3b88a5b1e922e3c2241b2c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8 PcmZQzUgetNextSuggestion(cTitle)) { - setStringObjValue(cTitle, titleObj, env); - retVal = JNI_TRUE; - } - } catch (std::exception& e) { - __android_log_print(ANDROID_LOG_WARN, "kiwix", "Unable to get next suggestion"); - __android_log_print(ANDROID_LOG_WARN, "kiwix", e.what()); - } - - return retVal; -}*/ - JNIEXPORT jboolean JNICALL Java_org_kiwix_kiwixlib_JNIKiwixReader_getNextSuggestion(JNIEnv* env, jobject obj, diff --git a/src/android/org/kiwix/kiwixlib/JNIKiwixReader.java b/src/android/org/kiwix/kiwixlib/JNIKiwixReader.java index 9f27384a..0da29ed9 100644 --- a/src/android/org/kiwix/kiwixlib/JNIKiwixReader.java +++ b/src/android/org/kiwix/kiwixlib/JNIKiwixReader.java @@ -102,8 +102,6 @@ public class JNIKiwixReader public native boolean searchSuggestions(String prefix, int count); - /*public native boolean getNextSuggestion(JNIKiwixString title);*/ - public native boolean getNextSuggestion(JNIKiwixString title, JNIKiwixString url); public native boolean getPageUrlFromTitle(String title, JNIKiwixString url); diff --git a/src/reader.cpp b/src/reader.cpp index ef4e4533..4aa8cc64 100644 --- a/src/reader.cpp +++ b/src/reader.cpp @@ -901,22 +901,6 @@ bool Reader::searchSuggestionsSmart(const string& prefix, return retVal; } -/* Get next suggestion */ -// bool Reader::getNextSuggestion(string& title) -// { -// if (this->suggestionsOffset != this->suggestions.end()) { -// /* title */ -// title = (*(this->suggestionsOffset))[0]; - -// /* increment the cursor for the next call */ -// this->suggestionsOffset++; - -// return true; -// } - -// return false; -// } - bool Reader::getNextSuggestion(string& title, string& url) { if (this->suggestionsOffset != this->suggestions.end()) { From c007373b46e589c687d76fef5832f94bee3b4f37 Mon Sep 17 00:00:00 2001 From: Aditya-Sood Date: Sat, 24 Aug 2019 23:52:40 +0530 Subject: [PATCH 4/5] Re-add comment --- src/reader.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/reader.cpp b/src/reader.cpp index 4aa8cc64..2960e4ac 100644 --- a/src/reader.cpp +++ b/src/reader.cpp @@ -901,6 +901,7 @@ bool Reader::searchSuggestionsSmart(const string& prefix, return retVal; } +/* Get next suggestion */ bool Reader::getNextSuggestion(string& title, string& url) { if (this->suggestionsOffset != this->suggestions.end()) { From 2af9ba4eab33b986d6624773c6410d1d28ef50b4 Mon Sep 17 00:00:00 2001 From: Aditya-Sood Date: Thu, 26 Sep 2019 12:36:28 +0530 Subject: [PATCH 5/5] Readd original getNextSuggestion() --- src/reader.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/reader.cpp b/src/reader.cpp index 2960e4ac..87cedc55 100644 --- a/src/reader.cpp +++ b/src/reader.cpp @@ -902,6 +902,21 @@ bool Reader::searchSuggestionsSmart(const string& prefix, } /* Get next suggestion */ +bool Reader::getNextSuggestion(string& title) +{ + if (this->suggestionsOffset != this->suggestions.end()) { + /* title */ + title = (*(this->suggestionsOffset))[0]; + + /* increment the cursor for the next call */ + this->suggestionsOffset++; + + return true; + } + + return false; +} + bool Reader::getNextSuggestion(string& title, string& url) { if (this->suggestionsOffset != this->suggestions.end()) {