X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/216d0bd8869c4f52ead5256064512ac97e9fc824..8d0d92558c00d1825e413ce67be51a46a5c18aea:/apt-pkg/metaindex.h?ds=sidebyside diff --git a/apt-pkg/metaindex.h b/apt-pkg/metaindex.h index f60235a5d..3a624e86d 100644 --- a/apt-pkg/metaindex.h +++ b/apt-pkg/metaindex.h @@ -1,55 +1,116 @@ #ifndef PKGLIB_METAINDEX_H #define PKGLIB_METAINDEX_H +#include +#include + +#include #include +#include + +#ifndef APT_10_CLEANER_HEADERS #include +class pkgCacheGenerator; +class OpProgress; +#endif +#ifndef APT_8_CLEANER_HEADERS #include #include -#include -#include - using std::string; +#endif class pkgAcquire; +class IndexTarget; class pkgCacheGenerator; class OpProgress; class metaIndex { - protected: - vector *Indexes; +public: + APT_IGNORE_DEPRECATED_PUSH + struct checkSum + { + std::string MetaKeyFilename; + HashStringList Hashes; + unsigned long long Size; + + APT_DEPRECATED_MSG("Use the HashStringList member Hashes instead of a hardcoded HashString") HashString Hash; + }; + APT_IGNORE_DEPRECATED_POP + + enum APT_HIDDEN TriState { + TRI_YES, TRI_DONTCARE, TRI_NO, TRI_UNSET + }; +private: + void * const d; +protected: + std::vector *Indexes; + // parsed from the sources.list const char *Type; - string URI; - string Dist; - bool Trusted; + std::string URI; + std::string Dist; + TriState Trusted; + std::string SignedBy; - public: + // parsed from a file + std::string Suite; + std::string Codename; + time_t Date; + time_t ValidUntil; + bool SupportsAcquireByHash; + std::map Entries; + TriState LoadedSuccessfully; - +public: // Various accessors - virtual string GetURI() const {return URI;} - virtual string GetDist() const {return Dist;} - virtual const char* GetType() const {return Type;} + std::string GetURI() const; + std::string GetDist() const; + const char* GetType() const; + TriState GetTrusted() const; + std::string GetSignedBy() const; + + std::string GetCodename() const; + std::string GetSuite() const; + bool GetSupportsAcquireByHash() const; + time_t GetValidUntil() const; + time_t GetDate() const; + + std::string GetExpectedDist() const; + bool CheckDist(std::string const &MaybeDist) const; // Interface for acquire - virtual string ArchiveURI(string const& /*File*/) const = 0; - virtual bool GetIndexes(pkgAcquire *Owner, bool const &GetAll=false) const = 0; - - virtual vector *GetIndexFiles() = 0; + virtual std::string Describe() const; + virtual std::string ArchiveURI(std::string const& File) const = 0; + virtual bool GetIndexes(pkgAcquire *Owner, bool const &GetAll=false) = 0; + virtual std::vector GetIndexTargets() const = 0; + virtual std::vector *GetIndexFiles() = 0; virtual bool IsTrusted() const = 0; + virtual bool Load(std::string const &Filename, std::string * const ErrorText) = 0; + /** @return a new metaIndex object based on this one, but without information from #Load */ + virtual metaIndex * UnloadedClone() const = 0; + // the given metaIndex is potentially invalid after this call and should be deleted + void swapLoad(metaIndex * const OldMetaIndex); + + // Lookup functions for parsed Hashes + checkSum *Lookup(std::string const &MetaKey) const; + /** \brief tests if a checksum for this file is available */ + bool Exists(std::string const &MetaKey) const; + std::vector MetaKeys() const; + TriState GetLoadedSuccessfully() const; + + // Interfaces for pkgCacheGen + virtual pkgCache::RlsFileIterator FindInCache(pkgCache &Cache, bool const ModifyCheck) const; + virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const; + + + metaIndex(std::string const &URI, std::string const &Dist, + char const * const Type); + virtual ~metaIndex(); - metaIndex(string const &URI, string const &Dist, char const * const Type) : - Indexes(NULL), Type(Type), URI(URI), Dist(Dist) { - } - - virtual ~metaIndex() { - if (Indexes == 0) - return; - for (vector::iterator I = (*Indexes).begin(); I != (*Indexes).end(); ++I) - delete *I; - delete Indexes; - } + // FIXME: make virtual on next abi break + bool IsArchitectureSupported(std::string const &arch) const; + bool IsArchitectureAllSupportedFor(IndexTarget const &target) const; }; #endif