]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/metaindex.cc
better non-virtual metaIndex.LocalFileName() implementation
[apt.git] / apt-pkg / metaindex.cc
diff --git a/apt-pkg/metaindex.cc b/apt-pkg/metaindex.cc
new file mode 100644 (file)
index 0000000..31a8ec0
--- /dev/null
@@ -0,0 +1,40 @@
+// Include Files                                                       /*{{{*/
+#include <apt-pkg/indexfile.h>
+#include <apt-pkg/metaindex.h>
+
+#include <stddef.h>
+
+#include <string>
+#include <vector>
+                                                                       /*}}}*/
+
+#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13)
+std::string metaIndex::LocalFileName() const { return ""; }
+#else
+#include <apt-pkg/debmetaindex.h>
+std::string metaIndex::LocalFileName() const
+{
+   debReleaseIndex const * deb = dynamic_cast<debReleaseIndex const*>(this);
+   if (deb != NULL)
+      return deb->LocalFileName();
+
+   return "";
+}
+#endif
+
+metaIndex::metaIndex(std::string const &URI, std::string const &Dist,
+      char const * const Type)
+: Indexes(NULL), Type(Type), URI(URI), Dist(Dist), Trusted(false)
+{
+   /* nothing */
+}
+
+metaIndex::~metaIndex()
+{
+   if (Indexes == 0)
+      return;
+   for (std::vector<pkgIndexFile *>::iterator I = (*Indexes).begin();
+        I != (*Indexes).end(); ++I)
+      delete *I;
+   delete Indexes;
+}