Browse Source

do not pollute namespace in the headers with using (Closes: #500198)

tags/debian/0.9.0
David Kalnischkies 10 years ago
parent
commit
8f3ba4e870
98 changed files with 598 additions and 629 deletions
  1. +1
    -1
      apt-inst/contrib/arfile.cc
  2. +1
    -1
      apt-inst/contrib/arfile.h
  3. +2
    -4
      apt-inst/contrib/extracttar.h
  4. +1
    -1
      apt-inst/database.cc
  5. +3
    -3
      apt-inst/database.h
  6. +3
    -3
      apt-inst/deb/debfile.cc
  7. +2
    -2
      apt-inst/deb/debfile.h
  8. +4
    -4
      apt-inst/deb/dpkgdb.h
  9. +1
    -1
      apt-inst/extract.h
  10. +1
    -1
      apt-inst/filelist.h
  11. +19
    -19
      apt-pkg/acquire-method.h
  12. +6
    -6
      apt-pkg/acquire-worker.h
  13. +16
    -20
      apt-pkg/acquire.h
  14. +2
    -4
      apt-pkg/algorithms.h
  15. +5
    -5
      apt-pkg/aptconfiguration.cc
  16. +3
    -3
      apt-pkg/cacheiterators.h
  17. +18
    -20
      apt-pkg/cdrom.h
  18. +5
    -5
      apt-pkg/clean.cc
  19. +2
    -2
      apt-pkg/clean.h
  20. +2
    -0
      apt-pkg/contrib/cdromutl.cc
  21. +5
    -7
      apt-pkg/contrib/cdromutl.h
  22. +22
    -24
      apt-pkg/contrib/configuration.h
  23. +20
    -22
      apt-pkg/contrib/fileutl.h
  24. +13
    -13
      apt-pkg/contrib/hashes.cc
  25. +7
    -10
      apt-pkg/contrib/hashes.h
  26. +1
    -1
      apt-pkg/contrib/hashsum.cc
  27. +5
    -8
      apt-pkg/contrib/hashsum_template.h
  28. +0
    -3
      apt-pkg/contrib/md5.h
  29. +1
    -3
      apt-pkg/contrib/mmap.h
  30. +1
    -0
      apt-pkg/contrib/netrc.cc
  31. +1
    -1
      apt-pkg/contrib/netrc.h
  32. +8
    -10
      apt-pkg/contrib/progress.h
  33. +0
    -3
      apt-pkg/contrib/sha1.h
  34. +52
    -56
      apt-pkg/contrib/strutl.h
  35. +34
    -34
      apt-pkg/deb/debindexfile.h
  36. +2
    -0
      apt-pkg/deb/deblistparser.cc
  37. +12
    -12
      apt-pkg/deb/deblistparser.h
  38. +4
    -2
      apt-pkg/deb/debrecords.cc
  39. +14
    -14
      apt-pkg/deb/debrecords.h
  40. +4
    -2
      apt-pkg/deb/debsrcrecords.cc
  41. +9
    -9
      apt-pkg/deb/debsrcrecords.h
  42. +3
    -1
      apt-pkg/deb/debsystem.cc
  43. +2
    -2
      apt-pkg/deb/debversion.cc
  44. +3
    -3
      apt-pkg/deb/debversion.h
  45. +8
    -11
      apt-pkg/deb/dpkgpm.h
  46. +3
    -0
      apt-pkg/depcache.cc
  47. +3
    -3
      apt-pkg/depcache.h
  48. +1
    -1
      apt-pkg/edsp/edspindexfile.h
  49. +4
    -4
      apt-pkg/edsp/edsplistparser.cc
  50. +4
    -4
      apt-pkg/edsp/edsplistparser.h
  51. +1
    -1
      apt-pkg/edsp/edspsystem.cc
  52. +19
    -22
      apt-pkg/indexcopy.h
  53. +5
    -5
      apt-pkg/indexfile.cc
  54. +5
    -7
      apt-pkg/indexfile.h
  55. +4
    -1
      apt-pkg/indexrecords.cc
  56. +15
    -15
      apt-pkg/indexrecords.h
  57. +3
    -3
      apt-pkg/init.cc
  58. +9
    -11
      apt-pkg/metaindex.h
  59. +3
    -3
      apt-pkg/orderlist.h
  60. +2
    -4
      apt-pkg/packagemanager.h
  61. +2
    -2
      apt-pkg/pkgcache.cc
  62. +7
    -9
      apt-pkg/pkgcache.h
  63. +19
    -19
      apt-pkg/pkgcachegen.h
  64. +1
    -1
      apt-pkg/pkgrecords.cc
  65. +13
    -13
      apt-pkg/pkgrecords.h
  66. +9
    -11
      apt-pkg/policy.h
  67. +15
    -18
      apt-pkg/srcrecords.h
  68. +1
    -1
      apt-pkg/tagfile.h
  69. +3
    -3
      apt-pkg/vendor.cc
  70. +10
    -12
      apt-pkg/vendor.h
  71. +3
    -0
      apt-pkg/vendorlist.cc
  72. +5
    -9
      apt-pkg/vendorlist.h
  73. +1
    -3
      apt-pkg/version.h
  74. +2
    -0
      apt-pkg/versionmatch.cc
  75. +12
    -14
      apt-pkg/versionmatch.h
  76. +7
    -0
      debian/changelog
  77. +6
    -6
      ftparchive/cachedb.cc
  78. +11
    -11
      ftparchive/cachedb.h
  79. +1
    -1
      ftparchive/contents.cc
  80. +1
    -1
      ftparchive/contents.h
  81. +3
    -3
      ftparchive/multicompress.h
  82. +3
    -3
      methods/bzip2.cc
  83. +7
    -7
      methods/connect.cc
  84. +1
    -1
      methods/connect.h
  85. +1
    -1
      methods/copy.cc
  86. +3
    -3
      methods/file.cc
  87. +5
    -5
      methods/ftp.h
  88. +3
    -0
      methods/gpgv.cc
  89. +1
    -1
      methods/gzip.cc
  90. +9
    -9
      methods/http.h
  91. +2
    -2
      methods/rred.cc
  92. +9
    -9
      methods/rsh.cc
  93. +5
    -5
      methods/rsh.h
  94. +3
    -1
      test/interactive-helper/test_udevcdrom.cc
  95. +1
    -1
      test/libapt/getlistoffilesindir_test.cc
  96. +1
    -1
      test/libapt/hashsums_test.cc
  97. +2
    -2
      test/libapt/parsedepends_test.cc
  98. +1
    -1
      test/libapt/strutil_test.cc

+ 1
- 1
apt-inst/contrib/arfile.cc View File

@@ -115,7 +115,7 @@ bool ARArchive::LoadHeaders()
{
unsigned int I = sizeof(Head.Name) - 1;
for (; Head.Name[I] == ' ' || Head.Name[I] == '/'; I--);
Memb->Name = string(Head.Name,I+1);
Memb->Name = std::string(Head.Name,I+1);
}

// Account for the AR header alignment


+ 1
- 1
apt-inst/contrib/arfile.h View File

@@ -49,7 +49,7 @@ class ARArchive
struct ARArchive::Member
{
// Fields from the header
string Name;
std::string Name;
unsigned long MTime;
unsigned long UID;
unsigned long GID;


+ 2
- 4
apt-inst/contrib/extracttar.h View File

@@ -19,8 +19,6 @@

#include <algorithm>

using std::min;

class ExtractTar
{
protected:
@@ -38,7 +36,7 @@ class ExtractTar
int GZPid;
FileFd InFd;
bool Eof;
string DecompressProg;
std::string DecompressProg;
// Fork and reap gzip
bool StartGzip();
@@ -48,7 +46,7 @@ class ExtractTar

bool Go(pkgDirStream &Stream);
ExtractTar(FileFd &Fd,unsigned long Max,string DecompressionProgram);
ExtractTar(FileFd &Fd,unsigned long Max,std::string DecompressionProgram);
virtual ~ExtractTar();
};



+ 1
- 1
apt-inst/database.cc View File

@@ -17,7 +17,7 @@
// ---------------------------------------------------------------------
/* This re-initializes the meta temporary directory if it hasn't yet
been inited for this cycle. The flag is the emptyness of MetaDir */
bool pkgDataBase::GetMetaTmp(string &Dir)
bool pkgDataBase::GetMetaTmp(std::string &Dir)
{
if (MetaDir.empty() == true)
if (InitMetaTmp(MetaDir) == false)


+ 3
- 3
apt-inst/database.h View File

@@ -30,8 +30,8 @@ class pkgDataBase
pkgCacheGenerator *Cache;
pkgFLCache *FList;
string MetaDir;
virtual bool InitMetaTmp(string &Dir) = 0;
std::string MetaDir;
virtual bool InitMetaTmp(std::string &Dir) = 0;
public:

@@ -40,7 +40,7 @@ class pkgDataBase
inline pkgFLCache &GetFLCache() {return *FList;};
inline pkgCacheGenerator &GetGenerator() {return *Cache;};
bool GetMetaTmp(string &Dir);
bool GetMetaTmp(std::string &Dir);
virtual bool ReadyFileList(OpProgress &Progress) = 0;
virtual bool ReadyPkgCache(OpProgress &Progress) = 0;
virtual bool LoadChanges() = 0;


+ 3
- 3
apt-inst/deb/debfile.cc View File

@@ -107,8 +107,8 @@ bool debDebFile::ExtractControl(pkgDataBase &DB)
return false;
// Get into the temporary directory
string Cwd = SafeGetCWD();
string Tmp;
std::string Cwd = SafeGetCWD();
std::string Tmp;
if (DB.GetMetaTmp(Tmp) == false)
return false;
if (chdir(Tmp.c_str()) != 0)
@@ -174,7 +174,7 @@ bool debDebFile::ExtractArchive(pkgDirStream &Stream)
pkgCache::VerIterator debDebFile::MergeControl(pkgDataBase &DB)
{
// Open the control file
string Tmp;
std::string Tmp;
if (DB.GetMetaTmp(Tmp) == false)
return pkgCache::VerIterator(DB.GetCache());
FileFd Fd(Tmp + "control",FileFd::ReadOnly);


+ 2
- 2
apt-inst/deb/debfile.h View File

@@ -68,7 +68,7 @@ class debDebFile::MemControlExtract : public pkgDirStream
char *Control;
pkgTagSection Section;
unsigned long Length;
string Member;
std::string Member;
// Members from DirStream
virtual bool DoItem(Item &Itm,int &Fd);
@@ -81,7 +81,7 @@ class debDebFile::MemControlExtract : public pkgDirStream
bool TakeControl(const void *Data,unsigned long Size);
MemControlExtract() : IsControl(false), Control(0), Length(0), Member("control") {};
MemControlExtract(string Member) : IsControl(false), Control(0), Length(0), Member(Member) {};
MemControlExtract(std::string Member) : IsControl(false), Control(0), Length(0), Member(Member) {};
~MemControlExtract() {delete [] Control;};
};
/*}}}*/


+ 4
- 4
apt-inst/deb/dpkgdb.h View File

@@ -25,14 +25,14 @@
class debDpkgDB : public pkgDataBase
{
protected:
string AdminDir;
std::string AdminDir;
DynamicMMap *CacheMap;
DynamicMMap *FileMap;
unsigned long DiverInode;
signed long DiverTime;
virtual bool InitMetaTmp(string &Dir);
virtual bool InitMetaTmp(std::string &Dir);
bool ReadFList(OpProgress &Progress);
bool ReadDiversions();
bool ReadConfFiles();


+ 1
- 1
apt-inst/extract.h View File

@@ -33,7 +33,7 @@ class pkgExtract : public pkgDirStream
bool HandleOverwrites(pkgFLCache::NodeIterator Nde,
bool DiverCheck = false);
bool CheckDirReplace(string Dir,unsigned int Depth = 0);
bool CheckDirReplace(std::string Dir,unsigned int Depth = 0);
public:


+ 1
- 1
apt-inst/filelist.h View File

@@ -48,7 +48,7 @@ class pkgFLCache
class DiverIterator;
protected:
string CacheFile;
std::string CacheFile;
DynamicMMap &Map;
map_ptrloc LastTreeLookup;
unsigned long LastLookupSize;


+ 19
- 19
apt-pkg/acquire-method.h View File

@@ -34,8 +34,8 @@ class pkgAcqMethod
{
FetchItem *Next;

string Uri;
string DestFile;
std::string Uri;
std::string DestFile;
time_t LastModified;
bool IndexFile;
bool FailIgnore;
@@ -43,14 +43,14 @@ class pkgAcqMethod
struct FetchResult
{
string MD5Sum;
string SHA1Sum;
string SHA256Sum;
string SHA512Sum;
vector<string> GPGVOutput;
std::string MD5Sum;
std::string SHA1Sum;
std::string SHA256Sum;
std::string SHA512Sum;
std::vector<std::string> GPGVOutput;
time_t LastModified;
bool IMSHit;
string Filename;
std::string Filename;
unsigned long long Size;
unsigned long long ResumePoint;
@@ -59,25 +59,25 @@ class pkgAcqMethod
};

// State
vector<string> Messages;
std::vector<std::string> Messages;
FetchItem *Queue;
FetchItem *QueueBack;
string FailReason;
string UsedMirror;
string IP;
std::string FailReason;
std::string UsedMirror;
std::string IP;
// Handlers for messages
virtual bool Configuration(string Message);
virtual bool Configuration(std::string Message);
virtual bool Fetch(FetchItem * /*Item*/) {return true;};
// Outgoing messages
void Fail(bool Transient = false);
inline void Fail(const char *Why, bool Transient = false) {Fail(string(Why),Transient);};
virtual void Fail(string Why, bool Transient = false);
inline void Fail(const char *Why, bool Transient = false) {Fail(std::string(Why),Transient);};
virtual void Fail(std::string Why, bool Transient = false);
virtual void URIStart(FetchResult &Res);
virtual void URIDone(FetchResult &Res,FetchResult *Alt = 0);

bool MediaFail(string Required,string Drive);
bool MediaFail(std::string Required,std::string Drive);
virtual void Exit() {};

void PrintStatus(char const * const header, const char* Format, va_list &args) const;
@@ -91,11 +91,11 @@ class pkgAcqMethod
void Log(const char *Format,...);
void Status(const char *Format,...);
void Redirect(const string &NewURI);
void Redirect(const std::string &NewURI);
int Run(bool Single = false);
inline void SetFailReason(string Msg) {FailReason = Msg;};
inline void SetIP(string aIP) {IP = aIP;};
inline void SetFailReason(std::string Msg) {FailReason = Msg;};
inline void SetIP(std::string aIP) {IP = aIP;};
pkgAcqMethod(const char *Ver,unsigned long Flags = 0);
virtual ~pkgAcqMethod() {};


+ 6
- 6
apt-pkg/acquire-worker.h View File

@@ -79,7 +79,7 @@ class pkgAcquire::Worker : public WeakPointable
*
* \todo Doesn't this duplicate Config->Access?
*/
string Access;
std::string Access;

/** \brief The PID of the subprocess. */
pid_t Process;
@@ -118,13 +118,13 @@ class pkgAcquire::Worker : public WeakPointable
/** \brief The raw text values of messages received from the
* worker, in sequence.
*/
vector<string> MessageQueue;
std::vector<std::string> MessageQueue;

/** \brief Buffers pending writes to the subprocess.
*
* \todo Wouldn't a std::dequeue be more appropriate?
*/
string OutQueue;
std::string OutQueue;
/** \brief Common code for the constructor.
*
@@ -183,7 +183,7 @@ class pkgAcquire::Worker : public WeakPointable
*
* \return \b true.
*/
bool Capabilities(string Message);
bool Capabilities(std::string Message);

/** \brief Send a 601 Configuration message (containing the APT
* configuration) to the subprocess.
@@ -214,7 +214,7 @@ class pkgAcquire::Worker : public WeakPointable
* 603 Media Changed, with the Failed field set to \b true if the
* user cancelled the media change).
*/
bool MediaChange(string Message);
bool MediaChange(std::string Message);
/** \brief Invoked when the worked process dies unexpectedly.
*
@@ -242,7 +242,7 @@ class pkgAcquire::Worker : public WeakPointable
/** \brief The most recent status string received from the
* subprocess.
*/
string Status;
std::string Status;

/** \brief How many bytes of the file have been downloaded. Zero
* if the current progress of the file cannot be determined.


+ 16
- 20
apt-pkg/acquire.h View File

@@ -72,10 +72,6 @@
#include <vector>
#include <string>

using std::vector;
using std::string;


#include <sys/time.h>
#include <unistd.h>

@@ -107,8 +103,8 @@ class pkgAcquire
friend class Item;
friend class Queue;

typedef vector<Item *>::iterator ItemIterator;
typedef vector<Item *>::const_iterator ItemCIterator;
typedef std::vector<Item *>::iterator ItemIterator;
typedef std::vector<Item *>::const_iterator ItemCIterator;

protected:
@@ -117,7 +113,7 @@ class pkgAcquire
* This is built monotonically as items are created and only
* emptied when the download shuts down.
*/
vector<Item *> Items;
std::vector<Item *> Items;
/** \brief The head of the list of active queues.
*
@@ -202,7 +198,7 @@ class pkgAcquire
* \return the string-name of the queue in which a fetch request
* for the given URI should be placed.
*/
string QueueName(string URI,MethodConfig const *&Config);
std::string QueueName(std::string URI,MethodConfig const *&Config);

/** \brief Build up the set of file descriptors upon which select() should
* block.
@@ -248,7 +244,7 @@ class pkgAcquire
*
* \return the method whose name is Access, or \b NULL if no such method exists.
*/
MethodConfig *GetConfig(string Access);
MethodConfig *GetConfig(std::string Access);

/** \brief Provides information on how a download terminated. */
enum RunResult {
@@ -319,7 +315,7 @@ class pkgAcquire
*
* \return \b true if the directory exists and is readable.
*/
bool Clean(string Dir);
bool Clean(std::string Dir);

/** \return the total size in bytes of all the items included in
* this download.
@@ -347,7 +343,7 @@ class pkgAcquire
* only one Acquire class is in action at the time or an empty string
* if no lock file should be used.
*/
bool Setup(pkgAcquireStatus *Progress = NULL, string const &Lock = "");
bool Setup(pkgAcquireStatus *Progress = NULL, std::string const &Lock = "");

void SetLog(pkgAcquireStatus *Progress) { Log = Progress; }

@@ -372,11 +368,11 @@ class pkgAcquire
struct pkgAcquire::ItemDesc : public WeakPointable
{
/** \brief The URI from which to download this item. */
string URI;
std::string URI;
/** brief A description of this item. */
string Description;
std::string Description;
/** brief A shorter description of this item. */
string ShortDesc;
std::string ShortDesc;
/** brief The underlying item which is to be downloaded. */
Item *Owner;
};
@@ -420,7 +416,7 @@ class pkgAcquire::Queue
};
/** \brief The name of this queue. */
string Name;
std::string Name;

/** \brief The head of the list of items contained in this queue.
*
@@ -475,7 +471,7 @@ class pkgAcquire::Queue
* \return the first item in the queue whose URI is #URI and that
* is being downloaded by #Owner.
*/
QItem *FindItem(string URI,pkgAcquire::Worker *Owner);
QItem *FindItem(std::string URI,pkgAcquire::Worker *Owner);

/** Presumably this should start downloading an item?
*
@@ -538,7 +534,7 @@ class pkgAcquire::Queue
* \param Name The name of the new queue.
* \param Owner The download process that owns the new queue.
*/
Queue(string Name,pkgAcquire *Owner);
Queue(std::string Name,pkgAcquire *Owner);

/** Shut down all the worker processes associated with this queue
* and empty the queue.
@@ -603,10 +599,10 @@ struct pkgAcquire::MethodConfig
MethodConfig *Next;
/** \brief The name of this acquire method (e.g., http). */
string Access;
std::string Access;

/** \brief The implementation version of this acquire method. */
string Version;
std::string Version;

/** \brief If \b true, only one download queue should be created for this
* method.
@@ -748,7 +744,7 @@ class pkgAcquireStatus
* \todo This is a horrible blocking monster; it should be CPSed
* with prejudice.
*/
virtual bool MediaChange(string Media,string Drive) = 0;
virtual bool MediaChange(std::string Media,std::string Drive) = 0;
/** \brief Invoked when an item is confirmed to be up-to-date.



+ 2
- 4
apt-pkg/algorithms.h View File

@@ -37,8 +37,6 @@

#include <iostream>

using std::ostream;

class pkgSimulate : public pkgPackageManager /*{{{*/
{
protected:
@@ -63,13 +61,13 @@ class pkgSimulate : public pkgPackageManager /*{{{*/
pkgDepCache::ActionGroup group;
// 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);

private:
void ShortBreaks();
void Describe(PkgIterator iPkg,ostream &out,bool Current,bool Candidate);
void Describe(PkgIterator iPkg,std::ostream &out,bool Current,bool Candidate);
public:



+ 5
- 5
apt-pkg/aptconfiguration.cc View File

@@ -59,10 +59,10 @@ const Configuration::getCompressionTypes(bool const &Cached) {
if ((*o).empty() == true)
continue;
// ignore types we have no method ready to use
if (_config->Exists(string("Acquire::CompressionTypes::").append(*o)) == false)
if (_config->Exists(std::string("Acquire::CompressionTypes::").append(*o)) == false)
continue;
// ignore types we have no app ready to use
string const appsetting = string("Dir::Bin::").append(*o);
std::string const appsetting = std::string("Dir::Bin::").append(*o);
if (_config->Exists(appsetting) == true) {
std::string const app = _config->FindFile(appsetting.c_str(), "");
if (app.empty() == false && FileExists(app) == false)
@@ -83,7 +83,7 @@ const Configuration::getCompressionTypes(bool const &Cached) {
if (std::find(types.begin(),types.end(),Types->Tag) != types.end())
continue;
// ignore types we have no app ready to use
string const appsetting = string("Dir::Bin::").append(Types->Value);
std::string const appsetting = std::string("Dir::Bin::").append(Types->Value);
if (appsetting.empty() == false && _config->Exists(appsetting) == true) {
std::string const app = _config->FindFile(appsetting.c_str(), "");
if (app.empty() == false && FileExists(app) == false)
@@ -95,7 +95,7 @@ const Configuration::getCompressionTypes(bool const &Cached) {
// add the special "uncompressed" type
if (std::find(types.begin(), types.end(), "uncompressed") == types.end())
{
string const uncompr = _config->FindFile("Dir::Bin::uncompressed", "");
std::string const uncompr = _config->FindFile("Dir::Bin::uncompressed", "");
if (uncompr.empty() == true || FileExists(uncompr) == true)
types.push_back("uncompressed");
}
@@ -441,7 +441,7 @@ Configuration::Compressor::Compressor(char const *name, char const *extension,
char const *binary,
char const *compressArg, char const *uncompressArg,
unsigned short const cost) {
std::string const config = string("APT:Compressor::").append(name).append("::");
std::string const config = std::string("APT:Compressor::").append(name).append("::");
Name = _config->Find(std::string(config).append("Name"), name);
Extension = _config->Find(std::string(config).append("Extension"), extension);
Binary = _config->Find(std::string(config).append("Binary"), binary);


+ 3
- 3
apt-pkg/cacheiterators.h View File

@@ -111,7 +111,7 @@ class pkgCache::GrpIterator: public Iterator<Group, GrpIterator> {

inline const char *Name() const {return S->Name == 0?0:Owner->StrP + S->Name;};
inline PkgIterator PackageList() const;
PkgIterator FindPkg(string Arch = "any") const;
PkgIterator FindPkg(std::string Arch = "any") const;
/** \brief find the package with the "best" architecture

The best architecture is either the "native" or the first
@@ -219,7 +219,7 @@ class pkgCache::VerIterator : public Iterator<Version, VerIterator> {
inline VerFileIterator FileList() const;
bool Downloadable() const;
inline const char *PriorityType() const {return Owner->Priority(S->Priority);};
string RelStr() const;
std::string RelStr() const;

bool Automatic() const;
VerFileIterator NewestFile() const;
@@ -365,7 +365,7 @@ class pkgCache::PkgFileIterator : public Iterator<PackageFile, PkgFileIterator>
inline const char *IndexType() const {return S->IndexType == 0?0:Owner->StrP + S->IndexType;};

bool IsOk();
string RelStr();
std::string RelStr();

// Constructors
inline PkgFileIterator() : Iterator<PackageFile, PkgFileIterator>() {};


+ 18
- 20
apt-pkg/cdrom.h View File

@@ -6,8 +6,6 @@
#include<vector>


using namespace std;

class pkgCdromStatus /*{{{*/
{
protected:
@@ -20,12 +18,12 @@ class pkgCdromStatus /*{{{*/
// total steps
virtual void SetTotal(int total) { totalSteps = total; };
// update steps, will be called regularly as a "pulse"
virtual void Update(string text="", int current=0) = 0;
virtual void Update(std::string text="", int current=0) = 0;
// ask for cdrom insert
virtual bool ChangeCdrom() = 0;
// ask for cdrom name
virtual bool AskCdromName(string &Name) = 0;
virtual bool AskCdromName(std::string &Name) = 0;
// Progress indicator for the Index rewriter
virtual OpProgress* GetOpProgress() {return NULL; };
};
@@ -47,22 +45,22 @@ class pkgCdrom /*{{{*/
};


bool FindPackages(string CD,
vector<string> &List,
vector<string> &SList,
vector<string> &SigList,
vector<string> &TransList,
string &InfoDir, pkgCdromStatus *log,
bool FindPackages(std::string CD,
std::vector<std::string> &List,
std::vector<std::string> &SList,
std::vector<std::string> &SigList,
std::vector<std::string> &TransList,
std::string &InfoDir, pkgCdromStatus *log,
unsigned int Depth = 0);
bool DropBinaryArch(vector<string> &List);
bool DropRepeats(vector<string> &List,const char *Name);
void ReduceSourcelist(string CD,vector<string> &List);
bool DropBinaryArch(std::vector<std::string> &List);
bool DropRepeats(std::vector<std::string> &List,const char *Name);
void ReduceSourcelist(std::string CD,std::vector<std::string> &List);
bool WriteDatabase(Configuration &Cnf);
bool WriteSourceList(string Name,vector<string> &List,bool Source);
int Score(string Path);
bool WriteSourceList(std::string Name,std::vector<std::string> &List,bool Source);
int Score(std::string Path);

public:
bool Ident(string &ident, pkgCdromStatus *log);
bool Ident(std::string &ident, pkgCdromStatus *log);
bool Add(pkgCdromStatus *log);
};
/*}}}*/
@@ -71,9 +69,9 @@ class pkgCdrom /*{{{*/
// class that uses libudev to find cdrom/removable devices dynamically
struct CdromDevice /*{{{*/
{
string DeviceName;
std::string DeviceName;
bool Mounted;
string MountPath;
std::string MountPath;
};
/*}}}*/
class pkgUdevCdromDevices /*{{{*/
@@ -104,9 +102,9 @@ class pkgUdevCdromDevices /*{{{*/

// convenience interface, this will just call ScanForRemovable
// with "APT::cdrom::CdromOnly"
vector<CdromDevice> Scan();
std::vector<CdromDevice> Scan();

vector<CdromDevice> ScanForRemovable(bool CdromOnly);
std::vector<CdromDevice> ScanForRemovable(bool CdromOnly);
};
/*}}}*/



+ 5
- 5
apt-pkg/clean.cc View File

@@ -26,7 +26,7 @@
// ---------------------------------------------------------------------
/* Scan the directory for files to erase, we check the version information
against our database to see if it is interesting */
bool pkgArchiveCleaner::Go(string Dir,pkgCache &Cache)
bool pkgArchiveCleaner::Go(std::string Dir,pkgCache &Cache)
{
bool CleanInstalled = _config->FindB("APT::Clean-Installed",true);
@@ -34,7 +34,7 @@ bool pkgArchiveCleaner::Go(string Dir,pkgCache &Cache)
if (D == 0)
return _error->Errno("opendir",_("Unable to read %s"),Dir.c_str());

string StartDir = SafeGetCWD();
std::string StartDir = SafeGetCWD();
if (chdir(Dir.c_str()) != 0)
{
closedir(D);
@@ -63,21 +63,21 @@ bool pkgArchiveCleaner::Go(string Dir,pkgCache &Cache)
for (; *I != 0 && *I != '_';I++);
if (*I != '_')
continue;
string Pkg = DeQuoteString(string(Dir->d_name,I-Dir->d_name));
std::string Pkg = DeQuoteString(std::string(Dir->d_name,I-Dir->d_name));

// Grab the version
const char *Start = I + 1;
for (I = Start; *I != 0 && *I != '_';I++);
if (*I != '_')
continue;
string Ver = DeQuoteString(string(Start,I-Start));
std::string Ver = DeQuoteString(std::string(Start,I-Start));
// Grab the arch
Start = I + 1;
for (I = Start; *I != 0 && *I != '.' ;I++);
if (*I != '.')
continue;
string const Arch = DeQuoteString(string(Start,I-Start));
std::string const Arch = DeQuoteString(std::string(Start,I-Start));
if (APT::Configuration::checkArchitecture(Arch) == false)
continue;


+ 2
- 2
apt-pkg/clean.h View File

@@ -20,11 +20,11 @@ class pkgArchiveCleaner

protected:
virtual void Erase(const char * /*File*/,string /*Pkg*/,string /*Ver*/,struct stat & /*St*/) {};
virtual void Erase(const char * /*File*/,std::string /*Pkg*/,std::string /*Ver*/,struct stat & /*St*/) {};

public:
bool Go(string Dir,pkgCache &Cache);
bool Go(std::string Dir,pkgCache &Cache);
virtual ~pkgArchiveCleaner() {};
};



+ 2
- 0
apt-pkg/contrib/cdromutl.cc View File

@@ -30,6 +30,8 @@
#include <apti18n.h>
/*}}}*/

using std::string;

// IsMounted - Returns true if the mount point is mounted /*{{{*/
// ---------------------------------------------------------------------
/* This is a simple algorithm that should always work, we stat the mount point


+ 5
- 7
apt-pkg/contrib/cdromutl.h View File

@@ -12,13 +12,11 @@

#include <string>

using std::string;

// mount cdrom, DeviceName (e.g. /dev/sr0) is optional
bool MountCdrom(string Path, string DeviceName="");
bool UnmountCdrom(string Path);
bool IdentCdrom(string CD,string &Res,unsigned int Version = 2);
bool IsMounted(string &Path);
string FindMountPointForDevice(const char *device);
bool MountCdrom(std::string Path, std::string DeviceName="");
bool UnmountCdrom(std::string Path);
bool IdentCdrom(std::string CD,std::string &Res,unsigned int Version = 2);
bool IsMounted(std::string &Path);
std::string FindMountPointForDevice(const char *device);

#endif

+ 22
- 24
apt-pkg/contrib/configuration.h View File

@@ -34,21 +34,19 @@
#include <vector>
#include <iostream>

using std::string;

class Configuration
{
public:
struct Item
{
string Value;
string Tag;
std::string Value;
std::string Tag;
Item *Parent;
Item *Child;
Item *Next;
string FullTag(const Item *Stop = 0) const;
std::string FullTag(const Item *Stop = 0) const;
Item() : Parent(0), Child(0), Next(0) {};
};
@@ -67,35 +65,35 @@ class Configuration
public:

string Find(const char *Name,const char *Default = 0) const;
string Find(string const &Name,const char *Default = 0) const {return Find(Name.c_str(),Default);};
string Find(string const &Name, string const &Default) const {return Find(Name.c_str(),Default.c_str());};
string FindFile(const char *Name,const char *Default = 0) const;
string FindDir(const char *Name,const char *Default = 0) const;
std::vector<string> FindVector(const char *Name) const;
std::vector<string> FindVector(string const &Name) const { return FindVector(Name.c_str()); };
std::string Find(const char *Name,const char *Default = 0) const;
std::string Find(std::string const &Name,const char *Default = 0) const {return Find(Name.c_str(),Default);};
std::string Find(std::string const &Name, std::string const &Default) const {return Find(Name.c_str(),Default.c_str());};
std::string FindFile(const char *Name,const char *Default = 0) const;
std::string FindDir(const char *Name,const char *Default = 0) const;
std::vector<std::string> FindVector(const char *Name) const;
std::vector<std::string> FindVector(std::string const &Name) const { return FindVector(Name.c_str()); };
int FindI(const char *Name,int const &Default = 0) const;
int FindI(string const &Name,int const &Default = 0) const {return FindI(Name.c_str(),Default);};
int FindI(std::string const &Name,int const &Default = 0) const {return FindI(Name.c_str(),Default);};
bool FindB(const char *Name,bool const &Default = false) const;
bool FindB(string const &Name,bool const &Default = false) const {return FindB(Name.c_str(),Default);};
string FindAny(const char *Name,const char *Default = 0) const;
bool FindB(std::string const &Name,bool const &Default = false) const {return FindB(Name.c_str(),Default);};
std::string FindAny(const char *Name,const char *Default = 0) const;
inline void Set(const string &Name,const string &Value) {Set(Name.c_str(),Value);};
void CndSet(const char *Name,const string &Value);
inline void Set(const std::string &Name,const std::string &Value) {Set(Name.c_str(),Value);};
void CndSet(const char *Name,const std::string &Value);
void CndSet(const char *Name,const int Value);
void Set(const char *Name,const string &Value);
void Set(const char *Name,const std::string &Value);
void Set(const char *Name,const int &Value);
inline bool Exists(const string &Name) const {return Exists(Name.c_str());};
inline bool Exists(const std::string &Name) const {return Exists(Name.c_str());};
bool Exists(const char *Name) const;
bool ExistsAny(const char *Name) const;

// clear a whole tree
void Clear(const string &Name);
void Clear(const std::string &Name);

// remove a certain value from a list (e.g. the list of "APT::Keep-Fds")
void Clear(string const &List, string const &Value);
void Clear(string const &List, int const &Value);
void Clear(std::string const &List, std::string const &Value);
void Clear(std::string const &List, int const &Value);

inline const Item *Tree(const char *Name) const {return Lookup(Name);};

@@ -127,11 +125,11 @@ class Configuration

extern Configuration *_config;

bool ReadConfigFile(Configuration &Conf,const string &FName,
bool ReadConfigFile(Configuration &Conf,const std::string &FName,
bool const &AsSectional = false,
unsigned const &Depth = 0);

bool ReadConfigDir(Configuration &Conf,const string &Dir,
bool ReadConfigDir(Configuration &Conf,const std::string &Dir,
bool const &AsSectional = false,
unsigned const &Depth = 0);



+ 20
- 22
apt-pkg/contrib/fileutl.h View File

@@ -31,8 +31,6 @@
/* Define this for python-apt */
#define APT_HAS_GZIP 1

using std::string;

class FileFd
{
protected:
@@ -41,8 +39,8 @@ class FileFd
enum LocalFlags {AutoClose = (1<<0),Fail = (1<<1),DelOnFail = (1<<2),
HitEof = (1<<3), Replace = (1<<4) };
unsigned long Flags;
string FileName;
string TemporaryFileName;
std::string FileName;
std::string TemporaryFileName;
gzFile gz;

public:
@@ -79,7 +77,7 @@ class FileFd
return T;
}

bool Open(string FileName,OpenMode Mode,unsigned long Perms = 0666);
bool Open(std::string FileName,OpenMode Mode,unsigned long Perms = 0666);
bool OpenDescriptor(int Fd, OpenMode Mode, bool AutoClose=false);
bool Close();
bool Sync();
@@ -93,9 +91,9 @@ class FileFd
inline void EraseOnFailure() {Flags |= DelOnFail;};
inline void OpFail() {Flags |= Fail;};
inline bool Eof() {return (Flags & HitEof) == HitEof;};
inline string &Name() {return FileName;};
inline std::string &Name() {return FileName;};
FileFd(string FileName,OpenMode Mode,unsigned long Perms = 0666) : iFd(-1),
FileFd(std::string FileName,OpenMode Mode,unsigned long Perms = 0666) : iFd(-1),
Flags(0), gz(NULL)
{
Open(FileName,Mode,Perms);
@@ -107,12 +105,12 @@ class FileFd

bool RunScripts(const char *Cnf);
bool CopyFile(FileFd &From,FileFd &To);
int GetLock(string File,bool Errors = true);
bool FileExists(string File);
bool RealFileExists(string File);
bool DirectoryExists(string const &Path) __attrib_const;
bool CreateDirectory(string const &Parent, string const &Path);
time_t GetModificationTime(string const &Path);
int GetLock(std::string File,bool Errors = true);
bool FileExists(std::string File);
bool RealFileExists(std::string File);
bool DirectoryExists(std::string const &Path) __attrib_const;
bool CreateDirectory(std::string const &Parent, std::string const &Path);
time_t GetModificationTime(std::string const &Path);

/** \brief Ensure the existence of the given Path
*
@@ -120,13 +118,13 @@ time_t GetModificationTime(string const &Path);
* /apt/ will be removed before CreateDirectory call.
* \param Path which should exist after (successful) call
*/
bool CreateAPTDirectoryIfNeeded(string const &Parent, string const &Path);
bool CreateAPTDirectoryIfNeeded(std::string const &Parent, std::string const &Path);

std::vector<string> GetListOfFilesInDir(string const &Dir, string const &Ext,
std::vector<std::string> GetListOfFilesInDir(std::string const &Dir, std::string const &Ext,
bool const &SortList, bool const &AllowNoExt=false);
std::vector<string> GetListOfFilesInDir(string const &Dir, std::vector<string> const &Ext,
std::vector<std::string> GetListOfFilesInDir(std::string const &Dir, std::vector<std::string> const &Ext,
bool const &SortList);
string SafeGetCWD();
std::string SafeGetCWD();
void SetCloseExec(int Fd,bool Close);
void SetNonBlock(int Fd,bool Block);
bool WaitFd(int Fd,bool write = false,unsigned long timeout = 0);
@@ -134,10 +132,10 @@ pid_t ExecFork();
bool ExecWait(pid_t Pid,const char *Name,bool Reap = false);

// File string manipulators
string flNotDir(string File);
string flNotFile(string File);
string flNoLink(string File);
string flExtension(string File);
string flCombine(string Dir,string File);
std::string flNotDir(std::string File);
std::string flNotFile(std::string File);
std::string flNoLink(std::string File);
std::string flExtension(std::string File);
std::string flCombine(std::string Dir,std::string File);

#endif

+ 13
- 13
apt-pkg/contrib/hashes.cc View File

@@ -32,20 +32,20 @@ HashString::HashString()
{
}

HashString::HashString(string Type, string Hash) : Type(Type), Hash(Hash)
HashString::HashString(std::string Type, std::string Hash) : Type(Type), Hash(Hash)
{
}

HashString::HashString(string StringedHash) /*{{{*/
HashString::HashString(std::string StringedHash) /*{{{*/
{
// legacy: md5sum without "MD5Sum:" prefix
if (StringedHash.find(":") == string::npos && StringedHash.size() == 32)
if (StringedHash.find(":") == std::string::npos && StringedHash.size() == 32)
{
Type = "MD5Sum";
Hash = StringedHash;
return;
}
string::size_type pos = StringedHash.find(":");
std::string::size_type pos = StringedHash.find(":");
Type = StringedHash.substr(0,pos);
Hash = StringedHash.substr(pos+1, StringedHash.size() - pos);

@@ -53,34 +53,34 @@ HashString::HashString(string StringedHash) /*{{{*/
std::clog << "HashString(string): " << Type << " : " << Hash << std::endl;
}
/*}}}*/
bool HashString::VerifyFile(string filename) const /*{{{*/
bool HashString::VerifyFile(std::string filename) const /*{{{*/
{
string fileHash;
std::string fileHash;

FileFd Fd(filename, FileFd::ReadOnly);
if(Type == "MD5Sum")
{
MD5Summation MD5;
MD5.AddFD(Fd.Fd(), Fd.Size());
fileHash = (string)MD5.Result();
fileHash = (std::string)MD5.Result();
}
else if (Type == "SHA1")
{
SHA1Summation SHA1;
SHA1.AddFD(Fd.Fd(), Fd.Size());
fileHash = (string)SHA1.Result();
fileHash = (std::string)SHA1.Result();
}
else if (Type == "SHA256")
{
SHA256Summation SHA256;
SHA256.AddFD(Fd.Fd(), Fd.Size());
fileHash = (string)SHA256.Result();
fileHash = (std::string)SHA256.Result();
}
else if (Type == "SHA512")
{
SHA512Summation SHA512;
SHA512.AddFD(Fd.Fd(), Fd.Size());
fileHash = (string)SHA512.Result();
fileHash = (std::string)SHA512.Result();
}
Fd.Close();

@@ -100,9 +100,9 @@ bool HashString::empty() const
return (Type.empty() || Hash.empty());
}

string HashString::toStr() const
std::string HashString::toStr() const
{
return Type+string(":")+Hash;
return Type + std::string(":") + Hash;
}

// Hashes::AddFD - Add the contents of the FD /*{{{*/
@@ -117,7 +117,7 @@ bool Hashes::AddFD(int const Fd,unsigned long long Size, bool const addMD5,
while (Size != 0 || ToEOF)
{
unsigned long long n = sizeof(Buf);
if (!ToEOF) n = min(Size, n);
if (!ToEOF) n = std::min(Size, n);
Res = read(Fd,Buf,n);
if (Res < 0 || (!ToEOF && Res != (ssize_t) n)) // error, or short read
return false;


+ 7
- 10
apt-pkg/contrib/hashes.h View File

@@ -22,31 +22,28 @@
#include <vector>
#include <cstring>

using std::min;
using std::vector;

// helper class that contains hash function name
// and hash
class HashString
{
protected:
string Type;
string Hash;
std::string Type;
std::string Hash;
static const char * _SupportedHashes[10];

public:
HashString(string Type, string Hash);
HashString(string StringedHashString); // init from str as "type:hash"
HashString(std::string Type, std::string Hash);
HashString(std::string StringedHashString); // init from str as "type:hash"
HashString();

// get hash type used
string HashType() { return Type; };
std::string HashType() { return Type; };

// verify the given filename against the currently loaded hash
bool VerifyFile(string filename) const;
bool VerifyFile(std::string filename) const;

// helper
string toStr() const; // convert to str as "type:hash"
std::string toStr() const; // convert to str as "type:hash"
bool empty() const;

// return the list of hashes we support


+ 1
- 1
apt-pkg/contrib/hashsum.cc View File

@@ -14,7 +14,7 @@ bool SummationImplementation::AddFD(int const Fd, unsigned long long Size) {
while (Size != 0 || ToEOF)
{
unsigned long long n = sizeof(Buf);
if (!ToEOF) n = min(Size, n);
if (!ToEOF) n = std::min(Size, n);
Res = read(Fd, Buf, n);
if (Res < 0 || (!ToEOF && Res != (ssize_t) n)) // error, or short read
return false;


+ 5
- 8
apt-pkg/contrib/hashsum_template.h View File

@@ -15,9 +15,6 @@
#include <algorithm>
#include <stdint.h>

using std::string;
using std::min;

template<int N>
class HashSumValue
{
@@ -31,7 +28,7 @@ class HashSumValue
return memcmp(Sum,rhs.Sum,sizeof(Sum)) == 0;
};

string Value() const
std::string Value() const
{
char Conv[16] =
{ '0','1','2','3','4','5','6','7','8','9','a','b',
@@ -48,7 +45,7 @@ class HashSumValue
Result[I] = Conv[Sum[J] >> 4];
Result[I + 1] = Conv[Sum[J] & 0xF];
}
return string(Result);
return std::string(Result);
};
inline void Value(unsigned char S[N/8])
@@ -57,12 +54,12 @@ class HashSumValue
S[I] = Sum[I];
};

inline operator string() const
inline operator std::string() const
{
return Value();
};

bool Set(string Str)
bool Set(std::string Str)
{
return Hex2Num(Str,Sum,sizeof(Sum));
};
@@ -73,7 +70,7 @@ class HashSumValue
Sum[I] = S[I];
};

HashSumValue(string Str)
HashSumValue(std::string Str)
{
memset(Sum,0,sizeof(Sum));
Set(Str);


+ 0
- 3
apt-pkg/contrib/md5.h View File

@@ -29,9 +29,6 @@
#include <algorithm>
#include <stdint.h>

using std::string;
using std::min;

#include "hashsum_template.h"

typedef HashSumValue<128> MD5SumValue;


+ 1
- 3
apt-pkg/contrib/mmap.h View File

@@ -29,8 +29,6 @@
#include <string>
#include <apt-pkg/fileutl.h>

using std::string;

/* 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
instead of this internal type */
@@ -102,7 +100,7 @@ class DynamicMMap : public MMap
unsigned long RawAllocate(unsigned long long Size,unsigned long Aln = 0);
unsigned long Allocate(unsigned long ItemSize);
unsigned long WriteString(const char *String,unsigned long Len = (unsigned long)-1);
inline unsigned long WriteString(const string &S) {return WriteString(S.c_str(),S.length());};
inline unsigned long WriteString(const std::string &S) {return WriteString(S.c_str(),S.length());};
void UsePools(Pool &P,unsigned int Count) {Pools = &P; PoolCount = Count;};
DynamicMMap(FileFd &F,unsigned long Flags,unsigned long const &WorkSpace = 2*1024*1024,


+ 1
- 0
apt-pkg/contrib/netrc.cc View File

@@ -24,6 +24,7 @@

#include "netrc.h"

using std::string;

/* Get user and password from .netrc when given a machine name */



+ 1
- 1
apt-pkg/contrib/netrc.h View File

@@ -25,5 +25,5 @@
// If login[0] != 0, search for password within machine and login.
int parsenetrc (char *host, char *login, char *password, char *filename);

void maybe_add_auth (URI &Uri, string NetRCFile);
void maybe_add_auth (URI &Uri, std::string NetRCFile);
#endif

+ 8
- 10
apt-pkg/contrib/progress.h View File

@@ -25,8 +25,6 @@
#include <string>
#include <sys/time.h>

using std::string;

class Configuration;
class OpProgress
{
@@ -38,13 +36,13 @@ class OpProgress
// Change reduction code
struct timeval LastTime;
string LastOp;
string LastSubOp;
std::string LastOp;
std::string LastSubOp;
protected:
string Op;
string SubOp;
std::string Op;
std::string SubOp;
float Percent;
bool MajorChange;
@@ -55,9 +53,9 @@ class OpProgress
public:
void Progress(unsigned long long Current);
void SubProgress(unsigned long long SubTotal, const string &Op = "", float const Percent = -1);
void SubProgress(unsigned long long SubTotal, const std::string &Op = "", float const Percent = -1);
void OverallProgress(unsigned long long Current,unsigned long long Total,
unsigned long long Size,const string &Op);
unsigned long long Size,const std::string &Op);
virtual void Done() {};
OpProgress();
@@ -67,8 +65,8 @@ class OpProgress
class OpTextProgress : public OpProgress
{
protected:
string OldOp;
std::string OldOp;
bool NoUpdate;
bool NoDisplay;
unsigned long LastLen;


+ 0
- 3
apt-pkg/contrib/sha1.h View File

@@ -18,9 +18,6 @@
#include <cstring>
#include <algorithm>

using std::string;
using std::min;

#include "hashsum_template.h"

typedef HashSumValue<160> SHA1SumValue;


+ 52
- 56
apt-pkg/contrib/strutl.h View File

@@ -27,60 +27,56 @@

#include "macros.h"

using std::string;
using std::vector;
using std::ostream;

bool UTF8ToCodeset(const char *codeset, const string &orig, string *dest);
bool UTF8ToCodeset(const char *codeset, const std::string &orig, std::string *dest);
char *_strstrip(char *String);
char *_strtabexpand(char *String,size_t Len);
bool ParseQuoteWord(const char *&String,string &Res);
bool ParseCWord(const char *&String,string &Res);
string QuoteString(const string &Str,const char *Bad);
string DeQuoteString(const string &Str);
string DeQuoteString(string::const_iterator const &begin, string::const_iterator const &end);
bool ParseQuoteWord(const char *&String,std::string &Res);
bool ParseCWord(const char *&String,std::string &Res);
std::string QuoteString(const std::string &Str,const char *Bad);
std::string DeQuoteString(const std::string &Str);
std::string DeQuoteString(std::string::const_iterator const &begin, std::string::const_iterator const &end);

// unescape (\0XX and \xXX) from a string
string DeEscapeString(const string &input);
string SizeToStr(double Bytes);
string TimeToStr(unsigned long Sec);
string Base64Encode(const string &Str);
string OutputInDepth(const unsigned long Depth, const char* Separator=" ");
string URItoFileName(const string &URI);
string TimeRFC1123(time_t Date);
std::string DeEscapeString(const std::string &input);
std::string SizeToStr(double Bytes);
std::string TimeToStr(unsigned long Sec);
std::string Base64Encode(const std::string &Str);
std::string OutputInDepth(const unsigned long Depth, const char* Separator=" ");
std::string URItoFileName(const std::string &URI);
std::string TimeRFC1123(time_t Date);
bool RFC1123StrToTime(const char* const str,time_t &time) __must_check;
bool FTPMDTMStrToTime(const char* const str,time_t &time) __must_check;
__deprecated bool StrToTime(const string &Val,time_t &Result);
string LookupTag(const string &Message,const char *Tag,const char *Default = 0);
int StringToBool(const string &Text,int Default = -1);
bool ReadMessages(int Fd, vector<string> &List);
__deprecated bool StrToTime(const std::string &Val,time_t &Result);
std::string LookupTag(const std::string &Message,const char *Tag,const char *Default = 0);
int StringToBool(const std::string &Text,int Default = -1);
bool ReadMessages(int Fd, std::vector<std::string> &List);
bool StrToNum(const char *Str,unsigned long &Res,unsigned Len,unsigned Base = 0);
bool StrToNum(const char *Str,unsigned long long &Res,unsigned Len,unsigned Base = 0);
bool Base256ToNum(const char *Str,unsigned long &Res,unsigned int Len);
bool Hex2Num(const string &Str,unsigned char *Num,unsigned int Length);
bool Hex2Num(const std::string &Str,unsigned char *Num,unsigned int Length);
bool TokSplitString(char Tok,char *Input,char **List,
unsigned long ListMax);
vector<string> VectorizeString(string const &haystack, char const &split) __attrib_const;
void ioprintf(ostream &out,const char *format,...) __like_printf(2);
void strprintf(string &out,const char *format,...) __like_printf(2);
std::vector<std::string> VectorizeString(std::string const &haystack, char const &split) __attrib_const;
void ioprintf(std::ostream &out,const char *format,...) __like_printf(2);
void strprintf(std::string &out,const char *format,...) __like_printf(2);
char *safe_snprintf(char *Buffer,char *End,const char *Format,...) __like_printf(3);
bool CheckDomainList(const string &Host, const string &List);
bool CheckDomainList(const std::string &Host, const std::string &List);
int tolower_ascii(int const c) __attrib_const __hot;
string StripEpoch(const string &VerStr);
std::string StripEpoch(const std::string &VerStr);

#define APT_MKSTRCMP(name,func) \
inline int name(const char *A,const char *B) {return func(A,A+strlen(A),B,B+strlen(B));}; \
inline int name(const char *A,const char *AEnd,const char *B) {return func(A,AEnd,B,B+strlen(B));}; \
inline int name(const string& A,const char *B) {return func(A.c_str(),A.c_str()+A.length(),B,B+strlen(B));}; \
inline int name(const string& A,const string& B) {return func(A.c_str(),A.c_str()+A.length(),B.c_str(),B.c_str()+B.length());}; \
inline int name(const string& A,const char *B,const char *BEnd) {return func(A.c_str(),A.c_str()+A.length(),B,BEnd);};
inline int name(const std::string& A,const char *B) {return func(A.c_str(),A.c_str()+A.length(),B,B+strlen(B));}; \
inline int name(const std::string& A,const std::string& B) {return func(A.c_str(),A.c_str()+A.length(),B.c_str(),B.c_str()+B.length());}; \
inline int name(const std::string& A,const char *B,const char *BEnd) {return func(A.c_str(),A.c_str()+A.length(),B,BEnd);};

#define APT_MKSTRCMP2(name,func) \
inline int name(const char *A,const char *AEnd,const char *B) {return func(A,AEnd,B,B+strlen(B));}; \
inline int name(const string& A,const char *B) {return func(A.begin(),A.end(),B,B+strlen(B));}; \
inline int name(const string& A,const string& B) {return func(A.begin(),A.end(),B.begin(),B.end());}; \
inline int name(const string& A,const char *B,const char *BEnd) {return func(A.begin(),A.end(),B,BEnd);};
inline int name(const std::string& A,const char *B) {return func(A.begin(),A.end(),B,B+strlen(B));}; \
inline int name(const std::string& A,const std::string& B) {return func(A.begin(),A.end(),B.begin(),B.end());}; \
inline int name(const std::string& A,const char *B,const char *BEnd) {return func(A.begin(),A.end(),B,BEnd);};

int stringcmp(const char *A,const char *AEnd,const char *B,const char *BEnd);
int stringcasecmp(const char *A,const char *AEnd,const char *B,const char *BEnd);
@@ -89,17 +85,17 @@ int stringcasecmp(const char *A,const char *AEnd,const char *B,const char *BEnd)
case the definition of string::const_iterator is not the same as
const char * and we need these extra functions */
#if __GNUC__ >= 3
int stringcmp(string::const_iterator A,string::const_iterator AEnd,
int stringcmp(std::string::const_iterator A,std::string::const_iterator AEnd,
const char *B,const char *BEnd);
int stringcmp(string::const_iterator A,string::const_iterator AEnd,
string::const_iterator B,string::const_iterator BEnd);
int stringcasecmp(string::const_iterator A,string::const_iterator AEnd,
int stringcmp(std::string::const_iterator A,std::string::const_iterator AEnd,
std::string::const_iterator B,std::string::const_iterator BEnd);
int stringcasecmp(std::string::const_iterator A,std::string::const_iterator AEnd,
const char *B,const char *BEnd);
int stringcasecmp(string::const_iterator A,string::const_iterator AEnd,
string::const_iterator B,string::const_iterator BEnd);
int stringcasecmp(std::string::const_iterator A,std::string::const_iterator AEnd,
std::string::const_iterator B,std::string::const_iterator BEnd);

inline int stringcmp(string::const_iterator A,string::const_iterator Aend,const char *B) {return stringcmp(A,Aend,B,B+strlen(B));};
inline int stringcasecmp(string::const_iterator A,string::const_iterator Aend,const char *B) {return stringcasecmp(A,Aend,B,B+strlen(B));};
inline int stringcmp(std::string::const_iterator A,std::string::const_iterator Aend,const char *B) {return stringcmp(A,Aend,B,B+strlen(B));};
inline int stringcasecmp(std::string::const_iterator A,std::string::const_iterator Aend,const char *B) {return stringcasecmp(A,Aend,B,B+strlen(B));};
#endif

APT_MKSTRCMP2(stringcmp,stringcmp);
@@ -109,34 +105,34 @@ inline const char *DeNull(const char *s) {return (s == 0?"(null)":s);};

class URI
{
void CopyFrom(const string &From);
void CopyFrom(const std::string &From);
public:
string Access;
string User;
string Password;
string Host;
string Path;
std::string Access;
std::string User;
std::string Password;
std::string Host;
std::string Path;
unsigned int Port;
operator string();
inline void operator =(const string &From) {CopyFrom(From);};
operator std::string();
inline void operator =(const std::string &From) {CopyFrom(From);};
inline bool empty() {return Access.empty();};
static string SiteOnly(const string &URI);
static string NoUserPassword(const string &URI);
static std::string SiteOnly(const std::string &URI);
static std::string NoUserPassword(const std::string &URI);
URI(string Path) {CopyFrom(Path);};
URI(std::string Path) {CopyFrom(Path);};
URI() : Port(0) {};
};

struct SubstVar
{
const char *Subst;
const string *Contents;
const std::string *Contents;
};
string SubstVar(string Str,const struct SubstVar *Vars);
string SubstVar(const string &Str,const string &Subst,const string &Contents);
std::string SubstVar(std::string Str,const struct SubstVar *Vars);
std::string SubstVar(const std::string &Str,const std::string &Subst,const std::string &Contents);

struct RxChoiceList
{


+ 34
- 34
apt-pkg/deb/debindexfile.h View File

@@ -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() {};
};



+ 2
- 0
apt-pkg/deb/deblistparser.cc View File

@@ -25,6 +25,8 @@
#include <ctype.h>
/*}}}*/

using std::string;

static debListParser::WordList PrioList[] = {{"important",pkgCache::State::Important},
{"required",pkgCache::State::Required},
{"standard",pkgCache::State::Standard},


+ 12
- 12
apt-pkg/deb/deblistparser.h View File

@@ -34,7 +34,7 @@ class debListParser : public pkgCacheGenerator::ListParser
pkgTagFile Tags;
pkgTagSection Section;
unsigned long iOffset;
string Arch;
std::string Arch;
std::vector<std::string> 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() {};
};



+ 4
- 2
apt-pkg/deb/debrecords.cc View File

@@ -17,6 +17,8 @@
#include <langinfo.h>
/*}}}*/

using std::string;

// RecordParser::debRecordParser - Constructor /*{{{*/
// ---------------------------------------------------------------------
/* */
@@ -135,8 +137,8 @@ string debRecordParser::LongDesc()
orig = Section.FindS("Description").c_str();
else
{
vector<string> const lang = APT::Configuration::getLanguages();
for (vector<string>::const_iterator l = lang.begin();
std::vector<string> const lang = APT::Configuration::getLanguages();
for (std::vector<string>::const_iterator l = lang.begin();
orig.empty() && l != lang.end(); ++l)
orig = Section.FindS(string("Description-").append(*l).c_str());
}


+ 14
- 14
apt-pkg/deb/debrecords.h View File

@@ -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() {};
};



+ 4
- 2
apt-pkg/deb/debsrcrecords.cc View File

@@ -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<pkgSrcRecords::Parser::BuildDepRec> &BuildDeps,
bool debSrcRecordParser::BuildDepends(std::vector<pkgSrcRecords::Parser::BuildDepRec> &BuildDeps,
bool const &ArchOnly, bool const &StripMultiArch)
{
unsigned int I;
@@ -102,7 +104,7 @@ bool debSrcRecordParser::BuildDepends(vector<pkgSrcRecords::Parser::BuildDepRec>
// ---------------------------------------------------------------------
/* This parses the list of files and returns it, each file is required to have
a complete source package */
bool debSrcRecordParser::Files(vector<pkgSrcRecords::File> &List)
bool debSrcRecordParser::Files(std::vector<pkgSrcRecords::File> &List)
{
List.erase(List.begin(),List.end());


+ 9
- 9
apt-pkg/deb/debsrcrecords.h View File

@@ -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<BuildDepRec> &BuildDeps, bool const &ArchOnly, bool const &StripMultiArch = true);
virtual bool BuildDepends(std::vector<BuildDepRec> &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<pkgSrcRecords::File> &F);
virtual bool Files(std::vector<pkgSrcRecords::File> &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();


+ 3
- 1
apt-pkg/deb/debsystem.cc View File

@@ -27,6 +27,8 @@
#include <apti18n.h>
/*}}}*/

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<pkgIndexFile *> &List)
bool debSystem::AddStatusFiles(std::vector<pkgIndexFile *> &List)
{
if (d->StatusFile == 0)
d->StatusFile = new debStatusIndex(_config->FindFile("Dir::State::status"));


+ 2
- 2
apt-pkg/deb/debversion.cc View File

@@ -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);
}
/*}}}*/

+ 3
- 3
apt-pkg/deb/debversion.h View File

@@ -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,