Format all the code using clang-format.

Add a script `format_code.sh` to easily format the code.
This commit is contained in:
Matthieu Gautier 2017-07-05 15:52:32 +02:00
parent 856bfc675a
commit 4e3ff03059
7 changed files with 697 additions and 562 deletions

12
.clang-format Normal file
View File

@ -0,0 +1,12 @@
BasedOnStyle: Google
BinPackArguments: false
BinPackParameters: false
BreakBeforeBinaryOperators: All
BreakBeforeBraces: Linux
DerivePointerAlignment: false
SpacesInContainerLiterals: false
Standard: Cpp11
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false

15
format_code.sh Executable file
View File

@ -0,0 +1,15 @@
#!/usr/bin/bash
files=(
"src/installer/kiwix-install.cpp"
"src/searcher/kiwix-search.cpp"
"src/reader/kiwix-read.cpp"
"src/manager/kiwix-manage.cpp"
"src/server/kiwix-serve.cpp"
)
for i in "${files[@]}"
do
echo $i
clang-format -i -style=file $i
done

View File

@ -19,21 +19,23 @@
#include <getopt.h> #include <getopt.h>
#include <kiwix/common/pathTools.h> #include <kiwix/common/pathTools.h>
#include <kiwix/reader.h>
#include <kiwix/manager.h> #include <kiwix/manager.h>
#include <kiwix/reader.h>
enum supportedAction { NONE, ADDCONTENT }; enum supportedAction { NONE, ADDCONTENT };
void usage() { void usage()
cout << "Usage: kiwix-install [--verbose] addcontent ZIM_PATH KIWIX_PATH" << endl; {
exit(1); cout << "Usage: kiwix-install [--verbose] addcontent ZIM_PATH KIWIX_PATH"
<< endl;
exit(1);
} }
int main(int argc, char **argv) { int main(int argc, char** argv)
{
/* Init the variables */ /* Init the variables */
const char *contentPath = NULL; const char* contentPath = NULL;
const char *kiwixPath = NULL; const char* kiwixPath = NULL;
supportedAction action = NONE; supportedAction action = NONE;
bool verboseFlag = false; bool verboseFlag = false;
int option_index = 0; int option_index = 0;
@ -41,36 +43,33 @@ int main(int argc, char **argv) {
/* Argument parsing */ /* Argument parsing */
while (42) { while (42) {
static struct option long_options[]
static struct option long_options[] = { = {{"verbose", no_argument, 0, 'v'}, {0, 0, 0, 0}};
{"verbose", no_argument, 0, 'v'},
{0, 0, 0, 0}
};
if (c != -1) { if (c != -1) {
c = getopt_long(argc, argv, "vi", long_options, &option_index); c = getopt_long(argc, argv, "vi", long_options, &option_index);
switch (c) { switch (c) {
case 'v': case 'v':
verboseFlag = true; verboseFlag = true;
break; break;
} }
} else { } else {
if (optind < argc) { if (optind < argc) {
if (action == NONE) { if (action == NONE) {
string actionString = argv[optind++]; string actionString = argv[optind++];
if (actionString == "addcontent" || actionString == "ADDCONTENT") { if (actionString == "addcontent" || actionString == "ADDCONTENT") {
action = ADDCONTENT; action = ADDCONTENT;
} }
} else if (contentPath == NULL) { } else if (contentPath == NULL) {
contentPath = argv[optind++]; contentPath = argv[optind++];
} else if (kiwixPath == NULL) { } else if (kiwixPath == NULL) {
kiwixPath = argv[optind++]; kiwixPath = argv[optind++];
} else { } else {
usage(); usage();
} }
} else { } else {
break; break;
} }
} }
} }
@ -82,38 +81,48 @@ int main(int argc, char **argv) {
/* Make the action */ /* Make the action */
if (action == ADDCONTENT) { if (action == ADDCONTENT) {
/* Check if the content path exists and is readable */ /* Check if the content path exists and is readable */
if (verboseFlag) { std::cout << "Check if the ZIM file exists..." << std::endl; } if (verboseFlag) {
std::cout << "Check if the ZIM file exists..." << std::endl;
}
if (!fileExists(contentPath)) { if (!fileExists(contentPath)) {
cerr << "The content path '" << contentPath << "' does not exist or is not readable." << endl; cerr << "The content path '" << contentPath
<< "' does not exist or is not readable." << endl;
exit(1); exit(1);
} }
/* Check if this is a ZIM file */ /* Check if this is a ZIM file */
try { try {
if (verboseFlag) { std::cout << "Check if the ZIM file is valid..." << std::endl; } if (verboseFlag) {
kiwix::Reader *reader = new kiwix::Reader(contentPath); std::cout << "Check if the ZIM file is valid..." << std::endl;
}
kiwix::Reader* reader = new kiwix::Reader(contentPath);
delete reader; delete reader;
} catch (exception &e) { } catch (exception& e) {
cerr << "The content available at '" << contentPath << "' is not a ZIM file." << endl; cerr << "The content available at '" << contentPath
<< "' is not a ZIM file." << endl;
exit(1); exit(1);
} }
string contentFilename = getLastPathElement(contentPath); string contentFilename = getLastPathElement(contentPath);
/* Check if kiwixPath/kiwix/kiwix.exe exists */ /* Check if kiwixPath/kiwix/kiwix.exe exists */
if (verboseFlag) { std::cout << "Check if the Kiwix path is valid..." << std::endl; } if (verboseFlag) {
std::cout << "Check if the Kiwix path is valid..." << std::endl;
}
string kiwixBinaryPath = computeAbsolutePath(kiwixPath, "kiwix/kiwix.exe"); string kiwixBinaryPath = computeAbsolutePath(kiwixPath, "kiwix/kiwix.exe");
if (!fileExists(kiwixBinaryPath)) { if (!fileExists(kiwixBinaryPath)) {
kiwixBinaryPath = computeAbsolutePath(kiwixPath, "kiwix/kiwix"); kiwixBinaryPath = computeAbsolutePath(kiwixPath, "kiwix/kiwix");
if (!fileExists(kiwixBinaryPath)) { if (!fileExists(kiwixBinaryPath)) {
cerr << "Unable to find the Kiwix binary at '" << kiwixBinaryPath << "[.exe]'." << endl; cerr << "Unable to find the Kiwix binary at '" << kiwixBinaryPath
exit(1); << "[.exe]'." << endl;
exit(1);
} }
} }
/* Check if the directory "data" structure exists */ /* Check if the directory "data" structure exists */
if (verboseFlag) { std::cout << "Check the target data directory structure..." << std::endl; } if (verboseFlag) {
std::cout << "Check the target data directory structure..." << std::endl;
}
string dataPath = computeAbsolutePath(kiwixPath, "data/"); string dataPath = computeAbsolutePath(kiwixPath, "data/");
if (!fileExists(dataPath)) { if (!fileExists(dataPath)) {
makeDirectory(dataPath); makeDirectory(dataPath);
@ -132,22 +141,31 @@ int main(int argc, char **argv) {
} }
/* Copy the file to the data/content directory */ /* Copy the file to the data/content directory */
if (verboseFlag) { std::cout << "Copy ZIM file to the target directory..." << std::endl; } if (verboseFlag) {
string newContentPath = computeAbsolutePath(dataContentPath, contentFilename); std::cout << "Copy ZIM file to the target directory..." << std::endl;
if (!fileExists(newContentPath) || getFileSize(contentPath) != getFileSize(newContentPath)) { }
string newContentPath
= computeAbsolutePath(dataContentPath, contentFilename);
if (!fileExists(newContentPath)
|| getFileSize(contentPath) != getFileSize(newContentPath)) {
copyFile(contentPath, newContentPath); copyFile(contentPath, newContentPath);
} }
/* Add the file to the library.xml */ /* Add the file to the library.xml */
if (verboseFlag) { std::cout << "Create the library XML file..." << std::endl; } if (verboseFlag) {
std::cout << "Create the library XML file..." << std::endl;
}
kiwix::Manager libraryManager; kiwix::Manager libraryManager;
string libraryPath = computeAbsolutePath(dataLibraryPath, contentFilename + ".xml"); string libraryPath
string bookId = libraryManager.addBookFromPathAndGetId(newContentPath, "../content/" + contentFilename, "", false); = computeAbsolutePath(dataLibraryPath, contentFilename + ".xml");
string bookId = libraryManager.addBookFromPathAndGetId(
newContentPath, "../content/" + contentFilename, "", false);
if (!bookId.empty()) { if (!bookId.empty()) {
libraryManager.setCurrentBookId(bookId); libraryManager.setCurrentBookId(bookId);
libraryManager.writeFile(libraryPath); libraryManager.writeFile(libraryPath);
} else { } else {
cerr << "Unable to build or save library file '" << libraryPath << "'" << endl; cerr << "Unable to build or save library file '" << libraryPath << "'"
<< endl;
} }
} }

View File

@ -21,47 +21,54 @@
#include <unistd.h> #include <unistd.h>
#endif #endif
#include <getopt.h> #include <getopt.h>
#include <iostream>
#include <cstdlib>
#include <kiwix/common/pathTools.h> #include <kiwix/common/pathTools.h>
#include <kiwix/manager.h> #include <kiwix/manager.h>
#include <cstdlib>
#include <iostream>
using namespace std; using namespace std;
enum supportedAction { NONE, ADD, SHOW, REMOVE }; enum supportedAction { NONE, ADD, SHOW, REMOVE };
void show(kiwix::Library library)
void show(kiwix::Library library) { {
std::vector<kiwix::Book>::iterator itr; std::vector<kiwix::Book>::iterator itr;
unsigned int inc = 1; unsigned int inc = 1;
for ( itr = library.books.begin(); itr != library.books.end(); ++itr ) { for (itr = library.books.begin(); itr != library.books.end(); ++itr) {
std::cout << "#" << inc++ std::cout << "#" << inc++ << std::endl
<< std::endl << "id:\t\t" << itr->id << "id:\t\t" << itr->id << std::endl
<< std::endl << "path:\t\t" << itr->path << "path:\t\t" << itr->path << std::endl
<< std::endl << "indexpath:\t" << itr->indexPath << "indexpath:\t" << itr->indexPath << std::endl
<< std::endl << "url:\t\t" << itr->url << "url:\t\t" << itr->url << std::endl
<< std::endl << "title:\t\t" << itr->title << "title:\t\t" << itr->title << std::endl
<< std::endl << "name:\t\t" << itr->name << "name:\t\t" << itr->name << std::endl
<< std::endl << "tags:\t\t" << itr->tags << "tags:\t\t" << itr->tags << std::endl
<< std::endl << "description:\t" << itr->description << "description:\t" << itr->description << std::endl
<< std::endl << "creator:\t" << itr->creator << "creator:\t" << itr->creator << std::endl
<< std::endl << "date:\t\t" << itr->date << "date:\t\t" << itr->date << std::endl
<< std::endl << "articleCount:\t" << itr->articleCount << "articleCount:\t" << itr->articleCount << std::endl
<< std::endl << "mediaCount:\t" << itr->mediaCount << "mediaCount:\t" << itr->mediaCount << std::endl
<< std::endl << "size:\t\t" << itr->size << " KB" << "size:\t\t" << itr->size << " KB" << std::endl
<< std::endl << std::endl; << std::endl;
} }
} }
void usage() { void usage()
cerr << "Usage:" << endl; {
cerr << "\tkiwix-manage LIBRARY_PATH add ZIM_PATH [--zimPathToSave=../content/foobar.zim] [--current] [--indexBackend=xapian] [--indexPath=FULLTEXT_IDX_PATH] [--url=http://...metalink]" << endl; cerr << "Usage:" << endl;
cerr << "\tkiwix-manage LIBRARY_PATH show [CONTENTID1] [CONTENTID2] ... (show everything if no param.)" << endl; cerr << "\tkiwix-manage LIBRARY_PATH add ZIM_PATH "
cerr << "\tkiwix-manage LIBRARY_PATH remove CONTENTID1 [CONTENTID2]" << endl; "[--zimPathToSave=../content/foobar.zim] [--current] "
"[--indexBackend=xapian] [--indexPath=FULLTEXT_IDX_PATH] "
"[--url=http://...metalink]"
<< endl;
cerr << "\tkiwix-manage LIBRARY_PATH show [CONTENTID1] [CONTENTID2] ... "
"(show everything if no param.)"
<< endl;
cerr << "\tkiwix-manage LIBRARY_PATH remove CONTENTID1 [CONTENTID2]" << endl;
} }
int main(int argc, char **argv) { int main(int argc, char** argv)
{
string libraryPath = ""; string libraryPath = "";
supportedAction action = NONE; supportedAction action = NONE;
string zimPath = ""; string zimPath = "";
@ -89,9 +96,9 @@ int main(int argc, char **argv) {
} }
/* Try to read the file */ /* Try to read the file */
libraryPath = isRelativePath(libraryPath) ? libraryPath = isRelativePath(libraryPath)
computeAbsolutePath(getCurrentDirectory(), libraryPath) : ? computeAbsolutePath(getCurrentDirectory(), libraryPath)
libraryPath; : libraryPath;
libraryManager.readFile(libraryPath, false); libraryManager.readFile(libraryPath, false);
/* SHOW */ /* SHOW */
@ -103,81 +110,78 @@ int main(int argc, char **argv) {
string indexPath; string indexPath;
kiwix::supportedIndexType indexBackend = kiwix::XAPIAN; kiwix::supportedIndexType indexBackend = kiwix::XAPIAN;
string url; string url;
string origID=""; string origID = "";
bool setCurrent = false; bool setCurrent = false;
if (argc>3) { if (argc > 3) {
zimPath = argv[3]; zimPath = argv[3];
} }
/* Options parsing */ /* Options parsing */
optind = 2; optind = 2;
while (42) { while (42) {
static struct option long_options[]
= {{"url", required_argument, 0, 'u'},
{"origId", required_argument, 0, 'o'},
{"indexPath", required_argument, 0, 'i'},
{"indexBackend", required_argument, 0, 'b'},
{"zimPathToSave", required_argument, 0, 'z'},
{"current", no_argument, 0, 'c'},
{0, 0, 0, 0}};
static struct option long_options[] = {
{"url", required_argument, 0, 'u'},
{"origId", required_argument, 0, 'o'},
{"indexPath", required_argument, 0, 'i'},
{"indexBackend", required_argument, 0, 'b'},
{"zimPathToSave", required_argument, 0, 'z'},
{"current", no_argument, 0, 'c'},
{0, 0, 0, 0}
};
c = getopt_long(argc, argv, "cz:u:i:b:", long_options, &option_index); c = getopt_long(argc, argv, "cz:u:i:b:", long_options, &option_index);
if (c != -1) { if (c != -1) {
switch (c) {
case 'u':
url = optarg;
break;
switch (c) { case 'o':
case 'u': origID = optarg;
url = optarg; break;
break;
case 'o': case 'c':
origID = optarg; setCurrent = true;
break; break;
case 'c': case 'i':
setCurrent = true; indexPath = optarg;
break; break;
case 'i': case 'b':
indexPath = optarg; if (!strcmp(optarg, "xapian")) {
break; indexBackend = kiwix::XAPIAN;
} else {
usage();
}
break;
case 'b': case 'z':
if (!strcmp(optarg, "xapian")) { zimPathToSave = optarg;
indexBackend = kiwix::XAPIAN; break;
} else { }
usage();
}
break;
case 'z':
zimPathToSave = optarg;
break;
}
} else { } else {
break; break;
} }
} }
if (!zimPath.empty()) { if (!zimPath.empty()) {
zimPathToSave = zimPathToSave == "." ? zimPath : zimPathToSave; zimPathToSave = zimPathToSave == "." ? zimPath : zimPathToSave;
string bookId = libraryManager.addBookFromPathAndGetId(zimPath, zimPathToSave, url, false); string bookId = libraryManager.addBookFromPathAndGetId(
zimPath, zimPathToSave, url, false);
if (!bookId.empty()) { if (!bookId.empty()) {
if (setCurrent)
libraryManager.setCurrentBookId(bookId);
if (setCurrent) /* Save the index infos if necessary */
libraryManager.setCurrentBookId(bookId); if (!indexPath.empty())
libraryManager.setBookIndex(bookId, indexPath, indexBackend);
/* Save the index infos if necessary */
if (!indexPath.empty())
libraryManager.setBookIndex(bookId, indexPath, indexBackend);
} else { } else {
cerr << "Unable to build or save library file '" << libraryPath << "'" << endl; cerr << "Unable to build or save library file '" << libraryPath << "'"
<< endl;
} }
} else { } else {
std::cerr << "Invalid zim file path" << std::endl; std::cerr << "Invalid zim file path" << std::endl;
@ -187,7 +191,7 @@ int main(int argc, char **argv) {
unsigned int bookIndex = 0; unsigned int bookIndex = 0;
const unsigned int totalBookCount = libraryManager.getBookCount(true, true); const unsigned int totalBookCount = libraryManager.getBookCount(true, true);
if (argc>3) { if (argc > 3) {
bookIndex = atoi(argv[3]); bookIndex = atoi(argv[3]);
} }
@ -195,9 +199,13 @@ int main(int argc, char **argv) {
libraryManager.removeBookByIndex(bookIndex - 1); libraryManager.removeBookByIndex(bookIndex - 1);
} else { } else {
if (totalBookCount > 0) { if (totalBookCount > 0) {
std::cerr << "Invalid book index number. Please give a number between 1 and " << totalBookCount << std::endl; std::cerr
<< "Invalid book index number. Please give a number between 1 and "
<< totalBookCount << std::endl;
} else { } else {
std::cerr << "Invalid book index number. Library is empty, no book to delete." << std::endl; std::cerr
<< "Invalid book index number. Library is empty, no book to delete."
<< std::endl;
} }
} }
} }

View File

@ -18,59 +18,60 @@
*/ */
#include <getopt.h> #include <getopt.h>
#include <unistd.h>
#include <string>
#include <map>
#include <kiwix/common/tree.h> #include <kiwix/common/tree.h>
#include <kiwix/reader.h> #include <kiwix/reader.h>
#include <unistd.h>
#include <map>
#include <string>
void usage() { void usage()
cout << "Usage: kiwix-read --suggest=<PATTERN> ZIM_FILE_PATH" << endl; {
exit(1); cout << "Usage: kiwix-read --suggest=<PATTERN> ZIM_FILE_PATH" << endl;
exit(1);
} }
void updateSuggestionTree(tree< pair<string, unsigned> > &suggestionTree, string suggestion) { void updateSuggestionTree(tree<pair<string, unsigned>>& suggestionTree,
string suggestion)
{
return; return;
} }
int main(int argc, char **argv) { int main(int argc, char** argv)
{
/* Init the variables */ /* Init the variables */
const char *filePath = NULL; const char* filePath = NULL;
const char *pattern = NULL; const char* pattern = NULL;
int option_index = 0; int option_index = 0;
int c = 0; int c = 0;
kiwix::Reader *reader = NULL; kiwix::Reader* reader = NULL;
/* Argument parsing */ /* Argument parsing */
while (42) { while (42) {
static struct option long_options[]
= {{"verbose", no_argument, 0, 'v'},
{"suggest", required_argument, 0, 's'},
{0, 0, 0, 0}};
static struct option long_options[] = {
{"verbose", no_argument, 0, 'v'},
{"suggest", required_argument, 0, 's'},
{0, 0, 0, 0}
};
if (c != -1) { if (c != -1) {
c = getopt_long(argc, argv, "vs:", long_options, &option_index); c = getopt_long(argc, argv, "vs:", long_options, &option_index);
switch (c) { switch (c) {
case 'v': case 'v':
break; break;
case 's': case 's':
pattern = optarg; pattern = optarg;
break; break;
} }
} else { } else {
if (optind < argc) { if (optind < argc) {
if (filePath == NULL) { if (filePath == NULL) {
filePath = argv[optind++]; filePath = argv[optind++];
} else { } else {
usage(); usage();
} }
} else { } else {
break; break;
} }
} }
} }
@ -90,24 +91,25 @@ int main(int argc, char **argv) {
string contentType; string contentType;
unsigned int contentLength = 0; unsigned int contentLength = 0;
string suggestion; string suggestion;
if (pattern != NULL) { if (pattern != NULL) {
std::cout << "Searching suggestions for: " << pattern << std::endl; std::cout << "Searching suggestions for: " << pattern << std::endl;
reader->searchSuggestionsSmart(pattern, 10); reader->searchSuggestionsSmart(pattern, 10);
while (reader->getNextSuggestion(suggestion)) { while (reader->getNextSuggestion(suggestion)) {
std::cout << suggestion << std::endl; std::cout << suggestion << std::endl;
} }
} }
/* /*
if (reader->getContentByUrl(mainPageUrl, content, contentLength, contentType)) { if (reader->getContentByUrl(mainPageUrl, content, contentLength,
contentType)) {
cout << content << endl; cout << content << endl;
} }
*/ */
// tree< pair<string, unsigned> > tree; // tree< pair<string, unsigned> > tree;
//updateSuggestionTree(tree, string(suggestion)); // updateSuggestionTree(tree, string(suggestion));
delete reader; delete reader;
} else { } else {

View File

@ -18,57 +18,56 @@
*/ */
#include <getopt.h> #include <getopt.h>
#include <unistd.h>
#include <kiwix/reader.h> #include <kiwix/reader.h>
#include <kiwix/searcher.h> #include <kiwix/searcher.h>
#include <unistd.h>
void usage() { void usage()
cout << "Usage: kiwix-search [--verbose|-v] ZIM_PATH SEARCH" << endl; {
exit(1); cout << "Usage: kiwix-search [--verbose|-v] ZIM_PATH SEARCH" << endl;
exit(1);
} }
int main(int argc, char **argv) { int main(int argc, char** argv)
{
/* Init the variables */ /* Init the variables */
//const char *indexPath = "/home/itamar/.www.kiwix.org/kiwix/43k0i1j4.default/6d2e587b-d586-dc6a-dc6a-e4ef035a1495d15c.index"; // const char *indexPath =
//const char *indexPath = "/home/itamar/testindex"; // "/home/itamar/.www.kiwix.org/kiwix/43k0i1j4.default/6d2e587b-d586-dc6a-dc6a-e4ef035a1495d15c.index";
const char *zimPath = NULL; // const char *indexPath = "/home/itamar/testindex";
const char *search = NULL; const char* zimPath = NULL;
const char* search = NULL;
bool verboseFlag = false; bool verboseFlag = false;
int option_index = 0; int option_index = 0;
int c = 0; int c = 0;
kiwix::Searcher *searcher = NULL; kiwix::Searcher* searcher = NULL;
kiwix::Reader *reader = NULL; kiwix::Reader* reader = NULL;
/* Argument parsing */ /* Argument parsing */
while (42) { while (42) {
static struct option long_options[]
static struct option long_options[] = { = {{"verbose", no_argument, 0, 'v'}, {0, 0, 0, 0}};
{"verbose", no_argument, 0, 'v'},
{0, 0, 0, 0}
};
if (c != -1) { if (c != -1) {
c = getopt_long(argc, argv, "vb:", long_options, &option_index); c = getopt_long(argc, argv, "vb:", long_options, &option_index);
switch (c) { switch (c) {
case 'v': case 'v':
verboseFlag = true; verboseFlag = true;
break; break;
} }
} else { } else {
if (optind < argc) { if (optind < argc) {
if (zimPath == NULL) { if (zimPath == NULL) {
zimPath = argv[optind++]; zimPath = argv[optind++];
} else if (search == NULL) { } else if (search == NULL) {
search = argv[optind++]; search = argv[optind++];
} else { } else {
cout << zimPath << endl; cout << zimPath << endl;
usage(); usage();
} }
} else { } else {
break; break;
} }
} }
} }
@ -80,20 +79,21 @@ int main(int argc, char **argv) {
/* Try to prepare the indexing */ /* Try to prepare the indexing */
try { try {
reader = new kiwix::Reader(zimPath); reader = new kiwix::Reader(zimPath);
} catch (...) { } catch (...) {
/* Cannot open the zimPath, maybe it is a plain old xapian database directory */ /* Cannot open the zimPath, maybe it is a plain old xapian database
* directory */
} }
if ( reader ) { if (reader) {
searcher = new kiwix::Searcher("", reader); searcher = new kiwix::Searcher("", reader);
} else { } else {
try { try {
searcher = new kiwix::Searcher(zimPath, NULL); searcher = new kiwix::Searcher(zimPath, NULL);
} catch (...) { } catch (...) {
cerr << "Unable to search through zim '" << zimPath << "'." << endl; cerr << "Unable to search through zim '" << zimPath << "'." << endl;
exit(1); exit(1);
} }
} }
/* Start the indexing */ /* Start the indexing */
@ -101,7 +101,7 @@ int main(int argc, char **argv) {
string searchString(search); string searchString(search);
searcher->search(searchString, 0, 10); searcher->search(searchString, 0, 10);
kiwix::Result* p_result; kiwix::Result* p_result;
while ( (p_result = searcher->getNextResult()) ) { while ((p_result = searcher->getNextResult())) {
cout << p_result->get_title() << endl; cout << p_result->get_title() << endl;
delete p_result; delete p_result;
} }

File diff suppressed because it is too large Load Diff