Difference between revisions of "Libzim"

Jump to navigation Jump to search
m (Kelson moved page Zimlib to Libzim over redirect)
(zimlib -> libzim)
Line 1: Line 1:
The '''zimlib''' is the standard implementation of the [[ZIM file format|ZIM specification]]. It is a library which implements the read and write method for ZIM files. The zimlib is released under the [https://www.gnu.org/licenses/old-licenses/gpl-2.0.html GPLv2 license terms]. Use the zimlib 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.
The '''libzim''' is the standard implementation of the [[ZIM file format|ZIM specification]]. It is a library which implements the read and write method for ZIM files. The libzim is released under the [https://www.gnu.org/licenses/old-licenses/gpl-2.0.html GPLv2 license terms]. Use the 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.


Have a look to the [[Releases]] or [[git]] pages to get more information about how to download it.
Have a look to the [[Releases]] or [[git]] pages to get more information about how to download it.
Line 6: Line 6:


=== Introduction ===  
=== Introduction ===  
zimlib is written in C++. To use the library, you need the include files of zimlib have to link against zimlib. Both are installed when zimlib is built (<tt>./autogen.sh; ./configure; make; make install</tt>).
libzim is written in C++. To use the library, you need the include files of libzim have to link against libzim. Both are installed when libzim is built (<tt>./autogen.sh; ./configure; make; make install</tt>).


Errors are handled with exceptions. When something goes wrong, zimlib throws an error, which is always derived from std::exception.
Errors are handled with exceptions. When something goes wrong, libzim throws an error, which is always derived from std::exception.


All Classes are defined in the namespace zim. Copying is allowed and tried to make as cheap as possible. The library is not thread safe by itself. You have to serialize access to the class yourself.
All Classes are defined in the namespace zim. Copying is allowed and tried to make as cheap as possible. The library is not thread safe by itself. You have to serialize access to the class yourself.
Line 97: Line 97:
== using the Search-class ==
== using the Search-class ==


The class ''zim::Search'' adds 2 search features to zimlib. Both fill a result object of type zim::Search::Results. This result object is actually a ''std::vector'' of a ''zim::SearchResult''. The ''zim::SearchResult'' holds a article and a priority. Since copying large result sets is quite expensive, all search methods of this expects a reference to a existing ''zim::Search::Results'', which is filled.
The class ''zim::Search'' adds 2 search features to libzim. Both fill a result object of type zim::Search::Results. This result object is actually a ''std::vector'' of a ''zim::SearchResult''. The ''zim::SearchResult'' holds a article and a priority. Since copying large result sets is quite expensive, all search methods of this expects a reference to a existing ''zim::Search::Results'', which is filled.


The simpler searches articles by title either by a praefix or by a range of titles. You pass a namespace and either a single ''std::string'' and you get all articles, whose title starts with that string or you pass two strings and you get all articles whose title is between these strings (including the passed strings).
The simpler searches articles by title either by a praefix or by a range of titles. You pass a namespace and either a single ''std::string'' and you get all articles, whose title starts with that string or you pass two strings and you get all articles whose title is between these strings (including the passed strings).