From a69aac50bc21352475ae4d95cde1c2145b409779 Mon Sep 17 00:00:00 2001 From: kelson42 Date: Sat, 12 Jun 2010 17:13:57 +0000 Subject: [PATCH] + fix a few things for the 0.9 alpha4 --- src/common/kiwix/reader.cpp | 12 ++++++++++++ src/common/kiwix/reader.h | 1 + 2 files changed, 13 insertions(+) diff --git a/src/common/kiwix/reader.cpp b/src/common/kiwix/reader.cpp index 23d997dac..3048e7a31 100644 --- a/src/common/kiwix/reader.cpp +++ b/src/common/kiwix/reader.cpp @@ -79,6 +79,18 @@ string Reader::getMainPageUrl() { } +/* Return the first page URL */ +string Reader::getFirstPageUrl() { + string url = ""; + + zim::size_type firstPageOffset = zimFileHandler->getNamespaceBeginOffset('A'); + zim::Article article = zimFileHandler->getArticle(firstPageOffset); + std::cout << article.getTitle() << std::endl; + url = article.getLongUrl(); + + return url; + } + /* Get a content from a zim file */ bool Reader::getContentByUrl(const string &urlStr, string &content, unsigned int &contentLength, string &contentType) { bool retVal = false; diff --git a/src/common/kiwix/reader.h b/src/common/kiwix/reader.h index e09ade60d..08d259751 100644 --- a/src/common/kiwix/reader.h +++ b/src/common/kiwix/reader.h @@ -22,6 +22,7 @@ namespace kiwix { unsigned int getArticleCount(); string getId(); string getRandomPageUrl(); + string getFirstPageUrl(); string getMainPageUrl(); bool getContentByUrl(const string &url, string &content, unsigned int &contentLength, string &contentType); bool searchSuggestions(const string &prefix, unsigned int suggestionsCount);