Class Item

Inheritance Relationships

Base Type

Class Documentation

class Item : private zim::Entry

An Item in an Archive

There is no public constructor - the only way to obtain an Item is via Entry::getItem() or Entry::getRedirect().

All Item’s methods are threadsafe.

Public Types

typedef std::pair<std::string, offset_type> DirectAccessInfo

Public Functions

inline std::string getTitle() const
inline std::string getPath() const
std::string getMimetype() const
Blob getData(offset_type offset = 0) const

Get the data associated to the item

Get the data of the item, starting at offset.

Parameters:

offset – The number of byte to skip at begining of the data.

Returns:

A blob corresponding to the data.

Blob getData(offset_type offset, size_type size) const

Get the data associated to the item

Get the size bytes of data of the item, starting at offset.

Parameters:
  • offset – The number of byte to skip at begining of the data.

  • size – The number of byte to read.

Returns:

A blob corresponding to the data.

size_type getSize() const

The size of the item.

Returns:

The size (in byte) of the item.

DirectAccessInfo getDirectAccessInformation() const

Direct access information.

Some item are stored raw in the zim file. If possible, this function give information about which file and at which to read to get the data.

It can be usefull as an optimisation when interacting with other system by reopeing the file and reading the content bypassing the libzim.

Returns:

A pair of filename/offset specifying where read the content. If it is not possible to have direct access for this item, return a pair of {"", 0}

inline entry_index_type getIndex() const