]>
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>
12 std::string
metaIndex::Describe() const
17 pkgCache::RlsFileIterator
metaIndex::FindInCache(pkgCache
&Cache
, bool const) const
19 return pkgCache::RlsFileIterator(Cache
);
22 bool metaIndex::Merge(pkgCacheGenerator
&Gen
,OpProgress
*) const
24 return Gen
.SelectReleaseFile("", "");
27 metaIndex::metaIndex(std::string
const &URI
, std::string
const &Dist
,
28 char const * const Type
)
29 : d(NULL
), Indexes(NULL
), Type(Type
), URI(URI
), Dist(Dist
), Trusted(TRI_UNSET
),
30 Date(0), ValidUntil(0), SupportsAcquireByHash(false), LoadedSuccessfully(TRI_UNSET
)
35 metaIndex::~metaIndex()
39 for (std::vector
<pkgIndexFile
*>::iterator I
= (*Indexes
).begin();
40 I
!= (*Indexes
).end(); ++I
)
45 // one line Getters for public fields /*{{{*/
46 APT_PURE
std::string
metaIndex::GetURI() const { return URI
; }
47 APT_PURE
std::string
metaIndex::GetDist() const { return Dist
; }
48 APT_PURE
const char* metaIndex::GetType() const { return Type
; }
49 APT_PURE
metaIndex::TriState
metaIndex::GetTrusted() const { return Trusted
; }
50 APT_PURE
std::string
metaIndex::GetSignedBy() const { return SignedBy
; }
51 APT_PURE
std::string
metaIndex::GetCodename() const { return Codename
; }
52 APT_PURE
std::string
metaIndex::GetSuite() const { return Suite
; }
53 APT_PURE
bool metaIndex::GetSupportsAcquireByHash() const { return SupportsAcquireByHash
; }
54 APT_PURE
time_t metaIndex::GetValidUntil() const { return ValidUntil
; }
55 APT_PURE
time_t metaIndex::GetDate() const { return this->Date
; }
56 APT_PURE
metaIndex::TriState
metaIndex::GetLoadedSuccessfully() const { return LoadedSuccessfully
; }
58 APT_PURE
bool metaIndex::CheckDist(string
const &MaybeDist
) const
60 return (this->Codename
== MaybeDist
61 || this->Suite
== MaybeDist
);
63 APT_PURE
std::string
metaIndex::GetExpectedDist() const
65 // TODO: Used to be an explicit value set in the constructor
69 APT_PURE
metaIndex::checkSum
*metaIndex::Lookup(string
const &MetaKey
) const /*{{{*/
71 std::map
<std::string
, metaIndex::checkSum
* >::const_iterator sum
= Entries
.find(MetaKey
);
72 if (sum
== Entries
.end())
77 APT_PURE
bool metaIndex::Exists(string
const &MetaKey
) const /*{{{*/
79 return Entries
.find(MetaKey
) != Entries
.end();
82 std::vector
<std::string
> metaIndex::MetaKeys() const /*{{{*/
84 std::vector
<std::string
> keys
;
85 std::map
<string
,checkSum
*>::const_iterator I
= Entries
.begin();
86 while(I
!= Entries
.end()) {
87 keys
.push_back((*I
).first
);
93 void metaIndex::swapLoad(metaIndex
* const OldMetaIndex
) /*{{{*/
95 std::swap(Entries
, OldMetaIndex
->Entries
);
96 std::swap(Date
, OldMetaIndex
->Date
);
97 std::swap(ValidUntil
, OldMetaIndex
->ValidUntil
);
98 std::swap(SupportsAcquireByHash
, OldMetaIndex
->SupportsAcquireByHash
);
99 std::swap(LoadedSuccessfully
, OldMetaIndex
->LoadedSuccessfully
);