]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/tagfile.cc
Patchs for apt-cdrom
[apt.git] / apt-pkg / tagfile.cc
index 91653f602ced01aa7398dbdfcc038c894ae4887f..a55d5214a86bd6356ee09dcca30f0b058172b9d6 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: tagfile.cc,v 1.13 1998/10/30 07:53:41 jgg Exp $
+// $Id: tagfile.cc,v 1.15 1998/11/27 01:14:06 jgg Exp $
 /* ######################################################################
 
    Fast scanner for RFC-822 type header information
 /* ######################################################################
 
    Fast scanner for RFC-822 type header information
@@ -94,7 +94,8 @@ bool pkgTagFile::Fill()
                                                                        /*}}}*/
 // TagFile::Jump - Jump to a pre-recorded location in the file         /*{{{*/
 // ---------------------------------------------------------------------
                                                                        /*}}}*/
 // TagFile::Jump - Jump to a pre-recorded location in the file         /*{{{*/
 // ---------------------------------------------------------------------
-/* This jumps to a pre-recorded file location and */
+/* This jumps to a pre-recorded file location and reads the record
+   that is there */
 bool pkgTagFile::Jump(pkgTagSection &Tag,unsigned long Offset)
 {
    iOffset = Offset;
 bool pkgTagFile::Jump(pkgTagSection &Tag,unsigned long Offset)
 {
    iOffset = Offset;
@@ -179,3 +180,28 @@ bool pkgTagSection::Find(const char *Tag,const char *&Start,
    return false;
 }
                                                                        /*}}}*/
    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());
+}
+                                                                       /*}}}*/