Explorar o código

revert 2184.1.2: do not pollute namespace in headers

The breakage is just to big for now, so guard the change with
#ifndef APT_8_CLEANER_HEADERS and be nice to library users
David Kalnischkies %!s(int64=14) %!d(string=hai) anos
pai
achega
a4f6bdc8bd

+ 4 - 0
apt-inst/contrib/extracttar.h

@@ -18,6 +18,10 @@
 
 #include <string>
 
+#ifndef APT_8_CLEANER_HEADERS
+using std::min;
+#endif
+
 class pkgDirStream;
 
 class ExtractTar

+ 5 - 0
apt-pkg/acquire.h

@@ -75,6 +75,11 @@
 #include <sys/time.h>
 #include <unistd.h>
 
+#ifndef APT_8_CLEANER_HEADERS
+using std::vector;
+using std::string;
+#endif
+
 class pkgAcquireStatus;
 
 /** \brief The core download scheduler.					{{{

+ 4 - 0
apt-pkg/algorithms.h

@@ -36,6 +36,10 @@
 
 #include <iostream>
 
+#ifndef APT_8_CLEANER_HEADERS
+using std::ostream;
+#endif
+
 class pkgAcquireStatus;
 
 class pkgSimulate : public pkgPackageManager				/*{{{*/

+ 4 - 0
apt-pkg/cdrom.h

@@ -4,6 +4,10 @@
 #include<string>
 #include<vector>
 
+#ifndef APT_8_CLEANER_HEADERS
+using namespace std;
+#endif
+
 class Configuration;
 class OpProgress;
 

+ 4 - 0
apt-pkg/contrib/cdromutl.h

@@ -12,6 +12,10 @@
 
 #include <string>
 
+#ifndef APT_8_CLEANER_HEADERS
+using std::string;
+#endif
+
 // mount cdrom, DeviceName (e.g. /dev/sr0) is optional
 bool MountCdrom(std::string Path, std::string DeviceName="");
 bool UnmountCdrom(std::string Path);

+ 4 - 0
apt-pkg/contrib/configuration.h

@@ -34,6 +34,10 @@
 #include <vector>
 #include <iostream>
 
