|
| 1 | +/* |
| 2 | + * Copyright (C) 2019-2020 Matthieu Gautier <mgautier@kymeria.fr> |
| 3 | + * |
| 4 | + * This program is free software; you can redistribute it and/or modify |
| 5 | + * it under the terms of the GNU General Public License as published by |
| 6 | + * the Free Software Foundation; either version 3 of the License, or |
| 7 | + * any later version. |
| 8 | + * |
| 9 | + * This program is distributed in the hope that it will be useful, |
| 10 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | + * GNU General Public License for more details. |
| 13 | + * |
| 14 | + * You should have received a copy of the GNU General Public License |
| 15 | + * along with this program; if not, write to the Free Software |
| 16 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
| 17 | + * MA 02110-1301, USA. |
| 18 | + */ |
| 19 | + |
| 20 | +package org.kiwix.test.libkiwix; |
| 21 | + |
| 22 | +import org.kiwix.libkiwix.Library; |
| 23 | +import org.kiwix.test.libzim.TestArchive; |
| 24 | +import org.kiwix.libzim.Searcher; |
| 25 | +import org.kiwix.libkiwix.Filter; |
| 26 | +import org.kiwix.libkiwix.Book; |
| 27 | +import org.kiwix.libkiwix.JNIKiwixException; |
| 28 | +import org.kiwix.libkiwix.Bookmark; |
| 29 | + |
| 30 | +public class TestLibrary |
| 31 | +{ |
| 32 | + private Library inner; |
| 33 | + public Library inner() { return inner; } |
| 34 | + public TestLibrary() { inner = new Library(); } |
| 35 | + public TestLibrary(Library _inner) { inner = _inner; } |
| 36 | + public boolean addBook(TestBook book) throws JNIKiwixException { return inner.addBook(book.inner()); } |
| 37 | + |
| 38 | + public TestBook getBookById(String id) { return new TestBook(inner.getBookById(id)); } |
| 39 | + |
| 40 | + public TestArchive getArchiveById(String id) { return new TestArchive(inner.getArchiveById(id)); } |
| 41 | + //public native Searcher getSearcherById(String id); |
| 42 | + //public native Searcher getSearcherByIds(String ids[]); |
| 43 | + |
| 44 | + public boolean removeBookById(String id) { return inner.removeBookById(id); } |
| 45 | + |
| 46 | + public boolean writeToFile(String path) { return inner.writeToFile(path); } |
| 47 | + public boolean writeBookmarksToFile(String path) { return inner.writeBookmarksToFile(path); } |
| 48 | + |
| 49 | + public int getBookCount(boolean localBooks, boolean remoteBooks) { return inner.getBookCount(localBooks, remoteBooks); } |
| 50 | + |
| 51 | + public String[] getBooksIds() { return inner.getBooksIds(); } |
| 52 | + public String[] filter(Filter filter) { return inner.filter(filter); } |
| 53 | + |
| 54 | + public String[] getBooksLanguages() { return inner.getBooksLanguages(); } |
| 55 | + public String[] getBooksCategories() { return inner.getBooksCategories(); } |
| 56 | + public String[] getBooksCreators() { return inner.getBooksCreators(); } |
| 57 | + public String[] getBooksPublishers() { return inner.getBooksPublishers(); } |
| 58 | + |
| 59 | + public void addBookmark(Bookmark bookmark) { inner.addBookmark(bookmark); } |
| 60 | + public boolean removeBookmark(String zimId, String url) { return inner.removeBookmark(zimId, url); } |
| 61 | + public Bookmark[] getBookmarks(boolean onlyValidBookmarks) { return inner.getBookmarks(onlyValidBookmarks); } |
| 62 | +} |
0 commit comments