diff options
author | Julian Andres Klode <julian.klode@canonical.com> | 2020-02-26 14:15:24 +0100 |
---|---|---|
committer | Julian Andres Klode <julian.klode@canonical.com> | 2020-02-26 14:16:17 +0100 |
commit | d31f807a8d3f031d5efc5c3be9b76f9a9ac22d5d (patch) | |
tree | 607a4954fa794a688d2be0ab1781e3d4eecd90cc | |
parent | dc911bdda7cce03bf2b4dd4cfc37bae044ad9f2a (diff) |
Remove various dynamic_cast uses, use virtual methods instead
-rw-r--r-- | apt-pkg/deb/debmetaindex.h | 6 | ||||
-rw-r--r-- | apt-pkg/metaindex.cc | 9 | ||||
-rw-r--r-- | apt-pkg/metaindex.h | 7 |
3 files changed, 6 insertions, 16 deletions
diff --git a/apt-pkg/deb/debmetaindex.h b/apt-pkg/deb/debmetaindex.h index 0038f52f9..5bdbbc70c 100644 --- a/apt-pkg/deb/debmetaindex.h +++ b/apt-pkg/deb/debmetaindex.h @@ -55,9 +55,9 @@ class APT_HIDDEN debReleaseIndex : public metaIndex std::map<std::string, std::string> GetReleaseOptions(); virtual bool IsTrusted() const APT_OVERRIDE; - bool IsArchitectureSupported(std::string const &arch) const; - bool IsArchitectureAllSupportedFor(IndexTarget const &target) const; - bool HasSupportForComponent(std::string const &component) const; + bool IsArchitectureSupported(std::string const &arch) const override; + bool IsArchitectureAllSupportedFor(IndexTarget const &target) const override; + bool HasSupportForComponent(std::string const &component) const override; APT_PURE time_t GetNotBefore() const; diff --git a/apt-pkg/metaindex.cc b/apt-pkg/metaindex.cc index d0b3f5165..fe0d9c597 100644 --- a/apt-pkg/metaindex.cc +++ b/apt-pkg/metaindex.cc @@ -146,25 +146,16 @@ void metaIndex::swapLoad(metaIndex * const OldMetaIndex) /*{{{*/ bool metaIndex::IsArchitectureSupported(std::string const &arch) const /*{{{*/ { - debReleaseIndex const * const deb = dynamic_cast<debReleaseIndex const *>(this); - if (deb != NULL) - return deb->IsArchitectureSupported(arch); return true; } /*}}}*/ bool metaIndex::IsArchitectureAllSupportedFor(IndexTarget const &target) const/*{{{*/ { - debReleaseIndex const * const deb = dynamic_cast<debReleaseIndex const *>(this); - if (deb != NULL) - return deb->IsArchitectureAllSupportedFor(target); return true; } /*}}}*/ bool metaIndex::HasSupportForComponent(std::string const &component) const/*{{{*/ { - debReleaseIndex const * const deb = dynamic_cast<debReleaseIndex const *>(this); - if (deb != NULL) - return deb->HasSupportForComponent(component); return true; } /*}}}*/ diff --git a/apt-pkg/metaindex.h b/apt-pkg/metaindex.h index a44e5c21e..5e5efd5ff 100644 --- a/apt-pkg/metaindex.h +++ b/apt-pkg/metaindex.h @@ -102,10 +102,9 @@ public: char const * const Type); virtual ~metaIndex(); - // FIXME: make virtual on next abi break - bool IsArchitectureSupported(std::string const &arch) const; - bool IsArchitectureAllSupportedFor(IndexTarget const &target) const; - bool HasSupportForComponent(std::string const &component) const; + virtual bool IsArchitectureSupported(std::string const &arch) const; + virtual bool IsArchitectureAllSupportedFor(IndexTarget const &target) const; + virtual bool HasSupportForComponent(std::string const &component) const; // FIXME: should be members of the class on abi break APT_HIDDEN void SetOrigin(std::string const &origin); APT_HIDDEN void SetLabel(std::string const &label); |