@@ -148,7 +148,19 @@ namespace zim
148148 public:
149149 template <EntryOrder order> class EntryRange ;
150150 template <EntryOrder order> class iterator ;
151- static const OpenConfig DEFAULT_OPEN_CONFIG;
151+
152+ /* * Archive constructor.
153+ *
154+ * Construct an archive from a filename.
155+ * The file is open readonly.
156+ *
157+ * The filename is the "logical" path.
158+ * So if you want to open a split zim file (foo.zimaa, foo.zimab, ...)
159+ * you must pass the `foo.zim` path.
160+ *
161+ * @param fname The filename to the file to open (utf8 encoded)
162+ */
163+ explicit Archive (const std::string& fname);
152164
153165 /* * Archive constructor.
154166 *
@@ -162,9 +174,21 @@ namespace zim
162174 * @param fname The filename to the file to open (utf8 encoded)
163175 * @param openConfig The open configuration to use.
164176 */
165- Archive (const std::string& fname, OpenConfig openConfig=DEFAULT_OPEN_CONFIG );
177+ Archive (const std::string& fname, OpenConfig openConfig);
166178
167179#ifndef _WIN32
180+ /* * Archive constructor.
181+ *
182+ * Construct an archive from a file descriptor.
183+ * Fd is used only at Archive creation.
184+ * Ownership of the fd is not taken and it must be closed by caller.
185+ *
186+ * Note: This function is not available under Windows.
187+ *
188+ * @param fd The descriptor of a seekable file representing a ZIM archive
189+ */
190+ explicit Archive (int fd);
191+
168192 /* * Archive constructor.
169193 *
170194 * Construct an archive from a file descriptor.
@@ -176,7 +200,24 @@ namespace zim
176200 * @param fd The descriptor of a seekable file representing a ZIM archive
177201 * @param openConfig The open configuration to use.
178202 */
179- Archive (int fd, OpenConfig openConfig=DEFAULT_OPEN_CONFIG);
203+ Archive (int fd, OpenConfig openConfig);
204+
205+ /* * Archive constructor.
206+ *
207+ * Construct an archive from a descriptor of a file with an embedded ZIM
208+ * archive inside.
209+ * Fd is used only at Archive creation.
210+ * Ownership of the fd is not taken and it must be closed by caller.
211+ *
212+ * Note: This function is not available under Windows.
213+ *
214+ * @param fd The descriptor of a seekable file with a continuous segment
215+ * representing a complete ZIM archive.
216+ * @param offset The offset of the ZIM archive relative to the beginning
217+ * of the file (rather than the current position associated with fd).
218+ * @param size The size of the ZIM archive.
219+ */
220+ Archive (int fd, offset_type offset, size_type size);
180221
181222 /* * Archive constructor.
182223 *
@@ -194,7 +235,21 @@ namespace zim
194235 * @param size The size of the ZIM archive.
195236 * @param openConfig The open configuration to use.
196237 */
197- Archive (int fd, offset_type offset, size_type size, OpenConfig openConfig=DEFAULT_OPEN_CONFIG);
238+ Archive (int fd, offset_type offset, size_type size, OpenConfig openConfig);
239+
240+ /* * Archive constructor.
241+ *
242+ * Construct an archive from a descriptor of a file with an embedded ZIM
243+ * archive inside.
244+ * Fd is used only at Archive creation.
245+ * Ownership of the fd is not taken and it must be closed by caller.
246+ *
247+ * Note: This function is not available under Windows.
248+ *
249+ * @param fd A FdInput (tuple) containing the fd (int), offset (offset_type) and size (size_type)
250+ * referencing a continuous segment representing a complete ZIM archive.
251+ */
252+ explicit Archive (FdInput fd);
198253
199254 /* * Archive constructor.
200255 *
@@ -209,7 +264,22 @@ namespace zim
209264 * referencing a continuous segment representing a complete ZIM archive.
210265 * @param openConfig The open configuration to use.
211266 */
212- Archive (FdInput fd, OpenConfig openConfig=DEFAULT_OPEN_CONFIG);
267+ Archive (FdInput fd, OpenConfig openConfig);
268+
269+ /* * Archive constructor.
270+ *
271+ * Construct an archive from several file descriptors.
272+ * Each part may be embedded in a file.
273+ * Fds are used only at Archive creation.
274+ * Ownership of the fds is not taken and they must be closed by caller.
275+ * Fds (int) can be the same between FdInput if the parts belong to the same file.
276+ *
277+ * Note: This function is not available under Windows.
278+ *
279+ * @param fds A vector of FdInput (tuple) containing the fd (int), offset (offset_type) and size (size_type)
280+ * referencing a series of segments representing a complete ZIM archive.
281+ */
282+ explicit Archive (const std::vector<FdInput>& fds);
213283
214284 /* * Archive constructor.
215285 *
@@ -225,7 +295,7 @@ namespace zim
225295 * referencing a series of segments representing a complete ZIM archive.
226296 * @param openConfig The open configuration to use.
227297 */
228- Archive (const std::vector<FdInput>& fds, OpenConfig openConfig=DEFAULT_OPEN_CONFIG );
298+ Archive (const std::vector<FdInput>& fds, OpenConfig openConfig);
229299#endif
230300
231301 /* * Return the filename of the zim file.
0 commit comments