]>
git.saurik.com Git - apt.git/blob - apt-pkg/pkgrecords.cc
b3105da4444f2eaa7b364d49d178a271a123fd8b
1 // -*- mode: cpp; mode: fold -*-
3 // $Id: pkgrecords.cc,v 1.1 1998/08/09 00:51:35 jgg Exp $
4 /* ######################################################################
6 Package Records - Allows access to complete package description records
7 directly from the file.
9 ##################################################################### */
11 // Include Files /*{{{*/
13 #pragma implementation "apt-pkg/pkgrecords.h"
15 #include <apt-pkg/pkgrecords.h>
16 #include <apt-pkg/debrecords.h>
17 #include <apt-pkg/error.h>
20 // Records::pkgRecords - Constructor /*{{{*/
21 // ---------------------------------------------------------------------
22 /* This will create the necessary structures to access the status files */
23 pkgRecords::pkgRecords(pkgCache
&Cache
) : Cache(Cache
), Files(0)
25 Files
= new PkgFile
[Cache
.HeaderP
->PackageFileCount
];
26 for (pkgCache::PkgFileIterator I
= Cache
.FileBegin();
27 I
.end() == false; I
++)
29 Files
[I
->ID
].File
= new FileFd(I
.FileName(),FileFd::ReadOnly
);
30 if (_error
->PendingError() == true)
32 Files
[I
->ID
].Parse
= new debRecordParser(*Files
[I
->ID
].File
);
33 if (_error
->PendingError() == true)
38 // Records::~pkgRecords - Destructor /*{{{*/
39 // ---------------------------------------------------------------------
41 pkgRecords::~pkgRecords()
46 // Records::Lookup - Get a parser for the package version file /*{{{*/
47 // ---------------------------------------------------------------------
49 pkgRecords::Parser
&pkgRecords::Lookup(pkgCache::VerFileIterator
&Ver
)
51 PkgFile
&File
= Files
[Ver
.File()->ID
];
52 File
.Parse
->Jump(Ver
);
57 // Records::Pkgfile::~PkgFile - Destructor /*{{{*/
58 // ---------------------------------------------------------------------
60 pkgRecords::PkgFile::~PkgFile()