]>
git.saurik.com Git - apt.git/blob - apt-pkg/metaindex.cc
1 // Include Files /*{{{*/
2 #include <apt-pkg/pkgcachegen.h>
3 #include <apt-pkg/indexfile.h>
4 #include <apt-pkg/metaindex.h>
10 std::string
metaIndex::Describe() const
15 pkgCache::RlsFileIterator
metaIndex::FindInCache(pkgCache
&Cache
, bool const) const
17 return pkgCache::RlsFileIterator(Cache
);
20 bool metaIndex::Merge(pkgCacheGenerator
&Gen
,OpProgress
*) const
22 return Gen
.SelectReleaseFile("", "");
25 metaIndex::metaIndex(std::string
const &URI
, std::string
const &Dist
,
26 char const * const Type
)
27 : d(NULL
), Indexes(NULL
), Type(Type
), URI(URI
), Dist(Dist
), Trusted(TRI_UNSET
),
28 Date(0), ValidUntil(0), SupportsAcquireByHash(false), LoadedSuccessfully(TRI_UNSET
)
33 metaIndex::~metaIndex()
37 for (std::vector
<pkgIndexFile
*>::iterator I
= (*Indexes
).begin();
38 I
!= (*Indexes
).end(); ++I
)
43 // one line Getters for public fields /*{{{*/
44 APT_PURE
std::string
metaIndex::GetURI() const { return URI
; }
45 APT_PURE
std::string
metaIndex::GetDist() const { return Dist
; }
46 APT_PURE
const char* metaIndex::GetType() const { return Type
; }
47 APT_PURE
metaIndex::TriState
metaIndex::GetTrusted() const { return Trusted
; }
48 APT_PURE
std::string
metaIndex::GetSignedBy() const { return SignedBy
; }
49 APT_PURE
std::string
metaIndex::GetCodename() const { return Codename
; }
50 APT_PURE
std::string
metaIndex::GetSuite() const { return Suite
; }
51 APT_PURE
bool metaIndex::GetSupportsAcquireByHash() const { return SupportsAcquireByHash
; }
52 APT_PURE
time_t metaIndex::GetValidUntil() const { return ValidUntil
; }
53 APT_PURE
time_t metaIndex::GetDate() const { return this->Date
; }
54 APT_PURE
metaIndex::TriState
metaIndex::GetLoadedSuccessfully() const { return LoadedSuccessfully
; }
56 APT_PURE
bool metaIndex::CheckDist(string
const &MaybeDist
) const
58 return (this->Codename
== MaybeDist
59 || this->Suite
== MaybeDist
);
61 APT_PURE
std::string
metaIndex::GetExpectedDist() const
63 // TODO: Used to be an explicit value set in the constructor
67 APT_PURE
metaIndex::checkSum
*metaIndex::Lookup(string
const &MetaKey
) const /*{{{*/
69 std::map
<std::string
, metaIndex::checkSum
* >::const_iterator sum
= Entries
.find(MetaKey
);
70 if (sum
== Entries
.end())
75 APT_PURE
bool metaIndex::Exists(string
const &MetaKey
) const /*{{{*/
77 return Entries
.find(MetaKey
) != Entries
.end();
80 std::vector
<std::string
> metaIndex::MetaKeys() const /*{{{*/
82 std::vector
<std::string
> keys
;
83 std::map
<string
,checkSum
*>::const_iterator I
= Entries
.begin();
84 while(I
!= Entries
.end()) {
85 keys
.push_back((*I
).first
);
91 void metaIndex::swapLoad(metaIndex
* const OldMetaIndex
) /*{{{*/
93 std::swap(Entries
, OldMetaIndex
->Entries
);
94 std::swap(Date
, OldMetaIndex
->Date
);
95 std::swap(ValidUntil
, OldMetaIndex
->ValidUntil
);
96 std::swap(SupportsAcquireByHash
, OldMetaIndex
->SupportsAcquireByHash
);
97 std::swap(LoadedSuccessfully
, OldMetaIndex
->LoadedSuccessfully
);