#include <apt-pkg/arfile.h>
 #include <apt-pkg/strutl.h>
+#include <apt-pkg/fileutl.h>
 #include <apt-pkg/error.h>
 
 #include <stdlib.h>
 
 
 
 #include <string>
-#include <apt-pkg/fileutl.h>
+
+class FileFd;
 
 class ARArchive
 {
 
 // Include Files                                                       /*{{{*/
 #include<config.h>
 
+#include <apt-pkg/dirstream.h>
 #include <apt-pkg/extracttar.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/strutl.h>
 
 #define PKGLIB_EXTRACTTAR_H
 
 #include <apt-pkg/fileutl.h>
-#include <apt-pkg/dirstream.h>
 
-#include <algorithm>
+#include <string>
+
+class pkgDirStream;
 
 class ExtractTar
 {
 
 #include<config.h>
 
 #include <apt-pkg/database.h>
+#include <apt-pkg/filelist.h>
+#include <apt-pkg/pkgcachegen.h>
                                                                        /*}}}*/
 
 // DataBase::GetMetaTmp - Get the temp dir                             /*{{{*/
    return true;
 }
                                                                        /*}}}*/
+pkgDataBase::~pkgDataBase()
+{
+   delete Cache;
+   delete FList;
+}
 
 #ifndef PKGLIB_DATABASE_H
 #define PKGLIB_DATABASE_H
 
-#include <apt-pkg/filelist.h>
 #include <apt-pkg/pkgcachegen.h>
 
+#include <string>
+
+class pkgFLCache;
+class OpProgress;
+
 class pkgDataBase
 {
    protected:
    virtual bool LoadChanges() = 0;
 
    pkgDataBase() : Cache(0), FList(0) {};
-   virtual ~pkgDataBase() {delete Cache; delete FList;};
+   virtual ~pkgDataBase();
 };
 
 #endif
 
 // Include Files                                                       /*{{{*/
 #include<config.h>
 
+#include <apt-pkg/database.h>
 #include <apt-pkg/debfile.h>
 #include <apt-pkg/extracttar.h>
 #include <apt-pkg/error.h>
 
 
 
 #include <apt-pkg/arfile.h>
-#include <apt-pkg/database.h>
 #include <apt-pkg/dirstream.h>
 #include <apt-pkg/tagfile.h>
+#include <apt-pkg/pkgcache.h>
+
+class FileFd;
+class pkgDataBase;
 
 class debDebFile
 {
 
 #include <apt-pkg/progress.h>
 #include <apt-pkg/tagfile.h>
 #include <apt-pkg/strutl.h>
+#include <apt-pkg/fileutl.h>
+#include <apt-pkg/filelist.h>
 
 #include <stdio.h>
 #include <errno.h>
 
 
 #include <apt-pkg/database.h>
 
+#include <string>
+
+class DynamicMMap;
+class OpProgress;
+
 class debDpkgDB : public pkgDataBase
 {
    protected:
 
 #include <apt-pkg/extract.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/debversion.h>
+#include <apt-pkg/fileutl.h>
 
 #include <sys/stat.h>
 #include <stdio.h>
 
 #ifndef PKGLIB_FILELIST_H
 #define PKGLIB_FILELIST_H
 
+#include <apt-pkg/mmap.h>
 
 #include <cstring>
-#include <apt-pkg/mmap.h>
+#include <string>
 
 class pkgFLCache
 {
 
 #include <apt-pkg/md5.h>
 #include <apt-pkg/sha1.h>
 #include <apt-pkg/tagfile.h>
+#include <apt-pkg/indexrecords.h>
+#include <apt-pkg/metaindex.h>
 
 #include <sys/stat.h>
 #include <unistd.h>
 
 #define PKGLIB_ACQUIRE_ITEM_H
 
 #include <apt-pkg/acquire.h>
-#include <apt-pkg/indexfile.h>
-#include <apt-pkg/vendor.h>
-#include <apt-pkg/sourcelist.h>
-#include <apt-pkg/pkgrecords.h>
-#include <apt-pkg/indexrecords.h>
 #include <apt-pkg/hashes.h>
 #include <apt-pkg/weakptr.h>
+#include <apt-pkg/pkgcache.h>
 
 /** \addtogroup acquire
  *  @{
  *  \file acquire-item.h
  */
 
+class indexRecords;
+class pkgRecords;
+class pkgSourceList;
+
 /** \brief Represents the process by which a pkgAcquire object should  {{{
  *  retrieve a file or a collection of files.
  *
     *  \param To The new name of #From.  If #To exists it will be
     *  overwritten.
     */
-   void Rename(string From,string To);
+   void Rename(std::string From,std::string To);
    
    public:
 
    /** \brief Contains a textual description of the error encountered
     *  if #Status is #StatError or #StatAuthError.
     */
-   string ErrorText;
+   std::string ErrorText;
 
    /** \brief The size of the object to fetch. */
    unsigned long long FileSize;
     *  download progress indicator's overall statistics.
     */
    bool Local;
-   string UsedMirror;
+   std::string UsedMirror;
 
    /** \brief The number of fetch queues into which this item has been
     *  inserted.
    /** \brief The name of the file into which the retrieved object
     *  will be written.
     */
-   string DestFile;
+   std::string DestFile;
 
    /** \brief Invoked by the acquire worker when the object couldn't
     *  be fetched.
     *
     *  \sa pkgAcqMethod
     */
-   virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf);
+   virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
 
    /** \brief Invoked by the acquire worker when the object was
     *  fetched successfully.
     *
     *  \sa pkgAcqMethod
     */
-   virtual void Done(string Message,unsigned long long Size,string Hash,
+   virtual void Done(std::string Message,unsigned long long Size,std::string Hash,
                     pkgAcquire::MethodConfig *Cnf);
 
    /** \brief Invoked when the worker starts to fetch this object.
     *
     *  \sa pkgAcqMethod
     */
-   virtual void Start(string Message,unsigned long long Size);
+   virtual void Start(std::string Message,unsigned long long Size);
 
    /** \brief Custom headers to be sent to the fetch process.
     *
     *  line, so they should (if nonempty) have a leading newline and
     *  no trailing newline.
     */
-   virtual string Custom600Headers() {return string();};
+   virtual std::string Custom600Headers() {return std::string();};
 
    /** \brief A "descriptive" URI-like string.
     *
     *  \return a URI that should be used to describe what is being fetched.
     */
-   virtual string DescURI() = 0;
+   virtual std::string DescURI() = 0;
    /** \brief Short item description.
     *
     *  \return a brief description of the object being fetched.
     */
-   virtual string ShortDesc() {return DescURI();}
+   virtual std::string ShortDesc() {return DescURI();}
 
    /** \brief Invoked by the worker when the download is completely done. */
    virtual void Finished() {};
     *  \return the HashSum of this object, if applicable; otherwise, an
     *  empty string.
     */
-   virtual string HashSum() {return string();};
+   virtual std::string HashSum() {return std::string();};
 
    /** \return the acquire process with which this item is associated. */
    pkgAcquire *GetOwner() {return Owner;};
     * 
     *  \param FailCode A short failure string that is send
     */
-   void ReportMirrorFailure(string FailCode);
+   void ReportMirrorFailure(std::string FailCode);
 
 
    /** \brief Initialize an item.
 /** \brief Information about an index patch (aka diff). */             /*{{{*/
 struct DiffInfo {
    /** The filename of the diff. */
-   string file;
+   std::string file;
 
    /** The sha1 hash of the diff. */
-   string sha1;
+   std::string sha1;
 
    /** The size of the diff. */
    unsigned long size;
 
  public:
    // Specialized action members
-   virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf);
-   virtual void Done(string Message,unsigned long long Size,string Md5Hash,
+   virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
+   virtual void Done(std::string Message,unsigned long long Size,std::string Md5Hash,
                     pkgAcquire::MethodConfig *Cnf);
-   virtual string DescURI() {return Desc.URI;};
-   virtual string Custom600Headers();
-   virtual bool ParseIndex(string const &IndexFile);
+   virtual std::string DescURI() {return Desc.URI;};
+   virtual std::string Custom600Headers();
+   virtual bool ParseIndex(std::string const &IndexFile);
 
    /** \brief Create a new pkgAcqSubIndex.
     *
     *
     *  \param ExpectedHash The list file's MD5 signature.
     */
-   pkgAcqSubIndex(pkgAcquire *Owner, string const &URI,string const &URIDesc,
-                  string const &ShortDesc, HashString const &ExpectedHash);
+   pkgAcqSubIndex(pkgAcquire *Owner, std::string const &URI,std::string const &URIDesc,
+                  std::string const &ShortDesc, HashString const &ExpectedHash);
 };
                                                                        /*}}}*/
 /** \brief An item that is responsible for fetching an index file of   {{{
    /** \brief The URI of the index file to recreate at our end (either
     *  by downloading it or by applying partial patches).
     */
-   string RealURI;
+   std::string RealURI;
 
    /** \brief The Hash that the real index file should have after
     *  all patches have been applied.
    /** \brief The index file which will be patched to generate the new
     *  file.
     */
-   string CurrentPackagesFile;
+   std::string CurrentPackagesFile;
 
    /** \brief A description of the Packages file (stored in
     *  pkgAcquire::ItemDesc::Description).
     */
-   string Description;
+   std::string Description;
 
  public:
    // Specialized action members
-   virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf);
-   virtual void Done(string Message,unsigned long long Size,string Md5Hash,
+   virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
+   virtual void Done(std::string Message,unsigned long long Size,std::string Md5Hash,
                     pkgAcquire::MethodConfig *Cnf);
-   virtual string DescURI() {return RealURI + "Index";};
-   virtual string Custom600Headers();
+   virtual std::string DescURI() {return RealURI + "Index";};
+   virtual std::string Custom600Headers();
 
    /** \brief Parse the Index file for a set of Packages diffs.
     *
     *  \return \b true if the Index file was successfully parsed, \b
     *  false otherwise.
     */
-   bool ParseDiffIndex(string IndexDiffFile);
+   bool ParseDiffIndex(std::string IndexDiffFile);
    
 
    /** \brief Create a new pkgAcqDiffIndex.
     *
     *  \param ExpectedHash The list file's MD5 signature.
     */
-   pkgAcqDiffIndex(pkgAcquire *Owner,string URI,string URIDesc,
-                  string ShortDesc, HashString ExpectedHash);
+   pkgAcqDiffIndex(pkgAcquire *Owner,std::string URI,std::string URIDesc,
+                  std::string ShortDesc, HashString ExpectedHash);
 };
                                                                        /*}}}*/
 /** \brief An item that is responsible for fetching all the patches    {{{
    /** \brief The URI of the package index file that is being
     *  reconstructed.
     */
-   string RealURI;
+   std::string RealURI;
 
    /** \brief The HashSum of the package index file that is being
     *  reconstructed.
    HashString ExpectedHash;
 
    /** A description of the file being downloaded. */
-   string Description;
+   std::string Description;
 
    /** The patches that remain to be downloaded, including the patch
     *  being downloaded right now.  This list should be ordered so
     *  dictionary instead of relying on ordering and stripping them
     *  off the front?
     */
-   vector<DiffInfo> available_patches;
+   std::vector<DiffInfo> available_patches;
 
    /** Stop applying patches when reaching that sha1 */
-   string ServerSha1;
+   std::string ServerSha1;
 
    /** The current status of this patch. */
    enum DiffState
     *  This method will fall back to downloading the whole index file
     *  outright; its arguments are ignored.
     */
-   virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf);
+   virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
 
-   virtual void Done(string Message,unsigned long long Size,string Md5Hash,
+   virtual void Done(std::string Message,unsigned long long Size,std::string Md5Hash,
                     pkgAcquire::MethodConfig *Cnf);
-   virtual string DescURI() {return RealURI + "Index";};
+   virtual std::string DescURI() {return RealURI + "Index";};
 
    /** \brief Create an index diff item.
     *
     *  should be ordered so that each diff appears before any diff
     *  that depends on it.
     */
-   pkgAcqIndexDiffs(pkgAcquire *Owner,string URI,string URIDesc,
-                   string ShortDesc, HashString ExpectedHash,
-                   string ServerSha1,
-                   vector<DiffInfo> diffs=vector<DiffInfo>());
+   pkgAcqIndexDiffs(pkgAcquire *Owner,std::string URI,std::string URIDesc,
+                   std::string ShortDesc, HashString ExpectedHash,
+                   std::string ServerSha1,
+                   std::vector<DiffInfo> diffs=std::vector<DiffInfo>());
 };
                                                                        /*}}}*/
 /** \brief An acquire item that is responsible for fetching an index   {{{
    /** \brief The object that is actually being fetched (minus any
     *  compression-related extensions).
     */
-   string RealURI;
+   std::string RealURI;
 
    /** \brief The expected hashsum of the decompressed index file. */
    HashString ExpectedHash;
    /** \brief The compression-related file extensions that are being
     *  added to the downloaded file one by one if first fails (e.g., "gz bz2").
     */
-   string CompressionExtension;
+   std::string CompressionExtension;
 
    public:
    
    // Specialized action members
-   virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf);
-   virtual void Done(string Message,unsigned long long Size,string Md5Hash,
+   virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
+   virtual void Done(std::string Message,unsigned long long Size,std::string Md5Hash,
                     pkgAcquire::MethodConfig *Cnf);
-   virtual string Custom600Headers();
-   virtual string DescURI() {return Desc.URI;};
-   virtual string HashSum() {return ExpectedHash.toStr(); };
+   virtual std::string Custom600Headers();
+   virtual std::string DescURI() {return Desc.URI;};
+   virtual std::string HashSum() {return ExpectedHash.toStr(); };
 
    /** \brief Create a pkgAcqIndex.
     *
     *  default is ".lzma" or ".bz2" (if the needed binaries are present)
     *  fallback is ".gz" or none.
     */
-   pkgAcqIndex(pkgAcquire *Owner,string URI,string URIDesc,
-              string ShortDesc, HashString ExpectedHash, 
-              string compressExt="");
+   pkgAcqIndex(pkgAcquire *Owner,std::string URI,std::string URIDesc,
+              std::string ShortDesc, HashString ExpectedHash, 
+              std::string compressExt="");
    pkgAcqIndex(pkgAcquire *Owner, struct IndexTarget const * const Target,
                         HashString const &ExpectedHash, indexRecords const *MetaIndexParser);
-   void Init(string const &URI, string const &URIDesc, string const &ShortDesc);
+   void Init(std::string const &URI, std::string const &URIDesc, std::string const &ShortDesc);
 };
                                                                        /*}}}*/
 /** \brief An acquire item that is responsible for fetching a          {{{
 {
    public:
   
-   virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf);
-   virtual string Custom600Headers();
+   virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
+   virtual std::string Custom600Headers();
 
    /** \brief Create a pkgAcqIndexTrans.
     *
     *
     *  \param ShortDesc A brief description of this index file.
     */
-   pkgAcqIndexTrans(pkgAcquire *Owner,string URI,string URIDesc,
-                   string ShortDesc);
+   pkgAcqIndexTrans(pkgAcquire *Owner,std::string URI,std::string URIDesc,
+                   std::string ShortDesc);
    pkgAcqIndexTrans(pkgAcquire *Owner, struct IndexTarget const * const Target,
                    HashString const &ExpectedHash, indexRecords const *MetaIndexParser);
 };
 {
  public:
    /** \brief A URI from which the index file can be downloaded. */
-   string URI;
+   std::string URI;
 
    /** \brief A description of the index file. */
-   string Description;
+   std::string Description;
 
    /** \brief A shorter description of the index file. */
-   string ShortDesc;
+   std::string ShortDesc;
 
    /** \brief The key by which this index file should be
     *  looked up within the meta signature file.
     */
-   string MetaKey;
+   std::string MetaKey;
 
    virtual bool IsOptional() const {
       return false;
 {
    protected:
    /** \brief The last good signature file */
-   string LastGoodSig;
+   std::string LastGoodSig;
 
    /** \brief The fetch request that is currently being processed. */
    pkgAcquire::ItemDesc Desc;
     *  never modified; it is used to determine the file that is being
     *  downloaded.
     */
-   string RealURI;
+   std::string RealURI;
 
    /** \brief The URI of the meta-index file to be fetched after the signature. */
-   string MetaIndexURI;
+   std::string MetaIndexURI;
 
    /** \brief A "URI-style" description of the meta-index file to be
     *  fetched after the signature.
     */
-   string MetaIndexURIDesc;
+   std::string MetaIndexURIDesc;
 
    /** \brief A brief description of the meta-index file to be fetched
     *  after the signature.
     */
-   string MetaIndexShortDesc;
+   std::string MetaIndexShortDesc;
 
    /** \brief A package-system-specific parser for the meta-index file. */
    indexRecords* MetaIndexParser;
     *
     *  \todo Why a list of pointers instead of a list of structs?
     */
-   const vector<struct IndexTarget*>* IndexTargets;
+   const std::vector<struct IndexTarget*>* IndexTargets;
 
    public:
    
    // Specialized action members
-   virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf);
-   virtual void Done(string Message,unsigned long long Size,string Md5Hash,
+   virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
+   virtual void Done(std::string Message,unsigned long long Size,std::string Md5Hash,
                     pkgAcquire::MethodConfig *Cnf);
-   virtual string Custom600Headers();
-   virtual string DescURI() {return RealURI; };
+   virtual std::string Custom600Headers();
+   virtual std::string DescURI() {return RealURI; };
 
    /** \brief Create a new pkgAcqMetaSig. */
-   pkgAcqMetaSig(pkgAcquire *Owner,string URI,string URIDesc, string ShortDesc,
-                string MetaIndexURI, string MetaIndexURIDesc, string MetaIndexShortDesc,
-                const vector<struct IndexTarget*>* IndexTargets,
+   pkgAcqMetaSig(pkgAcquire *Owner,std::string URI,std::string URIDesc, std::string ShortDesc,
+                std::string MetaIndexURI, std::string MetaIndexURIDesc, std::string MetaIndexShortDesc,
+                const std::vector<struct IndexTarget*>* IndexTargets,
                 indexRecords* MetaIndexParser);
 };
                                                                        /*}}}*/
    /** \brief The URI that is actually being downloaded; never
     *  modified by pkgAcqMetaIndex.
     */
-   string RealURI;
+   std::string RealURI;
 
    /** \brief The file in which the signature for this index was stored.
     *
     *  If empty, the signature and the md5sums of the individual
     *  indices will not be checked.
     */
-   string SigFile;
+   std::string SigFile;
 
    /** \brief The index files to download. */
-   const vector<struct IndexTarget*>* IndexTargets;
+   const std::vector<struct IndexTarget*>* IndexTargets;
 
    /** \brief The parser for the meta-index file. */
    indexRecords* MetaIndexParser;
     *
     *  \return \b true if no fatal errors were encountered.
     */
-   bool VerifyVendor(string Message);
+   bool VerifyVendor(std::string Message);
 
    /** \brief Called when a file is finished being retrieved.
     *
     *  \param Message The message block received from the fetch
     *  subprocess.
     */
-   void RetrievalDone(string Message);
+   void RetrievalDone(std::string Message);
 
    /** \brief Called when authentication succeeded.
     *
     *  \param Message The message block received from the fetch
     *  subprocess.
     */
-   void AuthDone(string Message);
+   void AuthDone(std::string Message);
 
    /** \brief Starts downloading the individual index files.
     *
    public:
    
    // Specialized action members
-   virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf);
-   virtual void Done(string Message,unsigned long long Size, string Hash,
+   virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
+   virtual void Done(std::string Message,unsigned long long Size, std::string Hash,
                     pkgAcquire::MethodConfig *Cnf);
-   virtual string Custom600Headers();
-   virtual string DescURI() {return RealURI; };
+   virtual std::string Custom600Headers();
+   virtual std::string DescURI() {return RealURI; };
 
    /** \brief Create a new pkgAcqMetaIndex. */
    pkgAcqMetaIndex(pkgAcquire *Owner,
-                  string URI,string URIDesc, string ShortDesc,
-                  string SigFile,
-                  const vector<struct IndexTarget*>* IndexTargets,
+                  std::string URI,std::string URIDesc, std::string ShortDesc,
+                  std::string SigFile,
+                  const std::vector<struct IndexTarget*>* IndexTargets,
                   indexRecords* MetaIndexParser);
 };
                                                                        /*}}}*/
 class pkgAcqMetaClearSig : public pkgAcqMetaIndex
 {
    /** \brief The URI of the meta-index file for the detached signature */
-   string MetaIndexURI;
+   std::string MetaIndexURI;
 
    /** \brief A "URI-style" description of the meta-index file */
-   string MetaIndexURIDesc;
+   std::string MetaIndexURIDesc;
 
    /** \brief A brief description of the meta-index file */
-   string MetaIndexShortDesc;
+   std::string MetaIndexShortDesc;
 
    /** \brief The URI of the detached meta-signature file if the clearsigned one failed. */
-   string MetaSigURI;
+   std::string MetaSigURI;
 
    /** \brief A "URI-style" description of the meta-signature file */
-   string MetaSigURIDesc;
+   std::string MetaSigURIDesc;
 
    /** \brief A brief description of the meta-signature file */
-   string MetaSigShortDesc;
+   std::string MetaSigShortDesc;
 
 public:
-   void Failed(string Message,pkgAcquire::MethodConfig *Cnf);
-   virtual string Custom600Headers();
+   void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
+   virtual std::string Custom600Headers();
 
    /** \brief Create a new pkgAcqMetaClearSig. */
    pkgAcqMetaClearSig(pkgAcquire *Owner,
-               string const &URI, string const &URIDesc, string const &ShortDesc,
-               string const &MetaIndexURI, string const &MetaIndexURIDesc, string const &MetaIndexShortDesc,
-               string const &MetaSigURI, string const &MetaSigURIDesc, string const &MetaSigShortDesc,
-               const vector<struct IndexTarget*>* IndexTargets,
+               std::string const &URI, std::string const &URIDesc, std::string const &ShortDesc,
+               std::string const &MetaIndexURI, std::string const &MetaIndexURIDesc, std::string const &MetaIndexShortDesc,
+               std::string const &MetaSigURI, std::string const &MetaSigURIDesc, std::string const &MetaSigShortDesc,
+               const std::vector<struct IndexTarget*>* IndexTargets,
                indexRecords* MetaIndexParser);
 };
                                                                        /*}}}*/
    /** \brief A location in which the actual filename of the package
     *  should be stored.
     */
-   string &StoreFilename;
+   std::string &StoreFilename;
 
    /** \brief The next file for this version to try to download. */
    pkgCache::VerFileIterator Vf;
    
    public:
    
-   virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf);
-   virtual void Done(string Message,unsigned long long Size,string Hash,
+   virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
+   virtual void Done(std::string Message,unsigned long long Size,std::string Hash,
                     pkgAcquire::MethodConfig *Cnf);
-   virtual string DescURI() {return Desc.URI;};
-   virtual string ShortDesc() {return Desc.ShortDesc;};
+   virtual std::string DescURI() {return Desc.URI;};
+   virtual std::string ShortDesc() {return Desc.ShortDesc;};
    virtual void Finished();
-   virtual string HashSum() {return ExpectedHash.toStr(); };
+   virtual std::string HashSum() {return ExpectedHash.toStr(); };
    virtual bool IsTrusted();
    
    /** \brief Create a new pkgAcqArchive.
     */
    pkgAcqArchive(pkgAcquire *Owner,pkgSourceList *Sources,
                 pkgRecords *Recs,pkgCache::VerIterator const &Version,
-                string &StoreFilename);
+                std::string &StoreFilename);
 };
                                                                        /*}}}*/
 /** \brief Retrieve an arbitrary file to the current directory.                {{{
    public:
    
    // Specialized action members
-   virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf);
-   virtual void Done(string Message,unsigned long long Size,string CalcHash,
+   virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
+   virtual void Done(std::string Message,unsigned long long Size,std::string CalcHash,
                     pkgAcquire::MethodConfig *Cnf);
-   virtual string DescURI() {return Desc.URI;};
-   virtual string HashSum() {return ExpectedHash.toStr(); };
-   virtual string Custom600Headers();
+   virtual std::string DescURI() {return Desc.URI;};
+   virtual std::string HashSum() {return ExpectedHash.toStr(); };
+   virtual std::string Custom600Headers();
 
    /** \brief Create a new pkgAcqFile object.
     *
     * is the absolute name to which the file should be downloaded.
     */
 
