Libzim

From openZIM
Revision as of 09:16, 24 November 2009 by Manuel Schneider (talk | contribs) (moved ZIMlib to Zimlib)
Jump to navigation Jump to search

ZIMlib is the library which implements the access to ZIM files. Use libzim in your own software - like reader applications - to make them ZIM-capable without the need having to dig too much into the ZIM file format.

Programming

zimlib is written in C++.

Sample
Listing all articles titles inside a ZIM file
#include <zim/file.h>
#include <zim/fileiterator.h>

int main(int argc, char* argv[]) 
{
  zim::File f("wikipedia.zim");
  
  
  for (zim::File::const_iterator it = f.begin(); it != f.end(); ++it)
  {
      std::cout << it->getUrl() << '
';
  }


}

Methods

Article File::getArticle(char ns, const QUnicodeString& title, bool collate = false)

returns an object of an article

std::string Article::getPage(bool layout = true, unsigned maxRecurse = 10)

returns the content of an article