Class ContentProvider¶
Defined in File contentProvider.h
Inheritance Relationships¶
Derived Types¶
public zim::writer::FileProvider
(Class FileProvider)public zim::writer::SharedStringProvider
(Class SharedStringProvider)public zim::writer::StringProvider
(Class StringProvider)
Class Documentation¶
-
class ContentProvider¶
ContentProvider
is an abstract class in charge of providing the content to add in the archive to the creator.Subclassed by zim::writer::FileProvider, zim::writer::SharedStringProvider, zim::writer::StringProvider
Public Functions
-
virtual ~ContentProvider() = default¶
-
virtual zim::size_type getSize() const = 0¶
The size of the content to add into the archive.
- Returns:
the total size of the content.
-
virtual Blob feed() = 0¶
Return a blob to add to the archive.
The returned blob doesn’t have to represent the whole content. The feed method can return the whole content chunk by chunk or in one step. When the whole content has been returned, feed must return an empty blob (size == 0).
This method will be called several times (at least twice) for each content to add.
It is up to the implementation to manage correctly the data pointed by the returned blob. It may (re)use the same buffer between calls (rewriting its content), create a new buffer each time or make the blob point to a new region of a big buffer. It is up to the implementation to free any allocated memory.
The data pointed by the blob must stay valid until the next call to feed. A call to feed ensure that the data returned by a previous call will not be used anymore.
-
virtual ~ContentProvider() = default¶