]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/contrib/fileutl.h
support compression and by-hash for .diff/Index files
[apt.git] / apt-pkg / contrib / fileutl.h
index 8619047a0aa5406a26b86f2572e41d8e3564031b..15665f8b5ea8703d033f0f874b3a456379f360ed 100644 (file)
@@ -45,6 +45,7 @@ class FileFd
    friend class GzipFileFdPrivate;
    friend class Bz2FileFdPrivate;
    friend class LzmaFileFdPrivate;
+   friend class Lz4FileFdPrivate;
    friend class DirectFileFdPrivate;
    friend class PipedFileFdPrivate;
    protected:
@@ -75,7 +76,7 @@ class FileFd
        ReadOnlyGzip,
        WriteAtomic = ReadWrite | Create | Atomic
    };
-   enum CompressMode { Auto = 'A', None = 'N', Extension = 'E', Gzip = 'G', Bzip2 = 'B', Lzma = 'L', Xz = 'X' };
+   enum CompressMode { Auto = 'A', None = 'N', Extension = 'E', Gzip = 'G', Bzip2 = 'B', Lzma = 'L', Xz = 'X', Lz4='4' };
    
    inline bool Read(void *To,unsigned long long Size,bool AllowEof)
    {
@@ -85,6 +86,7 @@ class FileFd
       return Read(To,Size);
    }   
    bool Read(void *To,unsigned long long Size,unsigned long long *Actual = 0);
+   bool static Read(int const Fd, void *To, unsigned long long Size, unsigned long long * const Actual = 0);
    char* ReadLine(char *To, unsigned long long const Size);
    bool Flush();
    bool Write(const void *From,unsigned long long Size);
@@ -162,7 +164,7 @@ bool RemoveFile(char const * const Function, std::string const &FileName);
 int GetLock(std::string File,bool Errors = true);
 bool FileExists(std::string File);
 bool RealFileExists(std::string File);
-bool DirectoryExists(std::string const &Path) APT_CONST;
+bool DirectoryExists(std::string const &Path);
 bool CreateDirectory(std::string const &Parent, std::string const &Path);
 time_t GetModificationTime(std::string const &Path);
 bool Rename(std::string From, std::string To);
@@ -233,6 +235,8 @@ std::string flCombine(std::string Dir,std::string File);
 /** \brief Takes a file path and returns the absolute path
  */
 std::string flAbsPath(std::string File);
+/** \brief removes superfluous /./ and // from path */
+APT_HIDDEN std::string flNormalize(std::string file);
 
 // simple c++ glob
 std::vector<std::string> Glob(std::string const &pattern, int flags=0);