Browse Source

The fastest way to get field values is as a range.

Jay Freeman (saurik) 7 years ago
parent
commit
f3514c6d0f
3 changed files with 10 additions and 0 deletions
  1. 6 0
      apt-pkg/deb/debrecords.cc
  2. 1 0
      apt-pkg/deb/debrecords.h
  3. 3 0
      apt-pkg/pkgrecords.h

+ 6 - 0
apt-pkg/deb/debrecords.cc

@@ -210,6 +210,12 @@ void debRecordParserBase::GetRec(const char *&Start,const char *&Stop)
    Section.GetSection(Start,Stop);
 }
 									/*}}}*/
+// RecordParserBase::Find - Locate a tag			/*{{{*/
+bool debRecordParserBase::Find(const char *Tag,const char *&Start, const char *&End)
+{
+   return Section.Find(Tag,Start,End);
+}
+									/*}}}*/
 debRecordParserBase::~debRecordParserBase() {}
 
 bool debDebFileRecordParser::LoadContent()

+ 1 - 0
apt-pkg/deb/debrecords.h

@@ -51,6 +51,7 @@ class APT_HIDDEN debRecordParserBase : public pkgRecords::Parser
    virtual std::string RecordField(const char *fieldName) APT_OVERRIDE;
 
    virtual void GetRec(const char *&Start,const char *&Stop) APT_OVERRIDE;
+   virtual bool Find(const char *Tag,const char *&Start, const char *&End) APT_OVERRIDE;
 
    debRecordParserBase();
    virtual ~debRecordParserBase();

+ 3 - 0
apt-pkg/pkgrecords.h

@@ -101,6 +101,9 @@ class pkgRecords::Parser						/*{{{*/
    // The record in binary form
    virtual void GetRec(const char *&Start,const char *&Stop) {Start = Stop = 0;};
 
+   // Locate a tag
+   virtual bool Find(const char *Tag,const char *&Start, const char *&End) {Start = End = 0; return false;};
+
    Parser();
    virtual ~Parser();