From 472ff00ef2e48383805d281c6364ec27839e3f4d Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 19 Sep 2011 19:14:19 +0200 Subject: use forward declaration in headers if possible instead of includes --- methods/bzip2.cc | 1 + methods/cdrom.cc | 1 + methods/connect.cc | 2 ++ methods/connect.h | 3 ++- methods/copy.cc | 1 + methods/file.cc | 1 + methods/ftp.cc | 1 + methods/ftp.h | 4 ++++ methods/gpgv.cc | 1 + methods/http.cc | 6 ++++++ methods/http.h | 7 +++++-- methods/https.cc | 1 + methods/https.h | 3 ++- methods/mirror.cc | 3 ++- methods/mirror.h | 25 +++++++++++++------------ methods/rred.cc | 1 + methods/rsh.cc | 3 +++ methods/rsh.h | 8 +++++--- 18 files changed, 52 insertions(+), 20 deletions(-) (limited to 'methods') diff --git a/methods/bzip2.cc b/methods/bzip2.cc index ad5db6cfb..8e7e46557 100644 --- a/methods/bzip2.cc +++ b/methods/bzip2.cc @@ -20,6 +20,7 @@ #include #include #include +#include #include #include diff --git a/methods/cdrom.cc b/methods/cdrom.cc index bc115d259..e7114b168 100644 --- a/methods/cdrom.cc +++ b/methods/cdrom.cc @@ -16,6 +16,7 @@ #include #include #include +#include #include #include diff --git a/methods/connect.cc b/methods/connect.cc index ba2264faa..9a092a43c 100644 --- a/methods/connect.cc +++ b/methods/connect.cc @@ -15,6 +15,8 @@ #include #include +#include +#include #include #include diff --git a/methods/connect.h b/methods/connect.h index 0afa00919..bbe1bb35d 100644 --- a/methods/connect.h +++ b/methods/connect.h @@ -11,7 +11,8 @@ #define CONNECT_H #include -#include + +class pkgAcqMethod; bool Connect(std::string To,int Port,const char *Service,int DefPort, int &Fd,unsigned long TimeOut,pkgAcqMethod *Owner); diff --git a/methods/copy.cc b/methods/copy.cc index fe2918469..f8d58e479 100644 --- a/methods/copy.cc +++ b/methods/copy.cc @@ -12,6 +12,7 @@ #include #include +#include #include #include #include diff --git a/methods/file.cc b/methods/file.cc index d58652e6e..5025c996d 100644 --- a/methods/file.cc +++ b/methods/file.cc @@ -19,6 +19,7 @@ #include #include #include +#include #include #include diff --git a/methods/ftp.cc b/methods/ftp.cc index 861647aea..2ca0ac6f7 100644 --- a/methods/ftp.cc +++ b/methods/ftp.cc @@ -22,6 +22,7 @@ #include #include #include +#include #include #include diff --git a/methods/ftp.h b/methods/ftp.h index 7088e0954..2634f0732 100644 --- a/methods/ftp.h +++ b/methods/ftp.h @@ -10,6 +10,10 @@ #ifndef APT_FTP_H #define APT_FTP_H +#include + +#include + class FTPConn { char Buffer[1024*10]; diff --git a/methods/gpgv.cc b/methods/gpgv.cc index 67cbd36a2..2b2aba017 100644 --- a/methods/gpgv.cc +++ b/methods/gpgv.cc @@ -5,6 +5,7 @@ #include #include #include +#include #include #include diff --git a/methods/http.cc b/methods/http.cc index b60cfeb9e..0d81c73ed 100644 --- a/methods/http.cc +++ b/methods/http.cc @@ -29,6 +29,7 @@ #include #include +#include #include #include #include @@ -288,6 +289,11 @@ void CircleBuf::Stats() clog << "Got " << InP << " in " << Diff << " at " << InP/Diff << endl;*/ } /*}}}*/ +CircleBuf::~CircleBuf() +{ + delete [] Buf; + delete Hash; +} // ServerState::ServerState - Constructor /*{{{*/ // --------------------------------------------------------------------- diff --git a/methods/http.h b/methods/http.h index 08823d1b1..c73d4df5c 100644 --- a/methods/http.h +++ b/methods/http.h @@ -13,12 +13,15 @@ #define MAXLEN 360 -#include +#include + +#include using std::cout; using std::endl; class HttpMethod; +class Hashes; class CircleBuf { @@ -80,7 +83,7 @@ class CircleBuf void Stats(); CircleBuf(unsigned long long Size); - ~CircleBuf() {delete [] Buf; delete Hash;}; + ~CircleBuf(); }; struct ServerState diff --git a/methods/https.cc b/methods/https.cc index 06a0e285a..e70206dfb 100644 --- a/methods/https.cc +++ b/methods/https.cc @@ -17,6 +17,7 @@ #include #include #include +#include #include #include diff --git a/methods/https.h b/methods/https.h index 3f0c416b6..b7adeb880 100644 --- a/methods/https.h +++ b/methods/https.h @@ -20,7 +20,7 @@ using std::cout; using std::endl; class HttpsMethod; - +class FileFd; class HttpsMethod : public pkgAcqMethod { @@ -45,6 +45,7 @@ class HttpsMethod : public pkgAcqMethod }; }; +#include URI Proxy; #endif diff --git a/methods/mirror.cc b/methods/mirror.cc index 61a7f12fd..3d5983efa 100644 --- a/methods/mirror.cc +++ b/methods/mirror.cc @@ -18,7 +18,8 @@ #include #include #include - +#include +#include #include #include diff --git a/methods/mirror.h b/methods/mirror.h index 97d18144a..81e531e21 100644 --- a/methods/mirror.h +++ b/methods/mirror.h @@ -11,8 +11,9 @@ #ifndef APT_MIRROR_H #define APT_MIRROR_H - #include +#include +#include using std::cout; using std::cerr; @@ -24,29 +25,29 @@ class MirrorMethod : public HttpMethod { FetchResult Res; // we simply transform between BaseUri and Mirror - string BaseUri; // the original mirror://... url - string Mirror; // the selected mirror uri (http://...) - vector 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 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(); diff --git a/methods/rred.cc b/methods/rred.cc index 2a05acce1..ef00fcaa3 100644 --- a/methods/rred.cc +++ b/methods/rred.cc @@ -7,6 +7,7 @@ #include #include #include +#include #include #include diff --git a/methods/rsh.cc b/methods/rsh.cc index add128c49..da9777fc4 100644 --- a/methods/rsh.cc +++ b/methods/rsh.cc @@ -14,6 +14,9 @@ #include #include +#include +#include +#include #include #include diff --git a/methods/rsh.h b/methods/rsh.h index 7bebe29a0..d7efa3f06 100644 --- a/methods/rsh.h +++ b/methods/rsh.h @@ -12,9 +12,9 @@ #include #include -#include -#include -#include + +class Hashes; +class FileFd; class RSHConn { @@ -50,6 +50,8 @@ class RSHConn ~RSHConn(); }; +#include + class RSHMethod : public pkgAcqMethod { virtual bool Fetch(FetchItem *Itm); -- cgit v1.2.3