Fixed a small memory leak
[ntk/apt.git] / apt-pkg / tagfile.h
index af69247..8499862 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: tagfile.h,v 1.8 1998/07/19 21:24:17 jgg Exp $
+// $Id: tagfile.h,v 1.14 1999/07/03 06:45:40 jgg Exp $
 /* ######################################################################
 
    Fast scanner for RFC-822 type header information
@@ -34,6 +34,8 @@ class pkgTagSection
    
    // We have a limit of 256 tags per section.
    unsigned short Indexes[256];
+   unsigned short AlphaIndexes[26 + 26*26];
+   
    unsigned int TagCount;
      
    public:
@@ -42,9 +44,23 @@ 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);
+   signed int FindI(const char *Tag,signed long Default = 0);
+   bool pkgTagSection::FindFlag(const char *Tag,unsigned long &Flags,
+                               unsigned long Flag);
    bool Scan(const char *Start,unsigned long MaxLength);
    inline unsigned long size() {return Stop - Section;};
 
+   inline unsigned int Count() {return TagCount;};
+   inline void Get(const char *&Start,const char *&Stop,unsigned int I)
+                   {Start = Section + Indexes[I]; Stop = Section + Indexes[I+1];}
+           
+   inline void GetSection(const char *&Start,const char *&Stop)
+   {
+      Start = Section;
+      Stop = this->Stop;
+   };
+   
    pkgTagSection() : Section(0), Stop(0) {};
 };
 
@@ -65,8 +81,9 @@ class pkgTagFile
    bool Step(pkgTagSection &Section);
    inline unsigned long Offset() {return iOffset;};
    bool Jump(pkgTagSection &Tag,unsigned long Offset);
-      
+
    pkgTagFile(FileFd &F,unsigned long Size = 32*1024);
+   ~pkgTagFile();
 };
 
 #endif