+#ifndef APT_8_CLEANER_HEADERS
+using std::string;
+#endif
+
 class Configuration
 {
    public:

+ 4 - 0
apt-pkg/contrib/fileutl.h

@@ -29,6 +29,10 @@
 
 #include <zlib.h>
 
+#ifndef APT_8_CLEANER_HEADERS
+using std::string;
+#endif
+
 /* Define this for python-apt */
 #define APT_HAS_GZIP 1
 

+ 6 - 0
apt-pkg/contrib/hashes.h

@@ -22,6 +22,12 @@
 #include <vector>
 #include <cstring>
 
+
+#ifndef APT_8_CLEANER_HEADERS
+using std::min;
+using std::vector;
+#endif
+
 // helper class that contains hash function name
 // and hash
 class HashString

+ 5 - 0
apt-pkg/contrib/hashsum_template.h

@@ -15,6 +15,11 @@
 #include <algorithm>
 #include <stdint.h>
 
+#ifndef APT_8_CLEANER_HEADERS
+using std::string;
+using std::min;
+#endif
+
 template<int N>
 class HashSumValue
 {

+ 5 - 0
apt-pkg/contrib/md5.h

@@ -31,6 +31,11 @@
 
 #include "hashsum_template.h"
 
+#ifndef APT_8_CLEANER_HEADERS
+using std::string;
+using std::min;
+#endif
+
 typedef HashSumValue<128> MD5SumValue;
 
 class MD5Summation : public SummationImplementation

+ 4 - 0
apt-pkg/contrib/mmap.h

@@ -28,6 +28,10 @@
 
 #include <string>
 
+#ifndef APT_8_CLEANER_HEADERS
+using std::string;
+#endif
+
 class FileFd;
 
 /* This should be a 32 bit type, larger tyes use too much ram and smaller

+ 4 - 0
apt-pkg/contrib/progress.h

@@ -25,6 +25,10 @@
 #include <string>
 #include <sys/time.h>
 
+#ifndef APT_8_CLEANER_HEADERS
+using std::string;
+#endif
+
 class Configuration;
 class OpProgress
 {

+ 5 - 0
apt-pkg/contrib/sha1.h

@@ -20,6 +20,11 @@
 
 #include "hashsum_template.h"
 
+#ifndef APT_8_CLEANER_HEADERS
+using std::string;
+using std::min;
+#endif
+
 typedef  HashSumValue<160> SHA1SumValue;
 
 class SHA1Summation : public SummationImplementation

+ 6 - 0
apt-pkg/contrib/strutl.h

@@ -27,6 +27,12 @@
 
 #include "macros.h"
 
+#ifndef APT_8_CLEANER_HEADERS
+using std::string;
+using std::vector;
+using std::ostream;
+#endif
+
 bool UTF8ToCodeset(const char *codeset, const std::string &orig, std::string *dest);
 char *_strstrip(char *String);
 char *_strtabexpand(char *String,size_t Len);

+ 5 - 0
apt-pkg/deb/dpkgpm.h

@@ -15,6 +15,11 @@
 #include <map>
 #include <stdio.h>
 
+#ifndef APT_8_CLEANER_HEADERS
+using std::vector;
+using std::map;
+#endif
+
 class pkgDPkgPMPrivate;
 
 class pkgDPkgPM : public pkgPackageManager

+ 5 - 0
apt-pkg/indexcopy.h

@@ -14,6 +14,11 @@
 #include <string>
 #include <stdio.h>
 
+#ifndef APT_8_CLEANER_HEADERS
+using std::string;
+using std::vector;
+#endif
+
 class pkgTagSection;
 class FileFd;
 class indexRecords;

+ 4 - 0
apt-pkg/indexfile.h

@@ -29,6 +29,10 @@
 #include <apt-pkg/pkgrecords.h>
 #include <apt-pkg/macros.h>
 
+#ifndef APT_8_CLEANER_HEADERS
+using std::string;
+#endif
+
 class pkgAcquire;
 class pkgCacheGenerator;
 class OpProgress;

+ 4 - 0
apt-pkg/metaindex.h

@@ -6,6 +6,10 @@
 #include <apt-pkg/pkgcache.h>
 #include <apt-pkg/indexfile.h>
 
+#ifndef APT_8_CLEANER_HEADERS
+using std::string;
+#endif
+
 class pkgAcquire;
 class pkgCacheGenerator;
 class OpProgress;

+ 4 - 0
apt-pkg/packagemanager.h

@@ -29,6 +29,10 @@
 #include <iostream>
 #include <set>
 
+#ifndef APT_8_CLEANER_HEADERS
+using std::string;
+#endif
+
 class pkgAcquire;
 class pkgDepCache;
 class pkgSourceList;

+ 4 - 1
apt-pkg/pkgcache.h

@@ -74,11 +74,14 @@
 #ifndef PKGLIB_PKGCACHE_H
 #define PKGLIB_PKGCACHE_H
 
-
 #include <string>
 #include <time.h>
 #include <apt-pkg/mmap.h>
 
+#ifndef APT_8_CLEANER_HEADERS
+using std::string;
+#endif
+
 class pkgVersioningSystem;
 class pkgCache								/*{{{*/
 {

+ 4 - 0
apt-pkg/policy.h

@@ -38,6 +38,10 @@
 #include <apt-pkg/versionmatch.h>
 #include <vector>
 
+#ifndef APT_8_CLEANER_HEADERS
+using std::vector;
+#endif
+
 class pkgPolicy : public pkgDepCache::Policy
 {
    protected:

+ 5 - 0
apt-pkg/srcrecords.h

@@ -17,6 +17,11 @@
 #include <string>
 #include <vector>
 
+#ifndef APT_8_CLEANER_HEADERS
+using std::string;
+using std::vector;
+#endif
+
 class pkgSourceList;
 class pkgIndexFile;
 class pkgSrcRecords

+ 4 - 0
apt-pkg/vendor.h

@@ -6,6 +6,10 @@
 
 #include <apt-pkg/macros.h>
 
+#ifndef APT_8_CLEANER_HEADERS
+using std::string;
+#endif
+
 // A class representing a particular software provider.
 class __deprecated Vendor
 {

+ 5 - 0
apt-pkg/vendorlist.h

@@ -17,6 +17,11 @@
 #include <vector>
 #include <apt-pkg/macros.h>
 
+#ifndef APT_8_CLEANER_HEADERS
+using std::string;
+using std::vector;
+#endif
+
 class Vendor;
 class Configuration;
 

+ 4 - 0
apt-pkg/version.h

@@ -23,6 +23,10 @@
 #include <apt-pkg/strutl.h>
 #include <string>
 
+#ifndef APT_8_CLEANER_HEADERS
+using std::string;
+#endif
+
 class pkgVersioningSystem
 {
    public:

+ 4 - 0
apt-pkg/versionmatch.h

@@ -39,6 +39,10 @@
 #include <string>
 #include <apt-pkg/pkgcache.h>
 
+#ifndef APT_8_CLEANER_HEADERS
+using std::string;
+#endif
+
 class pkgVersionMatch
 {   
    // Version Matching