-   pkgAcqFile(pkgAcquire *Owner, string URI, string Hash, unsigned long long Size,
-             string Desc, string ShortDesc,
-             const string &DestDir="", const string &DestFilename="",
+   pkgAcqFile(pkgAcquire *Owner, std::string URI, std::string Hash, unsigned long long Size,
+             std::string Desc, std::string ShortDesc,
+             const std::string &DestDir="", const std::string &DestFilename="",
              bool IsIndexFile=false);
 };
                                                                        /*}}}*/
 
 #ifndef PKGLIB_ACQUIRE_METHOD_H
 #define PKGLIB_ACQUIRE_METHOD_H
 
-#include <apt-pkg/configuration.h>
-#include <apt-pkg/strutl.h>
-
 #include <stdarg.h>
 
+#include <string>
+#include <vector>
+
 class Hashes;
 class pkgAcqMethod
 {
 
 #include <apt-pkg/sptr.h>
 #include <apt-pkg/acquire-item.h>
 #include <apt-pkg/edsp.h>
+#include <apt-pkg/sourcelist.h>
+#include <apt-pkg/fileutl.h>
+#include <apt-pkg/progress.h>
 
 #include <sys/types.h>
 #include <cstdlib>
 
 
 #include <apt-pkg/packagemanager.h>
 #include <apt-pkg/depcache.h>
-#include <apt-pkg/acquire.h>
 
 #include <iostream>
 
+class pkgAcquireStatus;
+
 class pkgSimulate : public pkgPackageManager                           /*{{{*/
 {
    protected:
 
 #include <apt-pkg/pkgsystem.h>
 #include <apt-pkg/acquire-item.h>
 #include <apt-pkg/fileutl.h>
+#include <apt-pkg/progress.h>
 
 #include <apti18n.h>
                                                                        /*}}}*/
 
 #ifndef PKGLIB_CACHEFILE_H
 #define PKGLIB_CACHEFILE_H
 
-
 #include <apt-pkg/depcache.h>
-#include <apt-pkg/acquire.h>
-#include <apt-pkg/policy.h>
-#include <apt-pkg/sourcelist.h>
+#include <apt-pkg/macros.h>
+
+class pkgPolicy;
+class pkgSourceList;
+class OpProgress;
 
 class pkgCacheFile
 {
 
 #include<iterator>
 
 #include<string.h>
+
 // abstract Iterator template                                          /*{{{*/
 /* This template provides the very basic iterator methods we
    need to have for doing some walk-over-the-cache magic */
 
 #include <config.h>
 
 #include <apt-pkg/aptconfiguration.h>
+#include <apt-pkg/cachefile.h>
 #include <apt-pkg/cachefilter.h>
 #include <apt-pkg/cacheset.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/versionmatch.h>
+#include <apt-pkg/pkgrecords.h>
+#include <apt-pkg/policy.h>
 
 #include <vector>
 
        std::string ver;
        bool verIsRel = false;
        size_t const vertag = pkg.find_last_of("/=");
-       if (vertag != string::npos) {
+       if (vertag != std::string::npos) {
                ver = pkg.substr(vertag+1);
                verIsRel = (pkg[vertag] == '/');
                pkg.erase(vertag);
                errors = helper.showErrors(false);
        for (PackageSet::const_iterator P = pkgset.begin();
             P != pkgset.end(); ++P) {
-               if (vertag == string::npos) {
+               if (vertag == std::string::npos) {
                        verset.insert(VersionSet::FromPackage(Cache, P, fallback, helper));
                        continue;
                }
 
 #include <set>
 #include <string>
 
-#include <apt-pkg/cachefile.h>
+#include <apt-pkg/error.h>
 #include <apt-pkg/pkgcache.h>
                                                                        /*}}}*/
+
+class pkgCacheFile;
+
 namespace APT {
 class PackageSet;
 class VersionSet;
                        ShowError(ShowError), ErrorType(ErrorType) {};
        virtual ~CacheSetHelper() {};
 
-       virtual void showTaskSelection(PackageSet const &pkgset, string const &pattern) {};
-       virtual void showRegExSelection(PackageSet const &pkgset, string const &pattern) {};
+       virtual void showTaskSelection(PackageSet const &pkgset, std::string const &pattern) {};
+       virtual void showRegExSelection(PackageSet const &pkgset, std::string const &pattern) {};
        virtual void showSelectedVersion(pkgCache::PkgIterator const &Pkg, pkgCache::VerIterator const Ver,
-                                string const &ver, bool const &verIsRel) {};
+                                std::string const &ver, bool const &verIsRel) {};
 
        virtual pkgCache::PkgIterator canNotFindPkgName(pkgCacheFile &Cache, std::string const &str);
        virtual PackageSet canNotFindTask(pkgCacheFile &Cache, std::string pattern);
                inline pkgCache::VerFileIterator FileList() const { return (**this).FileList(); };
                inline bool Downloadable() const { return (**this).Downloadable(); };
                inline const char *PriorityType() const { return (**this).PriorityType(); };
-               inline string RelStr() const { return (**this).RelStr(); };
+               inline std::string RelStr() const { return (**this).RelStr(); };
                inline bool Automatic() const { return (**this).Automatic(); };
                inline pkgCache::VerFileIterator NewestFile() const { return (**this).NewestFile(); };
        };
 
 #include<apt-pkg/strutl.h>
 #include<apt-pkg/cdrom.h>
 #include<apt-pkg/aptconfiguration.h>
+#include<apt-pkg/configuration.h>
+#include<apt-pkg/fileutl.h>
 
 #include<sstream>
 #include<fstream>
 
 #ifndef PKGLIB_CDROM_H
 #define PKGLIB_CDROM_H
 
-#include<apt-pkg/init.h>
 #include<string>
 #include<vector>
 
+class Configuration;
+class OpProgress;
 
 class pkgCdromStatus                                                   /*{{{*/
 {
 
 #include <apt-pkg/error.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/aptconfiguration.h>
+#include <apt-pkg/fileutl.h>
 
 #include <dirent.h>
 #include <sys/stat.h>
 
 // Include files                                                       /*{{{*/
 #include<config.h>
 
+#include <apt-pkg/configuration.h>
 #include <apt-pkg/cmndline.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/strutl.h>
 
 #ifndef PKGLIB_CMNDLINE_H
 #define PKGLIB_CMNDLINE_H
 
-
-
-#include <apt-pkg/configuration.h>
+class Configuration;
 
 class CommandLine
 {
 
 
 #include <apt-pkg/mmap.h>
 #include <apt-pkg/error.h>
+#include <apt-pkg/fileutl.h>
 
 #include <sys/mman.h>
 #include <sys/stat.h>
 
 
 
 #include <string>
-#include <apt-pkg/fileutl.h>
+
+class FileFd;
 
 /* This should be a 32 bit type, larger tyes use too much ram and smaller
    types are too small. Where ever possible 'unsigned long' should be used
 
 #include <config.h>
 
 #include <apt-pkg/configuration.h>
+#include <apt-pkg/strutl.h>
 #include <apt-pkg/fileutl.h>
+
 #include <iostream>
 #include <stdio.h>
 #include <stdlib.h>
 
 #ifndef NETRC_H
 #define NETRC_H
 
-#include <apt-pkg/strutl.h>
+#include <string>
 
 #define DOT_CHAR "."
 #define DIR_CHAR "/"
 
+class URI;
+
 // Assume: password[0]=0, host[0] != 0.
 // If login[0] = 0, search for login and password within a machine section
 // in the netrc.
 
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/aptconfiguration.h>
 #include <apt-pkg/strutl.h>
+#include <apt-pkg/fileutl.h>
 #include <apt-pkg/crc-16.h>
 #include <apt-pkg/md5.h>
 #include <apt-pkg/macros.h>
 
 #define PKGLIB_DEBLISTPARSER_H
 
 #include <apt-pkg/pkgcachegen.h>
-#include <apt-pkg/indexfile.h>
 #include <apt-pkg/tagfile.h>
 
 class debListParser : public pkgCacheGenerator::ListParser
 
 #include <apt-pkg/debmetaindex.h>
 #include <apt-pkg/debindexfile.h>
 #include <apt-pkg/strutl.h>
+#include <apt-pkg/fileutl.h>
 #include <apt-pkg/acquire-item.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/aptconfiguration.h>
+#include <apt-pkg/indexrecords.h>
+#include <apt-pkg/sourcelist.h>
 #include <apt-pkg/error.h>
 
 #include <set>
 
 #define PKGLIB_DEBMETAINDEX_H
 
 #include <apt-pkg/metaindex.h>
-#include <apt-pkg/sourcelist.h>
 
 #include <map>
+#include <string>
+#include <vector>
 
 class debReleaseIndex : public metaIndex {
    public:
    class debSectionEntry
    {
       public:
-      debSectionEntry (string const &Section, bool const &IsSrc);
-      string const Section;
+      debSectionEntry (std::string const &Section, bool const &IsSrc);
+      std::string const Section;
       bool const IsSrc;
    };
 
    private:
    /** \brief dpointer placeholder (for later in case we need it) */
    void *d;
-   std::map<string, vector<debSectionEntry const*> > ArchEntries;
+   std::map<std::string, std::vector<debSectionEntry const*> > ArchEntries;
    enum { ALWAYS_TRUSTED, NEVER_TRUSTED, CHECK_TRUST } Trusted;
 
    public:
 
-   debReleaseIndex(string const &URI, string const &Dist);
-   debReleaseIndex(string const &URI, string const &Dist, bool const Trusted);
+   debReleaseIndex(std::string const &URI, std::string const &Dist);
+   debReleaseIndex(std::string const &URI, std::string const &Dist, bool const Trusted);
    virtual ~debReleaseIndex();
 
-   virtual string ArchiveURI(string const &File) const {return URI + File;};
+   virtual std::string ArchiveURI(std::string const &File) const {return URI + File;};
    virtual bool GetIndexes(pkgAcquire *Owner, bool const &GetAll=false) const;
-   vector <struct IndexTarget *>* ComputeIndexTargets() const;
-   string Info(const char *Type, string const &Section, string const &Arch="") const;
-   string MetaIndexInfo(const char *Type) const;
-   string MetaIndexFile(const char *Types) const;
-   string MetaIndexURI(const char *Type) const;
-   string IndexURI(const char *Type, string const &Section, string const &Arch="native") const;
-   string IndexURISuffix(const char *Type, string const &Section, string const &Arch="native") const;
-   string SourceIndexURI(const char *Type, const string &Section) const;
-   string SourceIndexURISuffix(const char *Type, const string &Section) const;
-   string TranslationIndexURI(const char *Type, const string &Section) const;
-   string TranslationIndexURISuffix(const char *Type, const string &Section) const;
-   virtual vector <pkgIndexFile *> *GetIndexFiles();
+   std::vector <struct IndexTarget *>* ComputeIndexTargets() const;
+   std::string Info(const char *Type, std::string const &Section, std::string const &Arch="") const;
+   std::string MetaIndexInfo(const char *Type) const;
+   std::string MetaIndexFile(const char *Types) const;
+   std::string MetaIndexURI(const char *Type) const;
+   std::string IndexURI(const char *Type, std::string const &Section, std::string const &Arch="native") const;
+   std::string IndexURISuffix(const char *Type, std::string const &Section, std::string const &Arch="native") const;
+   std::string SourceIndexURI(const char *Type, const std::string &Section) const;
+   std::string SourceIndexURISuffix(const char *Type, const std::string &Section) const;
+   std::string TranslationIndexURI(const char *Type, const std::string &Section) const;
+   std::string TranslationIndexURISuffix(const char *Type, const std::string &Section) const;
+   virtual std::vector <pkgIndexFile *> *GetIndexFiles();
 
    void SetTrusted(bool const Trusted);
    virtual bool IsTrusted() const;
 
-   void PushSectionEntry(vector<string> const &Archs, const debSectionEntry *Entry);
-   void PushSectionEntry(string const &Arch, const debSectionEntry *Entry);
+   void PushSectionEntry(std::vector<std::string> const &Archs, const debSectionEntry *Entry);
+   void PushSectionEntry(std::string const &Arch, const debSectionEntry *Entry);
    void PushSectionEntry(const debSectionEntry *Entry);
 };
 
 
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/aptconfiguration.h>
+#include <apt-pkg/fileutl.h>
+
 #include <langinfo.h>
                                                                        /*}}}*/
 
 
 #define PKGLIB_DEBRECORDS_H
 
 #include <apt-pkg/pkgrecords.h>
-#include <apt-pkg/indexfile.h>
 #include <apt-pkg/tagfile.h>
+#include <apt-pkg/fileutl.h>
 
 class debRecordParser : public pkgRecords::Parser
 {
 
 #define PKGLIB_DEBSYSTEM_H
 
 #include <apt-pkg/pkgsystem.h>
+#include <apt-pkg/pkgcache.h>
 
 class debSystemPrivate;
-
 class debStatusIndex;
+class pkgDepCache;
+
 class debSystem : public pkgSystem
 {
    // private d-pointer
 
 #include <apt-pkg/error.h>
 #include <apt-pkg/sptr.h>
 #include <apt-pkg/algorithms.h>
-
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/aptconfiguration.h>
 #include <apt-pkg/pkgsystem.h>
 #include <apt-pkg/tagfile.h>
+#include <apt-pkg/progress.h>
 
 #include <iostream>
 #include <sstream>
 
 
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/pkgcache.h>
-#include <apt-pkg/progress.h>
-#include <apt-pkg/error.h>
 
 #include <vector>
 #include <memory>
 #include <set>
+#include <list>
+
+class OpProgress;
 
 class pkgDepCache : protected pkgCache::Namespace
 {
 
 
 #include <apt-pkg/edsp.h>
 #include <apt-pkg/error.h>
+#include <apt-pkg/cacheset.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/version.h>
 #include <apt-pkg/policy.h>
 #include <apt-pkg/tagfile.h>
+#include <apt-pkg/fileutl.h>
+#include <apt-pkg/progress.h>
 
 #include <limits>
 #include <stdio.h>
 
+#include <string>
+
 #include <apti18n.h>
                                                                        /*}}}*/
 
+using std::string;
+
 // we could use pkgCache::DepType and ::Priority, but these would be localized strings…
 const char * const EDSP::PrioMap[] = {0, "important", "required", "standard",
                                      "optional", "extra"};
 
 #ifndef PKGLIB_EDSP_H
 #define PKGLIB_EDSP_H
 
-#include <apt-pkg/depcache.h>
-#include <apt-pkg/cacheset.h>
-#include <apt-pkg/progress.h>
+#include <apt-pkg/pkgcache.h>
 
+#include <list>
 #include <string>
 
+namespace APT {
+       class PackageSet;
+};
+class pkgDepCache;
+class OpProgress;
+
 class EDSP                                                             /*{{{*/
 {
        // we could use pkgCache::DepType and ::Priority, but these would be localized strings…
 
 #include <apt-pkg/progress.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/strutl.h>
+#include <apt-pkg/fileutl.h>
 #include <apt-pkg/acquire-item.h>
 
 #include <sys/stat.h>
 
 #ifndef PKGLIB_EDSPINDEXFILE_H
 #define PKGLIB_EDSPINDEXFILE_H
 
-#include <apt-pkg/indexfile.h>
 #include <apt-pkg/debindexfile.h>
 
 class edspIndex : public debStatusIndex
 
 #define PKGLIB_EDSPLISTPARSER_H
 
 #include <apt-pkg/deblistparser.h>
-#include <apt-pkg/pkgcachegen.h>
-#include <apt-pkg/indexfile.h>
-#include <apt-pkg/tagfile.h>
+
+class FileFd;
 
 class edspListParser : public debListParser
 {
 
 #include <apt-pkg/pkgcache.h>
 #include <apt-pkg/srcrecords.h>
 #include <apt-pkg/pkgrecords.h>
+#include <apt-pkg/macros.h>
 
 class pkgAcquire;
 class pkgCacheGenerator;
 class OpProgress;
+
 class pkgIndexFile
 {
    protected:
 
 #include <apt-pkg/error.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/configuration.h>
+#include <apt-pkg/fileutl.h>
+#include <apt-pkg/hashes.h>
+
 #include <sys/stat.h>
 #include <clocale>
 
 
 
 
 #include <apt-pkg/pkgcache.h>
-#include <apt-pkg/fileutl.h>
 #include <apt-pkg/hashes.h>
 
 #include <map>
 
 #include <apt-pkg/init.h>
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/error.h>
+#include <apt-pkg/pkgsystem.h>
+#include <apt-pkg/configuration.h>
 
 #include <cstdlib>
 #include <sys/stat.h>
 
 #ifndef PKGLIB_INIT_H
 #define PKGLIB_INIT_H
 
-#include <apt-pkg/configuration.h>
-#include <apt-pkg/pkgsystem.h>
+class pkgSystem;
+class Configuration;
 
 // These lines are extracted by the makefiles and the buildsystem
 // Increasing MAJOR or MINOR results in the need of recompiling all
 
 
 #include <string>
 #include <apt-pkg/pkgcache.h>
-#include <apt-pkg/srcrecords.h>
-#include <apt-pkg/pkgrecords.h>
 #include <apt-pkg/indexfile.h>
-#include <apt-pkg/vendor.h>
 
 class pkgAcquire;
 class pkgCacheGenerator;
 
 #ifndef PKGLIB_PACKAGEMANAGER_H
 #define PKGLIB_PACKAGEMANAGER_H
 
+#include <apt-pkg/pkgcache.h>
 
 #include <string>
 #include <iostream>
-#include <apt-pkg/pkgcache.h>
-#include <apt-pkg/depcache.h>
 #include <set>
 
 class pkgAcquire;
 
 #include <apt-pkg/pkgsystem.h>
 #include <apt-pkg/macros.h>
 #include <apt-pkg/tagfile.h>
+#include <apt-pkg/metaindex.h>
+#include <apt-pkg/fileutl.h>
 
 #include <vector>
 #include <sys/stat.h>
 
 #ifndef PKGLIB_PKGSYSTEM_H
 #define PKGLIB_PKGSYSTEM_H
 
+#include <apt-pkg/pkgcache.h>
 
-#include <apt-pkg/depcache.h>
 #include <vector>
-    
+
+class pkgDepCache;
 class pkgPackageManager;
 class pkgVersioningSystem;
 class Configuration;
 class pkgIndexFile;
+class PkgFileIterator;
 
 class pkgSystem
 {   
 
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/configuration.h>
+#include <apt-pkg/metaindex.h>
+#include <apt-pkg/indexfile.h>
 
 #include <fstream>
 
 
 #include <vector>
 #include <map>
 #include <apt-pkg/pkgcache.h>
-#include <apt-pkg/metaindex.h>
 
 using std::string;
 using std::vector;
     
 
-class pkgAquire;
+class pkgAcquire;
+class pkgIndexFile;
+class metaIndex;
+
 class pkgSourceList
 {
    public:
 
 #include <apt-pkg/error.h>
 #include <apt-pkg/sourcelist.h>
 #include <apt-pkg/strutl.h>
+#include <apt-pkg/metaindex.h>
 
 #include <apti18n.h>
                                                                        /*}}}*/
 
 #include <apt-pkg/tagfile.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/strutl.h>
+#include <apt-pkg/fileutl.h>
 
 #include <string>
 #include <stdio.h>
 
 #ifndef PKGLIB_TAGFILE_H
 #define PKGLIB_TAGFILE_H
 
-
-#include <apt-pkg/fileutl.h>
 #include <stdio.h>
 
+#include <string>
+
+class FileFd;
+
 class pkgTagSection
 {
    const char *Section;
 
 
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/error.h>
+#include <apt-pkg/configuration.h>
 #include <apti18n.h>
 
 #if __GNUC__ >= 4
        #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
 #endif
 
+#include <apt-pkg/vendor.h>
 #include <apt-pkg/vendorlist.h>
 
 using std::string;
 
 
 #include <string>
 #include <vector>
-#include <apt-pkg/vendor.h>
-#include <apt-pkg/configuration.h>
 #include <apt-pkg/macros.h>
 
+class Vendor;
+class Configuration;
+
 class __deprecated pkgVendorList
 {
    protected:
 
 #ifndef PKGLIB_VERSION_H
 #define PKGLIB_VERSION_H
 
-
-#include <apt-pkg/strutl.h>    
+#include <apt-pkg/strutl.h>
 #include <string>
 
 class pkgVersioningSystem
 
 
 #include <apt-pkg/acquire.h>
 
+#include <string>
+
 class AcqTextStatus : public pkgAcquireStatus
 {
    unsigned int &ScreenWidth;
    
    public:
    
-   virtual bool MediaChange(string Media,string Drive);
+   virtual bool MediaChange(std::string Media,std::string Drive);
    virtual void IMSHit(pkgAcquire::ItemDesc &Itm);
    virtual void Fetch(pkgAcquire::ItemDesc &Itm);
    virtual void Done(pkgAcquire::ItemDesc &Itm);
 
 #include<config.h>
 
 #include <apt-pkg/error.h>
-#include <apt-pkg/pkgcachegen.h>
 #include <apt-pkg/cachefile.h>
 #include <apt-pkg/cacheset.h>
 #include <apt-pkg/init.h>
 #include <apt-pkg/sourcelist.h>
 #include <apt-pkg/cmndline.h>
 #include <apt-pkg/strutl.h>
+#include <apt-pkg/fileutl.h>
 #include <apt-pkg/pkgrecords.h>
 #include <apt-pkg/srcrecords.h>
 #include <apt-pkg/version.h>
 #include <apt-pkg/tagfile.h>
 #include <apt-pkg/algorithms.h>
 #include <apt-pkg/sptr.h>
+#include <apt-pkg/pkgsystem.h>
+#include <apt-pkg/indexfile.h>
+#include <apt-pkg/metaindex.h>
 
 #include <cassert>
 #include <locale.h>
 #include <regex.h>
 #include <stdio.h>
 #include <iomanip>
+#include <algorithm>
 
 #include <apti18n.h>
                                                                        /*}}}*/
 
 #include <apt-pkg/acquire.h>
 #include <apt-pkg/acquire-item.h>
 #include <apt-pkg/cdrom.h>
+#include <apt-pkg/configuration.h>
+#include <apt-pkg/pkgsystem.h>
 
 #include <locale.h>
 #include <iostream>
 
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/aptconfiguration.h>
+#include <apt-pkg/pkgsystem.h>
 
 #include <locale.h>
 #include <iostream>
 
 #include <config.h>
 
 #include <cstdio>
+#include <iostream>
                                                                        /*}}}*/
 
 // ShowHelp - Show a help screen                                       /*{{{*/
 
 #include <apt-pkg/error.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/fileutl.h>
+#include <apt-pkg/pkgsystem.h>
 
 #include <stdio.h>
 #include <string.h>
 
 #include <apt-pkg/algorithms.h>
 #include <apt-pkg/acquire-item.h>
 #include <apt-pkg/strutl.h>
+#include <apt-pkg/fileutl.h>
 #include <apt-pkg/clean.h>
 #include <apt-pkg/srcrecords.h>
 #include <apt-pkg/version.h>
 #include <apt-pkg/sptr.h>
 #include <apt-pkg/md5.h>
 #include <apt-pkg/versionmatch.h>
+#include <apt-pkg/progress.h>
+#include <apt-pkg/pkgsystem.h>
+#include <apt-pkg/pkgrecords.h>
+#include <apt-pkg/indexfile.h>
 
 #include "acqprogress.h"
 
 
 #include <apt-pkg/cmndline.h>
 #include <apt-pkg/init.h>
 #include <apt-pkg/cachefile.h>
+#include <apt-pkg/cacheset.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/edsp.h>
 #include <apt-pkg/algorithms.h>
 #include <apt-pkg/fileutl.h>
+#include <apt-pkg/pkgsystem.h>
 
 #include <config.h>
 #include <apti18n.h>
 
 #include <apt-pkg/error.h>
 #include <apt-pkg/init.h>
 #include <apt-pkg/strutl.h>
+#include <apt-pkg/pkgsystem.h>
 
 #include <algorithm>
 
 
 #include <apt-pkg/cmndline.h>
 #include <apt-pkg/init.h>
 #include <apt-pkg/strutl.h>
+#include <apt-pkg/fileutl.h>
+#include <apt-pkg/pkgsystem.h>
 
 #include <vector>
 #include <algorithm>
 
 
   [ David Kalnischkies ]
   * do not pollute namespace in the headers with using (Closes: #500198)
+  * use forward declaration in headers if possible instead of includes
 
- -- David Kalnischkies <kalnischkies@gmail.com>  Mon, 19 Sep 2011 13:25:58 +0200
+ -- David Kalnischkies <kalnischkies@gmail.com>  Mon, 19 Sep 2011 19:13:48 +0200
 
 apt (0.8.16~exp6) experimental; urgency=low
 
 
 #include <apt-pkg/sha2.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/configuration.h>
+#include <apt-pkg/fileutl.h>
     
 #include <netinet/in.h>       // htonl, etc
 
 
 #define CACHEDB_H
 
 
+#include <apt-pkg/debfile.h>
 
 #include <db.h>
-#include <string>
-#include <apt-pkg/debfile.h>
 #include <inttypes.h>
 #include <sys/stat.h>
 #include <errno.h>
-    
+#include <string>
+
 #include "contents.h"
-    
+
 class CacheDB
 {
    protected:
 
     
 #include <stdlib.h>
 #include <stdio.h>
-#include <apt-pkg/debfile.h>
 #include <apt-pkg/dirstream.h>
 
+class debDebFile;
+
 class GenContents
 {
    struct Node
 
 #ifndef MULTICOMPRESS_H
 #define MULTICOMPRESS_H
 
-
-
-#include <string>
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/aptconfiguration.h>
+
+#include <string>
 #include <stdio.h>
 #include <sys/types.h>
     
 
 #include <set>
 
 #include "cachedb.h"
-#include "multicompress.h"
 #include "override.h"
 #include "apt-ftparchive.h"
 
 using std::endl;
 using std::vector;
 using std::map;
-    
+
 class FTWScanner
 {
    protected:
    virtual ~FTWScanner() {};
 };
 
+class MultiCompress;
+
 class TranslationWriter
 {
    MultiCompress *Comp;
 
 #include <apt-pkg/acquire-method.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/hashes.h>
+#include <apt-pkg/configuration.h>
 
 #include <sys/stat.h>
 #include <unistd.h>
 
 #include <apt-pkg/error.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/fileutl.h>
+#include <apt-pkg/strutl.h>
 #include <apt-pkg/hashes.h>
 
 #include <sys/stat.h>
 
 
 #include <apt-pkg/error.h>
 #include <apt-pkg/fileutl.h>
+#include <apt-pkg/strutl.h>
+#include <apt-pkg/acquire-method.h>
 
 #include <stdio.h>
 #include <errno.h>
 
 #define CONNECT_H
 
 #include <string>
-#include <apt-pkg/acquire-method.h>
+
+class pkgAcqMethod;
 
 bool Connect(std::string To,int Port,const char *Service,int DefPort,
             int &Fd,unsigned long TimeOut,pkgAcqMethod *Owner);
 
 #include <config.h>
 
 #include <apt-pkg/fileutl.h>
+#include <apt-pkg/strutl.h>
 #include <apt-pkg/acquire-method.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/hashes.h>
 
 #include <apt-pkg/error.h>
 #include <apt-pkg/hashes.h>
 #include <apt-pkg/fileutl.h>
+#include <apt-pkg/strutl.h>
 
 #include <sys/stat.h>
 #include <unistd.h>
 
 #include <apt-pkg/error.h>
 #include <apt-pkg/hashes.h>
 #include <apt-pkg/netrc.h>
+#include <apt-pkg/configuration.h>
 
 #include <sys/stat.h>
 #include <sys/time.h>
 
 #ifndef APT_FTP_H
 #define APT_FTP_H
 
+#include <apt-pkg/strutl.h>
+
+#include <string>
+
 class FTPConn
 {
    char Buffer[1024*10];
 
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/indexcopy.h>
+#include <apt-pkg/configuration.h>
 
 #include <utime.h>
 #include <stdio.h>
 
 
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/acquire-method.h>
+#include <apt-pkg/configuration.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/hashes.h>
 #include <apt-pkg/netrc.h>
    clog << "Got " << InP << " in " << Diff << " at " << InP/Diff << endl;*/
 }
                                                                        /*}}}*/
+CircleBuf::~CircleBuf()
+{
+   delete [] Buf;
+   delete Hash;
+}
 
 // ServerState::ServerState - Constructor                              /*{{{*/
 // ---------------------------------------------------------------------
 
 
 #define MAXLEN 360
 
-#include <apt-pkg/hashes.h>
+#include <apt-pkg/strutl.h>
+
+#include <string>
 
 using std::cout;
 using std::endl;
 
 class HttpMethod;
+class Hashes;
 
 class CircleBuf
 {
    void Stats();
 
    CircleBuf(unsigned long long Size);
-   ~CircleBuf() {delete [] Buf; delete Hash;};
+   ~CircleBuf();
 };
 
 struct ServerState
 
 #include <apt-pkg/error.h>
 #include <apt-pkg/hashes.h>
 #include <apt-pkg/netrc.h>
+#include <apt-pkg/configuration.h>
 
 #include <sys/stat.h>
 #include <sys/time.h>
 
 using std::endl;
 
 class HttpsMethod;
-
+class FileFd;
 
 class HttpsMethod : public pkgAcqMethod
 {
    };
 };
 
+#include <apt-pkg/strutl.h>
 URI Proxy;
 
 #endif
 
 #include <apt-pkg/error.h>
 #include <apt-pkg/hashes.h>
 #include <apt-pkg/sourcelist.h>
-
+#include <apt-pkg/configuration.h>
+#include <apt-pkg/metaindex.h>
 
 #include <algorithm>
 #include <fstream>
 
 #ifndef APT_MIRROR_H
 #define APT_MIRROR_H
 
-
 #include <iostream>
+#include <string>
+#include <vector>
 
 using std::cout;
 using std::cerr;
 {
    FetchResult Res;
    // we simply transform between BaseUri and Mirror
-   string BaseUri;    // the original mirror://... url
-   string Mirror;     // the selected mirror uri (http://...)
-   vector<string> AllMirrors; // all available mirrors
-   string MirrorFile; // the file that contains the list of mirrors
+   std::string BaseUri;    // the original mirror://... url
+   std::string Mirror;     // the selected mirror uri (http://...)
+   std::vector<std::string> AllMirrors; // all available mirrors
+   std::string MirrorFile; // the file that contains the list of mirrors
    bool DownloadedMirrorFile; // already downloaded this session
-   string Dist;       // the target distrubtion (e.g. sid, oneiric)
+   std::string Dist;       // the target distrubtion (e.g. sid, oneiric)
 
    bool Debug;
 
  protected:
-   bool DownloadMirrorFile(string uri);
-   bool RandomizeMirrorFile(string file);
-   string GetMirrorFileName(string uri);
+   bool DownloadMirrorFile(std::string uri);
+   bool RandomizeMirrorFile(std::string file);
+   std::string GetMirrorFileName(std::string uri);
    bool InitMirrors();
    bool TryNextMirror();
    void CurrentQueueUriToMirror();
-   bool Clean(string dir);
+   bool Clean(std::string dir);
    
    // we need to overwrite those to transform the url back
-   virtual void Fail(string Why, bool Transient = false);
+   virtual void Fail(std::string Why, bool Transient = false);
    virtual void URIStart(FetchResult &Res);
    virtual void URIDone(FetchResult &Res,FetchResult *Alt = 0);
-   virtual bool Configuration(string Message);
+   virtual bool Configuration(std::string Message);
 
  public:
    MirrorMethod();
 
 #include <apt-pkg/acquire-method.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/hashes.h>
+#include <apt-pkg/configuration.h>
 
 #include <sys/stat.h>
 #include <sys/uio.h>
 
 #include <config.h>
 
 #include <apt-pkg/error.h>
+#include <apt-pkg/fileutl.h>
+#include <apt-pkg/hashes.h>
+#include <apt-pkg/configuration.h>
 
 #include <sys/stat.h>
 #include <sys/time.h>
 
 
 #include <string>
 #include <apt-pkg/strutl.h>
-#include <apt-pkg/hashes.h>
-#include <apt-pkg/acquire-method.h>
-#include <apt-pkg/fileutl.h>
+
+class Hashes;
+class FileFd;
 
 class RSHConn
 {
    ~RSHConn();
 };
 
+#include <apt-pkg/acquire-method.h>
+
 class RSHMethod : public pkgAcqMethod
 {
    virtual bool Fetch(FetchItem *Itm);
 
 #include <apt-pkg/debfile.h>
 #include <apt-pkg/error.h>
+#include <apt-pkg/fileutl.h>
 
 #include <iostream>
 #include <unistd.h>
 
 #include <assert.h>
 
 #include <vector>
+#include <iostream>
 
 int main()
 {
 
 #include <apt-pkg/extract.h>
 #include <apt-pkg/init.h>
 #include <apt-pkg/strutl.h>
+#include <apt-pkg/fileutl.h>
+#include <apt-pkg/pkgsystem.h>
 
 #include <stdio.h>
 #include <stdlib.h>