summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/contrib/fileutl.cc4
-rw-r--r--apt-pkg/contrib/fileutl.h4
-rw-r--r--apt-pkg/tagfile.cc27
-rw-r--r--apt-pkg/tagfile.h12
4 files changed, 40 insertions, 7 deletions
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc
index 3ca36377a..b5cdf782b 100644
--- a/apt-pkg/contrib/fileutl.cc
+++ b/apt-pkg/contrib/fileutl.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: fileutl.cc,v 1.14 1998/11/23 07:03:06 jgg Exp $
+// $Id: fileutl.cc,v 1.15 1998/11/27 01:14:08 jgg Exp $
/* ######################################################################
File Utilities
@@ -234,7 +234,7 @@ bool FileFd::Read(void *To,unsigned long Size)
// FileFd::Write - Write to the file /*{{{*/
// ---------------------------------------------------------------------
/* */
-bool FileFd::Write(void *From,unsigned long Size)
+bool FileFd::Write(const void *From,unsigned long Size)
{
if (write(iFd,From,Size) != (signed)Size)
{
diff --git a/apt-pkg/contrib/fileutl.h b/apt-pkg/contrib/fileutl.h
index 31af3d28b..46eefc646 100644
--- a/apt-pkg/contrib/fileutl.h
+++ b/apt-pkg/contrib/fileutl.h
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: fileutl.h,v 1.9 1998/11/23 07:03:07 jgg Exp $
+// $Id: fileutl.h,v 1.10 1998/11/27 01:14:09 jgg Exp $
/* ######################################################################
File Utilities
@@ -41,7 +41,7 @@ class FileFd
enum OpenMode {ReadOnly,WriteEmpty,WriteExists,WriteAny};
bool Read(void *To,unsigned long Size);
- bool Write(void *From,unsigned long Size);
+ bool Write(const void *From,unsigned long Size);
bool Seek(unsigned long To);
unsigned long Size();
bool Close();
diff --git a/apt-pkg/tagfile.cc b/apt-pkg/tagfile.cc
index 1d6d10d57..a55d5214a 100644
--- a/apt-pkg/tagfile.cc
+++ b/apt-pkg/tagfile.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: tagfile.cc,v 1.14 1998/11/13 04:23:36 jgg Exp $
+// $Id: tagfile.cc,v 1.15 1998/11/27 01:14:06 jgg Exp $
/* ######################################################################
Fast scanner for RFC-822 type header information
@@ -180,3 +180,28 @@ bool pkgTagSection::Find(const char *Tag,const char *&Start,
return false;
}
/*}}}*/
+// pkgTagSection::FindS - Find a string /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+string pkgTagSection::FindS(const char *Tag)
+{
+ const char *Start;
+ const char *End;
+ if (Find(Tag,Start,End) == false)
+ return string();
+ return string(Start,End);
+}
+ /*}}}*/
+// TagSection::FindI - Find an integer /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+unsigned int pkgTagSection::FindI(const char *Tag)
+{
+ const char *Start;
+ const char *End;
+ if (Find(Tag,Start,End) == false)
+ return 0;
+
+ return atoi(string(Start,End).c_str());
+}
+ /*}}}*/
diff --git a/apt-pkg/tagfile.h b/apt-pkg/tagfile.h
index c97f86d88..7782b54f9 100644
--- a/apt-pkg/tagfile.h
+++ b/apt-pkg/tagfile.h
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: tagfile.h,v 1.9 1998/08/26 04:52:24 jgg Exp $
+// $Id: tagfile.h,v 1.10 1998/11/27 01:14:07 jgg Exp $
/* ######################################################################
Fast scanner for RFC-822 type header information
@@ -42,9 +42,17 @@ class pkgTagSection
inline bool operator !=(const pkgTagSection &rhs) {return Section != rhs.Section;};
bool Find(const char *Tag,const char *&Start, const char *&End);
+ string FindS(const char *Tag);
+ unsigned int FindI(const char *Tag);
bool Scan(const char *Start,unsigned long MaxLength);
inline unsigned long size() {return Stop - Section;};
-
+
+ inline void GetSection(const char *&Start,const char *&Stop)
+ {
+ Start = Section;
+ Stop = this->Stop;
+ };
+
pkgTagSection() : Section(0), Stop(0) {};
};