X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/93bf083d699c60f1ac40297bfa6783fb0cb800d8..a05599f12fd30388ee972ed2535d5297afe0c20b:/apt-pkg/tagfile.cc?ds=sidebyside diff --git a/apt-pkg/tagfile.cc b/apt-pkg/tagfile.cc index 91653f602..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.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 @@ -94,7 +94,8 @@ bool pkgTagFile::Fill() /*}}}*/ // 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; @@ -179,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()); +} + /*}}}*/