From 8f3ba4e8708cb72be19dacc2af4f601ee5fea292 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 19 Sep 2011 13:31:29 +0200 Subject: do not pollute namespace in the headers with using (Closes: #500198) --- apt-pkg/deb/debindexfile.h | 68 ++++++++++++++++++++++---------------------- apt-pkg/deb/deblistparser.cc | 2 ++ apt-pkg/deb/deblistparser.h | 24 ++++++++-------- apt-pkg/deb/debrecords.cc | 6 ++-- apt-pkg/deb/debrecords.h | 28 +++++++++--------- apt-pkg/deb/debsrcrecords.cc | 6 ++-- apt-pkg/deb/debsrcrecords.h | 18 ++++++------ apt-pkg/deb/debsystem.cc | 4 ++- apt-pkg/deb/debversion.cc | 4 +-- apt-pkg/deb/debversion.h | 6 ++-- apt-pkg/deb/dpkgpm.h | 19 ++++++------- 11 files changed, 95 insertions(+), 90 deletions(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/debindexfile.h b/apt-pkg/deb/debindexfile.h index 678c22473..9e64d4476 100644 --- a/apt-pkg/deb/debindexfile.h +++ b/apt-pkg/deb/debindexfile.h @@ -26,14 +26,14 @@ class debStatusIndex : public pkgIndexFile void *d; protected: - string File; + std::string File; public: virtual const Type *GetType() const; // Interface for acquire - virtual string Describe(bool Short) const {return File;}; + virtual std::string Describe(bool Short) const {return File;}; // Interface for the Cache Generator virtual bool Exists() const; @@ -43,7 +43,7 @@ class debStatusIndex : public pkgIndexFile bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog, unsigned long const Flag) const; virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const; - debStatusIndex(string File); + debStatusIndex(std::string File); virtual ~debStatusIndex() {}; }; @@ -52,25 +52,25 @@ class debPackagesIndex : public pkgIndexFile /** \brief dpointer placeholder (for later in case we need it) */ void *d; - string URI; - string Dist; - string Section; - string Architecture; + std::string URI; + std::string Dist; + std::string Section; + std::string Architecture; - string Info(const char *Type) const; - string IndexFile(const char *Type) const; - string IndexURI(const char *Type) const; + std::string Info(const char *Type) const; + std::string IndexFile(const char *Type) const; + std::string IndexURI(const char *Type) const; public: virtual const Type *GetType() const; // Stuff for accessing files on remote items - virtual string ArchiveInfo(pkgCache::VerIterator Ver) const; - virtual string ArchiveURI(string File) const {return URI + File;}; + virtual std::string ArchiveInfo(pkgCache::VerIterator Ver) const; + virtual std::string ArchiveURI(std::string File) const {return URI + File;}; // Interface for acquire - virtual string Describe(bool Short) const; + virtual std::string Describe(bool Short) const; // Interface for the Cache Generator virtual bool Exists() const; @@ -79,8 +79,8 @@ class debPackagesIndex : public pkgIndexFile virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const; virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const; - debPackagesIndex(string const &URI, string const &Dist, string const &Section, - bool const &Trusted, string const &Arch = "native"); + debPackagesIndex(std::string const &URI, std::string const &Dist, std::string const &Section, + bool const &Trusted, std::string const &Arch = "native"); virtual ~debPackagesIndex() {}; }; @@ -89,23 +89,23 @@ class debTranslationsIndex : public pkgIndexFile /** \brief dpointer placeholder (for later in case we need it) */ void *d; - string URI; - string Dist; - string Section; + std::string URI; + std::string Dist; + std::string Section; const char * const Language; - string Info(const char *Type) const; - string IndexFile(const char *Type) const; - string IndexURI(const char *Type) const; + std::string Info(const char *Type) const; + std::string IndexFile(const char *Type) const; + std::string IndexURI(const char *Type) const; - inline string TranslationFile() const {return string("Translation-").append(Language);}; + inline std::string TranslationFile() const {return std::string("Translation-").append(Language);}; public: virtual const Type *GetType() const; // Interface for acquire - virtual string Describe(bool Short) const; + virtual std::string Describe(bool Short) const; virtual bool GetIndexes(pkgAcquire *Owner) const; // Interface for the Cache Generator @@ -115,7 +115,7 @@ class debTranslationsIndex : public pkgIndexFile virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const; virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const; - debTranslationsIndex(string URI,string Dist,string Section, char const * const Language); + debTranslationsIndex(std::string URI,std::string Dist,std::string Section, char const * const Language); virtual ~debTranslationsIndex() {}; }; @@ -124,25 +124,25 @@ class debSourcesIndex : public pkgIndexFile /** \brief dpointer placeholder (for later in case we need it) */ void *d; - string URI; - string Dist; - string Section; + std::string URI; + std::string Dist; + std::string Section; - string Info(const char *Type) const; - string IndexFile(const char *Type) const; - string IndexURI(const char *Type) const; + std::string Info(const char *Type) const; + std::string IndexFile(const char *Type) const; + std::string IndexURI(const char *Type) const; public: virtual const Type *GetType() const; // Stuff for accessing files on remote items - virtual string SourceInfo(pkgSrcRecords::Parser const &Record, + virtual std::string SourceInfo(pkgSrcRecords::Parser const &Record, pkgSrcRecords::File const &File) const; - virtual string ArchiveURI(string File) const {return URI + File;}; + virtual std::string ArchiveURI(std::string File) const {return URI + File;}; // Interface for acquire - virtual string Describe(bool Short) const; + virtual std::string Describe(bool Short) const; // Interface for the record parsers virtual pkgSrcRecords::Parser *CreateSrcParser() const; @@ -152,7 +152,7 @@ class debSourcesIndex : public pkgIndexFile virtual bool HasPackages() const {return false;}; virtual unsigned long Size() const; - debSourcesIndex(string URI,string Dist,string Section,bool Trusted); + debSourcesIndex(std::string URI,std::string Dist,std::string Section,bool Trusted); virtual ~debSourcesIndex() {}; }; diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index a4a974897..95a2e6d47 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -25,6 +25,8 @@ #include /*}}}*/ +using std::string; + static debListParser::WordList PrioList[] = {{"important",pkgCache::State::Important}, {"required",pkgCache::State::Required}, {"standard",pkgCache::State::Standard}, diff --git a/apt-pkg/deb/deblistparser.h b/apt-pkg/deb/deblistparser.h index 41d712fbf..09858d991 100644 --- a/apt-pkg/deb/deblistparser.h +++ b/apt-pkg/deb/deblistparser.h @@ -34,7 +34,7 @@ class debListParser : public pkgCacheGenerator::ListParser pkgTagFile Tags; pkgTagSection Section; unsigned long iOffset; - string Arch; + std::string Arch; std::vector Architectures; bool MultiArchEnabled; @@ -43,21 +43,21 @@ class debListParser : public pkgCacheGenerator::ListParser bool ParseDepends(pkgCache::VerIterator &Ver,const char *Tag, unsigned int Type); bool ParseProvides(pkgCache::VerIterator &Ver); - bool NewProvidesAllArch(pkgCache::VerIterator &Ver, string const &Package, string const &Version); - static bool GrabWord(string Word,WordList *List,unsigned char &Out); + bool NewProvidesAllArch(pkgCache::VerIterator &Ver, std::string const &Package, std::string const &Version); + static bool GrabWord(std::string Word,WordList *List,unsigned char &Out); public: - static unsigned char GetPrio(string Str); + static unsigned char GetPrio(std::string Str); // These all operate against the current section - virtual string Package(); - virtual string Architecture(); + virtual std::string Package(); + virtual std::string Architecture(); virtual bool ArchitectureAll(); - virtual string Version(); + virtual std::string Version(); virtual bool NewVersion(pkgCache::VerIterator &Ver); - virtual string Description(); - virtual string DescriptionLanguage(); + virtual std::string Description(); + virtual std::string DescriptionLanguage(); virtual MD5SumValue Description_md5(); virtual unsigned short VersionHash(); virtual bool UsePackage(pkgCache::PkgIterator &Pkg, @@ -68,15 +68,15 @@ class debListParser : public pkgCacheGenerator::ListParser virtual bool Step(); bool LoadReleaseInfo(pkgCache::PkgFileIterator &FileI,FileFd &File, - string section); + std::string section); static const char *ParseDepends(const char *Start,const char *Stop, - string &Package,string &Ver,unsigned int &Op, + std::string &Package,std::string &Ver,unsigned int &Op, bool const &ParseArchFlags = false, bool const &StripMultiArch = true); static const char *ConvertRelation(const char *I,unsigned int &Op); - debListParser(FileFd *File, string const &Arch = ""); + debListParser(FileFd *File, std::string const &Arch = ""); virtual ~debListParser() {}; }; diff --git a/apt-pkg/deb/debrecords.cc b/apt-pkg/deb/debrecords.cc index 4dfc8b56a..ef6a7ca9d 100644 --- a/apt-pkg/deb/debrecords.cc +++ b/apt-pkg/deb/debrecords.cc @@ -17,6 +17,8 @@ #include /*}}}*/ +using std::string; + // RecordParser::debRecordParser - Constructor /*{{{*/ // --------------------------------------------------------------------- /* */ @@ -135,8 +137,8 @@ string debRecordParser::LongDesc() orig = Section.FindS("Description").c_str(); else { - vector const lang = APT::Configuration::getLanguages(); - for (vector::const_iterator l = lang.begin(); + std::vector const lang = APT::Configuration::getLanguages(); + for (std::vector::const_iterator l = lang.begin(); orig.empty() && l != lang.end(); ++l) orig = Section.FindS(string("Description-").append(*l).c_str()); } diff --git a/apt-pkg/deb/debrecords.h b/apt-pkg/deb/debrecords.h index 7868bfa3d..b75726859 100644 --- a/apt-pkg/deb/debrecords.h +++ b/apt-pkg/deb/debrecords.h @@ -35,27 +35,27 @@ class debRecordParser : public pkgRecords::Parser public: // These refer to the archive file for the Version - virtual string FileName(); - virtual string MD5Hash(); - virtual string SHA1Hash(); - virtual string SHA256Hash(); - virtual string SHA512Hash(); - virtual string SourcePkg(); - virtual string SourceVer(); + virtual std::string FileName(); + virtual std::string MD5Hash(); + virtual std::string SHA1Hash(); + virtual std::string SHA256Hash(); + virtual std::string SHA512Hash(); + virtual std::string SourcePkg(); + virtual std::string SourceVer(); // These are some general stats about the package - virtual string Maintainer(); - virtual string ShortDesc(); - virtual string LongDesc(); - virtual string Name(); - virtual string Homepage(); + virtual std::string Maintainer(); + virtual std::string ShortDesc(); + virtual std::string LongDesc(); + virtual std::string Name(); + virtual std::string Homepage(); // An arbitrary custom field - virtual string RecordField(const char *fieldName); + virtual std::string RecordField(const char *fieldName); virtual void GetRec(const char *&Start,const char *&Stop); - debRecordParser(string FileName,pkgCache &Cache); + debRecordParser(std::string FileName,pkgCache &Cache); virtual ~debRecordParser() {}; }; diff --git a/apt-pkg/deb/debsrcrecords.cc b/apt-pkg/deb/debsrcrecords.cc index c9c20267b..38389e624 100644 --- a/apt-pkg/deb/debsrcrecords.cc +++ b/apt-pkg/deb/debsrcrecords.cc @@ -21,6 +21,8 @@ using std::max; /*}}}*/ +using std::string; + // SrcRecordParser::Binaries - Return the binaries field /*{{{*/ // --------------------------------------------------------------------- /* This member parses the binaries field into a pair of class arrays and @@ -57,7 +59,7 @@ const char **debSrcRecordParser::Binaries() package/version records representing the build dependency. The returned array need not be freed and will be reused by the next call to this function */ -bool debSrcRecordParser::BuildDepends(vector &BuildDeps, +bool debSrcRecordParser::BuildDepends(std::vector &BuildDeps, bool const &ArchOnly, bool const &StripMultiArch) { unsigned int I; @@ -102,7 +104,7 @@ bool debSrcRecordParser::BuildDepends(vector // --------------------------------------------------------------------- /* This parses the list of files and returns it, each file is required to have a complete source package */ -bool debSrcRecordParser::Files(vector &List) +bool debSrcRecordParser::Files(std::vector &List) { List.erase(List.begin(),List.end()); diff --git a/apt-pkg/deb/debsrcrecords.h b/apt-pkg/deb/debsrcrecords.h index aa859b0e6..bb588e3d9 100644 --- a/apt-pkg/deb/debsrcrecords.h +++ b/apt-pkg/deb/debsrcrecords.h @@ -35,22 +35,22 @@ class debSrcRecordParser : public pkgSrcRecords::Parser virtual bool Step() {iOffset = Tags.Offset(); return Tags.Step(Sect);}; virtual bool Jump(unsigned long const &Off) {iOffset = Off; return Tags.Jump(Sect,Off);}; - virtual string Package() const {return Sect.FindS("Package");}; - virtual string Version() const {return Sect.FindS("Version");}; - virtual string Maintainer() const {return Sect.FindS("Maintainer");}; - virtual string Section() const {return Sect.FindS("Section");}; + virtual std::string Package() const {return Sect.FindS("Package");}; + virtual std::string Version() const {return Sect.FindS("Version");}; + virtual std::string Maintainer() const {return Sect.FindS("Maintainer");}; + virtual std::string Section() const {return Sect.FindS("Section");}; virtual const char **Binaries(); - virtual bool BuildDepends(vector &BuildDeps, bool const &ArchOnly, bool const &StripMultiArch = true); + virtual bool BuildDepends(std::vector &BuildDeps, bool const &ArchOnly, bool const &StripMultiArch = true); virtual unsigned long Offset() {return iOffset;}; - virtual string AsStr() + virtual std::string AsStr() { const char *Start=0,*Stop=0; Sect.GetSection(Start,Stop); - return string(Start,Stop); + return std::string(Start,Stop); }; - virtual bool Files(vector &F); + virtual bool Files(std::vector &F); - debSrcRecordParser(string const &File,pkgIndexFile const *Index) + debSrcRecordParser(std::string const &File,pkgIndexFile const *Index) : Parser(Index), Fd(File,FileFd::ReadOnlyGzip), Tags(&Fd,102400), Buffer(0), BufSize(0) {} virtual ~debSrcRecordParser(); diff --git a/apt-pkg/deb/debsystem.cc b/apt-pkg/deb/debsystem.cc index 080af5659..7ed6936c3 100644 --- a/apt-pkg/deb/debsystem.cc +++ b/apt-pkg/deb/debsystem.cc @@ -27,6 +27,8 @@ #include /*}}}*/ +using std::string; + debSystem debSys; class debSystemPrivate { @@ -219,7 +221,7 @@ signed debSystem::Score(Configuration const &Cnf) // System::AddStatusFiles - Register the status files /*{{{*/ // --------------------------------------------------------------------- /* */ -bool debSystem::AddStatusFiles(vector &List) +bool debSystem::AddStatusFiles(std::vector &List) { if (d->StatusFile == 0) d->StatusFile = new debStatusIndex(_config->FindFile("Dir::State::status")); diff --git a/apt-pkg/deb/debversion.cc b/apt-pkg/deb/debversion.cc index ba32b2dd4..859ff6b6d 100644 --- a/apt-pkg/deb/debversion.cc +++ b/apt-pkg/deb/debversion.cc @@ -263,7 +263,7 @@ bool debVersioningSystem::CheckDep(const char *PkgVer, // debVS::UpstreamVersion - Return the upstream version string /*{{{*/ // --------------------------------------------------------------------- /* This strips all the debian specific information from the version number */ -string debVersioningSystem::UpstreamVersion(const char *Ver) +std::string debVersioningSystem::UpstreamVersion(const char *Ver) { // Strip off the bit before the first colon const char *I = Ver; @@ -278,6 +278,6 @@ string debVersioningSystem::UpstreamVersion(const char *Ver) if (*I == '-') Last = I - Ver; - return string(Ver,Last); + return std::string(Ver,Last); } /*}}}*/ diff --git a/apt-pkg/deb/debversion.h b/apt-pkg/deb/debversion.h index 56fb67887..24ad73149 100644 --- a/apt-pkg/deb/debversion.h +++ b/apt-pkg/deb/debversion.h @@ -32,7 +32,7 @@ class debVersioningSystem : public pkgVersioningSystem { return DoCmpVersion(A,Aend,B,Bend); } - virtual string UpstreamVersion(const char *A); + virtual std::string UpstreamVersion(const char *A); debVersioningSystem(); }; @@ -53,7 +53,7 @@ inline int pkgVersionCompare(const char *A, const char *AEnd, { return debVS.DoCmpVersion(A,AEnd,B,BEnd); } -inline int pkgVersionCompare(string A,string B) +inline int pkgVersionCompare(std::string A,std::string B) { return debVS.CmpVersion(A,B); } @@ -61,7 +61,7 @@ inline bool pkgCheckDep(const char *DepVer,const char *PkgVer,int Op) { return debVS.CheckDep(PkgVer,Op,DepVer); } -inline string pkgBaseVersion(const char *Ver) +inline std::string pkgBaseVersion(const char *Ver) { return debVS.UpstreamVersion(Ver); } diff --git a/apt-pkg/deb/dpkgpm.h b/apt-pkg/deb/dpkgpm.h index 3f95c51dc..6b62360b7 100644 --- a/apt-pkg/deb/dpkgpm.h +++ b/apt-pkg/deb/dpkgpm.h @@ -15,9 +15,6 @@ #include #include -using std::vector; -using std::map; - class pkgDPkgPMPrivate; class pkgDPkgPM : public pkgPackageManager @@ -38,7 +35,7 @@ class pkgDPkgPM : public pkgPackageManager needs to declare a Replaces on the disappeared package. \param pkgname Name of the package that disappeared */ - void handleDisappearAction(string const &pkgname); + void handleDisappearAction(std::string const &pkgname); protected: int pkgFailures; @@ -53,11 +50,11 @@ class pkgDPkgPM : public pkgPackageManager // the dpkg states that the pkg will run through, the string is // the package, the vector contains the dpkg states that the package // will go through - map > PackageOps; + std::map > PackageOps; // the dpkg states that are already done; the string is the package // the int is the state that is already done (e.g. a package that is // going to be install is already in state "half-installed") - map PackageOpsDone; + std::map PackageOpsDone; // progress reporting unsigned int PackagesDone; @@ -66,19 +63,19 @@ class pkgDPkgPM : public pkgPackageManager struct Item { enum Ops {Install, Configure, Remove, Purge, ConfigurePending, TriggersPending} Op; - string File; + std::string File; PkgIterator Pkg; - Item(Ops Op,PkgIterator Pkg,string File = "") : Op(Op), + Item(Ops Op,PkgIterator Pkg,std::string File = "") : Op(Op), File(File), Pkg(Pkg) {}; Item() {}; }; - vector List; + std::vector List; // Helpers bool RunScriptsWithPkgs(const char *Cnf); bool SendV2Pkgs(FILE *F); - void WriteHistoryTag(string const &tag, string value); + void WriteHistoryTag(std::string const &tag, std::string value); // apport integration void WriteApportReport(const char *pkgpath, const char *errormsg); @@ -94,7 +91,7 @@ class pkgDPkgPM : public pkgPackageManager void ProcessDpkgStatusLine(int OutStatusFd, char *line); // The Actuall installation implementation - virtual bool Install(PkgIterator Pkg,string File); + virtual bool Install(PkgIterator Pkg,std::string File); virtual bool Configure(PkgIterator Pkg); virtual bool Remove(PkgIterator Pkg,bool Purge = false); virtual bool Go(int StatusFd=-1); -- cgit v1.2.3