+// Include Files /*{{{*/
+#include <apt-pkg/indexfile.h>
+#include <apt-pkg/metaindex.h>
-#include <apt-pkg/strutl.h>
-
-#include "init.h"
-#include "metaindex.h"
+#include <stddef.h>
+#include <string>
+#include <vector>
+ /*}}}*/
#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13)
-string metaIndex::MetaIndexInfo(const char *Type) const
+std::string metaIndex::LocalFileName() const { return ""; }
+#else
+#include <apt-pkg/debmetaindex.h>
+std::string metaIndex::LocalFileName() const
{
- string Info = ::URI::SiteOnly(URI) + ' ';
- if (Dist[Dist.size() - 1] == '/')
- {
- if (Dist != "/")
- Info += Dist;
- }
- else
- Info += Dist;
- Info += " ";
- Info += Type;
- return Info;
+ debReleaseIndex const * deb = dynamic_cast<debReleaseIndex const*>(this);
+ if (deb != NULL)
+ return deb->LocalFileName();
+
+ return "";
}
+#endif
-string metaIndex::MetaIndexFile(const char *Type) const
+metaIndex::metaIndex(std::string const &URI, std::string const &Dist,
+ char const * const Type)
+: Indexes(NULL), Type(Type), URI(URI), Dist(Dist), Trusted(false)
{
- return _config->FindDir("Dir::State::lists") +
- URItoFileName(MetaIndexURI(Type));
+ /* nothing */
}
-string metaIndex::MetaIndexURI(const char *Type) const
+metaIndex::~metaIndex()
{
- string Res;
-
- if (Dist == "/")
- Res = URI;
- else if (Dist[Dist.size()-1] == '/')
- Res = URI + Dist;
- else
- Res = URI + "dists/" + Dist + "/";
-
- Res += Type;
- return Res;
+ if (Indexes == 0)
+ return;
+ for (std::vector<pkgIndexFile *>::iterator I = (*Indexes).begin();
+ I != (*Indexes).end(); ++I)
+ delete *I;
+ delete Indexes;
}
-#endif