summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib/fileutl.h
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2011-12-13 00:17:30 +0100
committerDavid Kalnischkies <kalnischkies@gmail.com>2011-12-13 00:17:30 +0100
commit699b209e5122f8fcd85fc4666c9b7020286ab0d0 (patch)
tree0fca0e56e0f6bb03d4f1f8517f4c217e984875d6 /apt-pkg/contrib/fileutl.h
parent032bd56ff86166fd4b6a8f69bd9d5d1bc57b886e (diff)
Allow the FileFd to use an external Compressor to uncompress a given file
internally so that it is exported and can be used like a "normal" uncompressed file with FileFd This allows us to hide th zlib usage in the implementation and use gzip instead if we don't have zlib builtin (the same for other compressors). The code includes quiet a few FIXME's so while all tests are working it shouldn't be used just yet outside of libapt as it might break.
Diffstat (limited to 'apt-pkg/contrib/fileutl.h')
-rw-r--r--apt-pkg/contrib/fileutl.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/apt-pkg/contrib/fileutl.h b/apt-pkg/contrib/fileutl.h
index 209ca91e7..f96dc72dc 100644
--- a/apt-pkg/contrib/fileutl.h
+++ b/apt-pkg/contrib/fileutl.h
@@ -22,6 +22,7 @@
#define PKGLIB_FILEUTL_H
#include <apt-pkg/macros.h>
+#include <apt-pkg/aptconfiguration.h>
#include <string>
#include <vector>
@@ -110,6 +111,7 @@ class FileFd
inline int Fd() {return iFd;};
inline void Fd(int fd) {iFd = fd;};
__deprecated gzFile gzFd();
+
inline bool IsOpen() {return iFd >= 0;};
inline bool Failed() {return (Flags & Fail) == Fail;};
inline void EraseOnFailure() {Flags |= DelOnFail;};
@@ -170,6 +172,14 @@ bool WaitFd(int Fd,bool write = false,unsigned long timeout = 0);
pid_t ExecFork();
bool ExecWait(pid_t Pid,const char *Name,bool Reap = false);
+bool ExecCompressor(APT::Configuration::Compressor const &Prog,
+ pid_t *Pid, int const FileFd, int &OutFd, bool const Comp = true);
+inline bool ExecDecompressor(APT::Configuration::Compressor const &Prog,
+ pid_t *Pid, int const FileFd, int &OutFd)
+{
+ return ExecCompressor(Prog, Pid, FileFd, OutFd, true);
+}
+
// File string manipulators
std::string flNotDir(std::string File);
std::string flNotFile(std::string File);