X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fpacksource.h;h=7d616614cff490690d73699f4a5b4f6a76a545f1;hb=010737b64c8d4e7fcf0fe953ed15769eeac4178f;hp=a599b5c0c99c985eaa8b834721f5158b8356b52d;hpb=f8820db0e2d1de85752de809f0a8e24394a33f61;p=libs%2Fdatafile.git diff --git a/source/packsource.h b/source/packsource.h index a599b5c..7d61661 100644 --- a/source/packsource.h +++ b/source/packsource.h @@ -48,13 +48,15 @@ private: private: std::string filename; + IO::Seekable *io; unsigned base_offset; std::list files; public: - Pack(const std::string &); + Pack(IO::Seekable *, const std::string &); const std::string &get_filename() const { return filename; } + IO::Seekable *get_io() const { return io; } unsigned get_base_offset() const { return base_offset; } void collect_files(FileMap &, const std::string &) const; @@ -123,6 +125,19 @@ public: read on the first call; subsequent calls will use cached data. */ void add_pack_file(const std::string &, const std::string &); + /** Adds a pack from an existing seekable I/O object. The same object is + used for all accesses to the pack, so it must not be deleted before the + PackSource. */ + void add_pack_io(IO::Seekable &, const std::string & = std::string()); + + /** Adds a pack from an I/O object with a regex to filter logical files. + Multiple filters for the same I/O object can be added with repeated calls. */ + void add_pack_io(IO::Seekable &, const std::string &, const std::string &); + +private: + void add_pack(IO::Seekable *, const std::string &, const std::string &); + +public: /// Returns information about the files in the pack. std::list list_files() const;