]>
git.saurik.com Git - apt.git/blob - apt-pkg/indexfile.h
c38cf0bf09149c055bfbccb9c8b81874c9eeeaa0
1 // -*- mode: cpp; mode: fold -*-
3 // $Id: indexfile.h,v 1.6.2.1 2003/12/24 23:09:17 mdz Exp $
4 /* ######################################################################
6 Index File - Abstraction for an index of archive/source file.
8 There are 4 primary sorts of index files, all represented by this
12 Binary translation files
13 Binary index files describing the local system
16 They are all bundled together here, and the interfaces for
17 sources.list, acquire, cache gen and record parsing all use this class
18 to access the underlying representation.
20 ##################################################################### */
22 #ifndef PKGLIB_INDEXFILE_H
23 #define PKGLIB_INDEXFILE_H
25 #include <apt-pkg/srcrecords.h>
26 #include <apt-pkg/pkgrecords.h>
27 #include <apt-pkg/pkgcache.h>
28 #include <apt-pkg/cacheiterators.h>
29 #include <apt-pkg/macros.h>
34 #ifndef APT_8_CLEANER_HEADERS
37 #ifndef APT_10_CLEANER_HEADERS
41 class pkgCacheGenerator
;
44 class IndexTarget
/*{{{*/
45 /** \brief Information about an index file. */
48 /** \brief A URI from which the index file can be downloaded. */
51 /** \brief A description of the index file. */
52 std::string Description
;
54 /** \brief A shorter description of the index file. */
55 std::string ShortDesc
;
57 /** \brief The key by which this index file should be
58 looked up within the meta index file. */
61 /** \brief Is it okay if the file isn't found in the meta index */
64 /** \brief options with which this target was created
65 Prefer the usage of #Option if at all possible.
66 Beware: Not all of these options are intended for public use */
67 std::map
<std::string
, std::string
> Options
;
69 IndexTarget(std::string
const &MetaKey
, std::string
const &ShortDesc
,
70 std::string
const &LongDesc
, std::string
const &URI
, bool const IsOptional
,
71 std::map
<std::string
, std::string
> const &Options
);
83 std::string
Option(OptionKeys
const Key
) const;
98 // Global list of Items supported
99 static Type
**GlobalList
;
100 static unsigned long GlobalListLen
;
101 static Type
*GetType(const char *Type
) APT_PURE
;
105 virtual pkgRecords::Parser
*CreatePkgParser(pkgCache::PkgFileIterator
/*File*/) const {return 0;};
106 virtual pkgSrcRecords::Parser
*CreateSrcPkgParser(std::string
/*File*/) const {return 0;};
111 virtual const Type
*GetType() const = 0;
113 // Return descriptive strings of various sorts
114 virtual std::string
ArchiveInfo(pkgCache::VerIterator Ver
) const;
115 virtual std::string
SourceInfo(pkgSrcRecords::Parser
const &Record
,
116 pkgSrcRecords::File
const &File
) const;
117 virtual std::string
Describe(bool Short
= false) const = 0;
119 // Interface for acquire
120 virtual std::string
ArchiveURI(std::string
/*File*/) const {return std::string();};
122 // Interface for the record parsers
123 virtual pkgSrcRecords::Parser
*CreateSrcParser() const {return 0;};
125 // Interface for the Cache Generator
126 virtual bool Exists() const = 0;
127 virtual bool HasPackages() const = 0;
128 virtual unsigned long Size() const = 0;
129 virtual bool Merge(pkgCacheGenerator
&/*Gen*/, OpProgress
* /*Prog*/) const { return false; };
130 APT_DEPRECATED
virtual bool Merge(pkgCacheGenerator
&Gen
, OpProgress
&Prog
) const
131 { return Merge(Gen
, &Prog
); };
132 virtual bool MergeFileProvides(pkgCacheGenerator
&/*Gen*/,OpProgress
* /*Prog*/) const {return true;};
133 APT_DEPRECATED
virtual bool MergeFileProvides(pkgCacheGenerator
&Gen
, OpProgress
&Prog
) const
134 {return MergeFileProvides(Gen
, &Prog
);};
135 virtual pkgCache::PkgFileIterator
FindInCache(pkgCache
&Cache
) const;
137 static bool TranslationsAvailable();
138 static bool CheckLanguageCode(const char *Lang
);
139 static std::string
LanguageCode();
141 bool IsTrusted() const { return Trusted
; };
143 pkgIndexFile(bool Trusted
);
144 virtual ~pkgIndexFile() {};
147 class pkgIndexTargetFile
: public pkgIndexFile
150 IndexTarget
const Target
;
152 std::string
IndexFileName() const;
155 virtual std::string
ArchiveURI(std::string File
) const;
156 virtual std::string
Describe(bool Short
= false) const;
157 virtual bool Exists() const;
158 virtual unsigned long Size() const;
160 pkgIndexTargetFile(IndexTarget
const &Target
, bool const Trusted
);