]>
git.saurik.com Git - apt.git/blob - apt-pkg/pkgrecords.cc
1 // -*- mode: cpp; mode: fold -*-
3 // $Id: pkgrecords.cc,v 1.4 1998/11/13 04:23:34 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>
18 #include <apt-pkg/configuration.h>
21 // Records::pkgRecords - Constructor /*{{{*/
22 // ---------------------------------------------------------------------
23 /* This will create the necessary structures to access the status files */
24 pkgRecords::pkgRecords(pkgCache
&Cache
) : Cache(Cache
), Files(0)
26 Files
= new PkgFile
[Cache
.HeaderP
->PackageFileCount
];
27 for (pkgCache::PkgFileIterator I
= Cache
.FileBegin();
28 I
.end() == false; I
++)
30 // We can not initialize if the cache is out of sync.
31 if (I
.IsOk() == false)
33 _error
->Error("Package file %s is out of sync.",I
.FileName());
38 Files
[I
->ID
].File
= new FileFd(I
.FileName(),FileFd::ReadOnly
);
39 if (_error
->PendingError() == true)
43 Files
[I
->ID
].Parse
= new debRecordParser(*Files
[I
->ID
].File
);
44 if (_error
->PendingError() == true)
49 // Records::~pkgRecords - Destructor /*{{{*/
50 // ---------------------------------------------------------------------
52 pkgRecords::~pkgRecords()
57 // Records::Lookup - Get a parser for the package version file /*{{{*/
58 // ---------------------------------------------------------------------
60 pkgRecords::Parser
&pkgRecords::Lookup(pkgCache::VerFileIterator
const &Ver
)
62 PkgFile
&File
= Files
[Ver
.File()->ID
];
63 File
.Parse
->Jump(Ver
);
68 // Records::Pkgfile::~PkgFile - Destructor /*{{{*/
69 // ---------------------------------------------------------------------
71 pkgRecords::PkgFile::~PkgFile()