Class Entry

Class Documentation

class kiwix::Entry

A entry represent an.. entry in a zim file.

Public Functions

Entry(zim::Entry entry)

Construct an entry making reference to an zim article.

Parameters

article – a zim::Article object

virtual ~Entry() = default
inline std::string getPath() const

Get the path of the entry.

The path is the “key” of an entry.

Returns

the path of the entry.

inline std::string getTitle() const

Get the title of the entry.

Returns

the title of the entry.

inline std::string getContent() const

Get the content of the entry.

The string is a copy of the content. If you don’t want to do a copy, use get_blob.

Returns

the content of the entry.

inline zim::Blob getBlob(offset_type offset = 0) const

Get the blob of the entry.

A blob make reference to the content without copying it.

Parameters

offset – The starting offset of the blob.

Returns

the blob of the entry.

inline zim::Blob getBlob(offset_type offset, size_type size) const

Get the blob of the entry.

A blob make reference to the content without copying it.

Parameters
  • offset – The starting offset of the blob.

  • size – The size of the blob.

Returns

the blob of the entry.

inline zim::Item::DirectAccessInfo getDirectAccessInfo() const

Get the info for direct access to the content of the entry.

Some entry (ie binary ones) have their content plain stored in the zim file. Knowing the offset where the content is stored an user can directly read the content in the zim file bypassing the libkiwix/libzim.

Returns

A pair specifying where to read the content. The string is the real file to read (may be different that .zim file if zim is cut). The offset is the offset to read in the file. Return <””,0> if is not possible to read directly.

size_type getSize() const

Get the size of the entry.

Returns

the size of the entry.

std::string getMimetype() const

Get the mime_type of the entry.

Returns

the mime_type of the entry.

bool isRedirect() const

Get if the entry is a redirect entry.

Returns

True if the entry is a redirect.

bool isLinkTarget() const

Get if the entry is a link target entry.

Returns

True if the entry is a link target.

bool isDeleted() const

Get if the entry is a deleted entry.

Returns

True if the entry is a deleted entry.

Entry getRedirectEntry() const

Get the entry pointed by this entry.

Throws

NoEntry – if the entry is not a redirected entry.

Returns

the entry pointed.

Entry getFinalEntry() const

Get the final entry pointed by this entry.

Follow the redirection until a “not redirecting” entry is found. If the entry is not a redirected entry, return the entry itself.

Returns

the final entry.

inline const zim::Entry &getZimEntry() const

Get the zim entry wrapped by this (kiwix) entry

Returns

the zim entry