aboutsummaryrefslogtreecommitdiff
path: root/src/clients
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-11-13 16:31:53 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-11-13 16:31:53 +0000
commitc22b445963b1b7d8cf2e45da950c902d63cb837b (patch)
tree8634caa6f371a6018dc1326d4e291da8ebd74168 /src/clients
parent72833626ac5df274e559c3f66720615b26340721 (diff)
downloadpaludis-c22b445963b1b7d8cf2e45da950c902d63cb837b.tar.gz
paludis-c22b445963b1b7d8cf2e45da950c902d63cb837b.tar.xz
Add MetadataSectionKey
Diffstat (limited to 'src/clients')
-rw-r--r--src/clients/gtkpaludis/libgtkpaludis/version_info_model.cc4
-rw-r--r--src/clients/inquisitio/key_extractor.cc6
-rw-r--r--src/clients/instruo/instruo.cc97
-rw-r--r--src/clients/qualudis/qualudis.cc11
4 files changed, 30 insertions, 88 deletions
diff --git a/src/clients/gtkpaludis/libgtkpaludis/version_info_model.cc b/src/clients/gtkpaludis/libgtkpaludis/version_info_model.cc
index 200f4cd60..0a08f6cc6 100644
--- a/src/clients/gtkpaludis/libgtkpaludis/version_info_model.cc
+++ b/src/clients/gtkpaludis/libgtkpaludis/version_info_model.cc
@@ -196,6 +196,10 @@ namespace gtkpaludis
void visit(const MetadataContentsKey &)
{
}
+
+ void visit(const MetadataSectionKey &)
+ {
+ }
};
struct VersionInfoModel::KeyMetadataPopulator :
diff --git a/src/clients/inquisitio/key_extractor.cc b/src/clients/inquisitio/key_extractor.cc
index 436501bed..7f384ef00 100644
--- a/src/clients/inquisitio/key_extractor.cc
+++ b/src/clients/inquisitio/key_extractor.cc
@@ -385,6 +385,12 @@ namespace
result = v.result;
}
}
+
+ void visit(const MetadataSectionKey & k)
+ {
+ std::for_each(indirect_iterator(k.begin_metadata()),
+ indirect_iterator(k.end_metadata()), accept_visitor(*this));
+ }
};
}
diff --git a/src/clients/instruo/instruo.cc b/src/clients/instruo/instruo.cc
index 5a21cfc80..015a37b10 100644
--- a/src/clients/instruo/instruo.cc
+++ b/src/clients/instruo/instruo.cc
@@ -30,6 +30,7 @@
#include <paludis/util/map.hh>
#include <paludis/util/tr1_functional.hh>
#include <paludis/util/visitor-impl.hh>
+#include <paludis/util/visitor_cast.hh>
#include <paludis/util/set.hh>
#include <paludis/environments/no_config/no_config_environment.hh>
#include <paludis/package_database.hh>
@@ -46,88 +47,6 @@ using std::endl;
namespace
{
- struct EAPIFinder :
- ConstVisitor<MetadataKeyVisitorTypes>
- {
- bool ok;
- std::string s;
-
- EAPIFinder() :
- ok(false)
- {
- }
-
- void visit(const MetadataStringKey & k)
- {
- s = k.value();
- ok = true;
- }
-
- void visit(const MetadataPackageIDKey &)
- {
- }
-
- void visit(const MetadataTimeKey &)
- {
- }
-
- void visit(const MetadataContentsKey &)
- {
- }
-
- void visit(const MetadataFSEntryKey &)
- {
- }
-
- void visit(const MetadataRepositoryMaskInfoKey &)
- {
- }
-
- void visit(const MetadataSpecTreeKey<RestrictSpecTree> &)
- {
- }
-
- void visit(const MetadataSpecTreeKey<ProvideSpecTree> &)
- {
- }
-
- void visit(const MetadataSpecTreeKey<FetchableURISpecTree> &)
- {
- }
-
- void visit(const MetadataSpecTreeKey<SimpleURISpecTree> &)
- {
- }
-
- void visit(const MetadataSpecTreeKey<LicenseSpecTree> &)
- {
- }
-
- void visit(const MetadataSpecTreeKey<DependencySpecTree> &)
- {
- }
-
- void visit(const MetadataSetKey<PackageIDSequence> &)
- {
- }
-
- void visit(const MetadataSetKey<Set<std::string> > &)
- {
- }
-
- void visit(const MetadataSetKey<KeywordNameSet> &)
- {
- }
-
- void visit(const MetadataSetKey<IUseFlagSet> &)
- {
- }
-
- void visit(const MetadataSetKey<UseFlagNameSet> &)
- {
- }
- };
-
struct KeyValidator :
ConstVisitor<MetadataKeyVisitorTypes>
{
@@ -215,6 +134,12 @@ namespace
{
const tr1::shared_ptr<const UseFlagNameSet> & PALUDIS_ATTRIBUTE((unused)) s(k.value());
}
+
+ void visit(const MetadataSectionKey & k)
+ {
+ std::for_each(indirect_iterator(k.begin_metadata()),
+ indirect_iterator(k.end_metadata()), accept_visitor(*this));
+ }
};
}
@@ -315,17 +240,15 @@ main(int argc, char *argv[])
continue;
}
- EAPIFinder f;
- (*eapi_i)->accept(f);
- if (! f.ok)
+ if (! visitor_cast<const MetadataStringKey>(**eapi_i))
{
results.insert(std::make_pair(*i, "EAPI metadata key is not a string key"));
continue;
}
- if (f.s == "UNKNOWN")
+ if (visitor_cast<const MetadataStringKey>(**eapi_i)->value() == "UNKNOWN")
{
- results.insert(std::make_pair(*i, "EAPI is '" + f.s + "'"));
+ results.insert(std::make_pair(*i, "EAPI is 'UNKNOWN'"));
continue;
}
diff --git a/src/clients/qualudis/qualudis.cc b/src/clients/qualudis/qualudis.cc
index 860b6cf37..ab2496b2d 100644
--- a/src/clients/qualudis/qualudis.cc
+++ b/src/clients/qualudis/qualudis.cc
@@ -144,8 +144,17 @@ namespace
stream << k.raw_name() << "\n";
}
- void visit(const MetadataContentsKey &)
+ void visit(const MetadataContentsKey & k)
{
+ stream << k.raw_name() << "\n";
+ }
+
+ void visit(const MetadataSectionKey & k)
+ {
+ if (k.title_key())
+ stream << k.raw_name() << ": " << k.title_key()->value() << "\n";
+ else
+ stream << k.raw_name() << "\n";
}
};