aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-01-18 23:55:50 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-01-18 23:55:50 +0000
commitb12a4f151e0c16e18c08de5929922e4cd4d35165 (patch)
treecd410e5e465c10881752a718734554547d039e8d
parentcfbe6ed8eb60a9096d32856a8442a477137edb96 (diff)
downloadpaludis-b12a4f151e0c16e18c08de5929922e4cd4d35165.tar.gz
paludis-b12a4f151e0c16e18c08de5929922e4cd4d35165.tar.xz
Make metadata key general methods pure virtual.
-rw-r--r--paludis/literal_metadata_key.cc130
-rw-r--r--paludis/literal_metadata_key.hh18
-rw-r--r--paludis/metadata_key.cc60
-rw-r--r--paludis/metadata_key.hh85
-rw-r--r--paludis/repositories/cran/keys.cc81
-rw-r--r--paludis/repositories/cran/keys.hh22
-rw-r--r--paludis/repositories/e/dep_parser.cc18
-rw-r--r--paludis/repositories/e/e_choices_key.cc34
-rw-r--r--paludis/repositories/e/e_choices_key.hh9
-rw-r--r--paludis/repositories/e/e_installed_repository_id.cc3
-rw-r--r--paludis/repositories/e/e_key.cc400
-rw-r--r--paludis/repositories/e/e_key.hh91
-rw-r--r--paludis/repositories/e/eapi-fwd.hh4
-rw-r--r--paludis/repositories/e/ebuild.cc2
-rw-r--r--paludis/repositories/e/ebuild_flat_metadata_cache.cc4
-rw-r--r--paludis/repositories/e/ebuild_id.cc4
-rw-r--r--paludis/repositories/e/ebuild_id.hh4
-rw-r--r--paludis/repositories/e/exndbam_id.cc18
-rw-r--r--paludis/repositories/e/info_metadata_key.cc44
-rw-r--r--paludis/repositories/e/info_metadata_key.hh13
-rw-r--r--paludis/repositories/fake/fake_package_id.cc159
-rw-r--r--paludis/repositories/fake/fake_package_id.hh22
-rw-r--r--paludis/repositories/unpackaged/installed_id.cc121
-rw-r--r--paludis/repositories/unpackaged/unpackaged_key.cc68
-rw-r--r--paludis/repositories/unpackaged/unpackaged_key.hh16
-rw-r--r--paludis/repositories/unwritten/unwritten_repository_file.cc25
-rw-r--r--paludis/repositories/virtuals/package_id.cc30
-rw-r--r--paludis/repositories/virtuals/package_id.hh6
-rw-r--r--paludis/unchoices_key.cc18
-rwxr-xr-xpython/mask_TEST.py4
-rw-r--r--python/metadata_key.cc468
-rwxr-xr-xpython/metadata_key_TEST.py165
32 files changed, 1727 insertions, 419 deletions
diff --git a/paludis/literal_metadata_key.cc b/paludis/literal_metadata_key.cc
index e1db4fd..0df3f48 100644
--- a/paludis/literal_metadata_key.cc
+++ b/paludis/literal_metadata_key.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -35,9 +35,16 @@ namespace paludis
template <>
struct Implementation<LiteralMetadataFSEntrySequenceKey>
{
+ const std::string raw_name;
+ const std::string human_name;
+ const MetadataKeyType type;
const std::tr1::shared_ptr<const FSEntrySequence> value;
- Implementation(const std::tr1::shared_ptr<const FSEntrySequence> & v) :
+ Implementation(const std::string & r, const std::string & h, const MetadataKeyType t,
+ const std::tr1::shared_ptr<const FSEntrySequence> & v) :
+ raw_name(r),
+ human_name(h),
+ type(t),
value(v)
{
}
@@ -46,9 +53,16 @@ namespace paludis
template <>
struct Implementation<LiteralMetadataStringSetKey>
{
+ const std::string raw_name;
+ const std::string human_name;
+ const MetadataKeyType type;
const std::tr1::shared_ptr<const Set<std::string> > value;
- Implementation(const std::tr1::shared_ptr<const Set<std::string> > & v) :
+ Implementation(const std::string & r, const std::string & h, const MetadataKeyType t,
+ const std::tr1::shared_ptr<const Set<std::string> > & v) :
+ raw_name(r),
+ human_name(h),
+ type(t),
value(v)
{
}
@@ -57,9 +71,16 @@ namespace paludis
template <>
struct Implementation<LiteralMetadataStringSequenceKey>
{
+ const std::string raw_name;
+ const std::string human_name;
+ const MetadataKeyType type;
const std::tr1::shared_ptr<const Sequence<std::string> > value;
- Implementation(const std::tr1::shared_ptr<const Sequence<std::string> > & v) :
+ Implementation(const std::string & r, const std::string & h, const MetadataKeyType t,
+ const std::tr1::shared_ptr<const Sequence<std::string> > & v) :
+ raw_name(r),
+ human_name(h),
+ type(t),
value(v)
{
}
@@ -71,19 +92,24 @@ namespace paludis
template <typename T_>
struct Implementation<LiteralMetadataValueKey<T_> >
{
+ const std::string raw_name;
+ const std::string human_name;
+ const MetadataKeyType type;
const T_ value;
- Implementation(const T_ & v) :
+ Implementation(const std::string & r, const std::string & h, const MetadataKeyType t, const T_ & v) :
+ raw_name(r),
+ human_name(h),
+ type(t),
value(v)
{
}
};
}
-LiteralMetadataFSEntrySequenceKey::LiteralMetadataFSEntrySequenceKey(const std::string & h, const std::string & r,
+LiteralMetadataFSEntrySequenceKey::LiteralMetadataFSEntrySequenceKey(const std::string & r, const std::string & h,
const MetadataKeyType t, const std::tr1::shared_ptr<const FSEntrySequence> & v) :
- MetadataCollectionKey<FSEntrySequence>(h, r, t),
- PrivateImplementationPattern<LiteralMetadataFSEntrySequenceKey>(new Implementation<LiteralMetadataFSEntrySequenceKey>(v)),
+ PrivateImplementationPattern<LiteralMetadataFSEntrySequenceKey>(new Implementation<LiteralMetadataFSEntrySequenceKey>(r, h, t, v)),
_imp(PrivateImplementationPattern<LiteralMetadataFSEntrySequenceKey>::_imp)
{
}
@@ -113,10 +139,27 @@ LiteralMetadataFSEntrySequenceKey::pretty_print_flat(const Formatter<FSEntry> &
return join(value()->begin(), value()->end(), " ", std::tr1::bind(&format_fsentry, _1, f));
}
-LiteralMetadataStringSetKey::LiteralMetadataStringSetKey(const std::string & h, const std::string & r,
+const std::string
+LiteralMetadataFSEntrySequenceKey::human_name() const
+{
+ return _imp->human_name;
+}
+
+const std::string
+LiteralMetadataFSEntrySequenceKey::raw_name() const
+{
+ return _imp->raw_name;
+}
+
+MetadataKeyType
+LiteralMetadataFSEntrySequenceKey::type() const
+{
+ return _imp->type;
+}
+
+LiteralMetadataStringSetKey::LiteralMetadataStringSetKey(const std::string & r, const std::string & h,
const MetadataKeyType t, const std::tr1::shared_ptr<const Set<std::string> > & v) :
- MetadataCollectionKey<Set<std::string> >(h, r, t),
- PrivateImplementationPattern<LiteralMetadataStringSetKey>(new Implementation<LiteralMetadataStringSetKey>(v)),
+ PrivateImplementationPattern<LiteralMetadataStringSetKey>(new Implementation<LiteralMetadataStringSetKey>(r, h, t, v)),
_imp(PrivateImplementationPattern<LiteralMetadataStringSetKey>::_imp)
{
}
@@ -131,10 +174,9 @@ LiteralMetadataStringSetKey::value() const
return _imp->value;
}
-LiteralMetadataStringSequenceKey::LiteralMetadataStringSequenceKey(const std::string & h, const std::string & r,
+LiteralMetadataStringSequenceKey::LiteralMetadataStringSequenceKey(const std::string & r, const std::string & h,
const MetadataKeyType t, const std::tr1::shared_ptr<const Sequence<std::string> > & v) :
- MetadataCollectionKey<Sequence<std::string> >(h, r, t),
- PrivateImplementationPattern<LiteralMetadataStringSequenceKey>(new Implementation<LiteralMetadataStringSequenceKey>(v)),
+ PrivateImplementationPattern<LiteralMetadataStringSequenceKey>(new Implementation<LiteralMetadataStringSequenceKey>(r, h, t, v)),
_imp(PrivateImplementationPattern<LiteralMetadataStringSequenceKey>::_imp)
{
}
@@ -149,6 +191,24 @@ LiteralMetadataStringSequenceKey::value() const
return _imp->value;
}
+const std::string
+LiteralMetadataStringSequenceKey::human_name() const
+{
+ return _imp->human_name;
+}
+
+const std::string
+LiteralMetadataStringSequenceKey::raw_name() const
+{
+ return _imp->raw_name;
+}
+
+MetadataKeyType
+LiteralMetadataStringSequenceKey::type() const
+{
+ return _imp->type;
+}
+
namespace
{
std::string format_string(const std::string & i, const Formatter<std::string> & f)
@@ -171,6 +231,45 @@ LiteralMetadataStringSequenceKey::pretty_print_flat(const Formatter<std::string>
return join(value()->begin(), value()->end(), " ", std::tr1::bind(&format_string, _1, f));
}
+const std::string
+LiteralMetadataStringSetKey::human_name() const
+{
+ return _imp->human_name;
+}
+
+const std::string
+LiteralMetadataStringSetKey::raw_name() const
+{
+ return _imp->raw_name;
+}
+
+MetadataKeyType
+LiteralMetadataStringSetKey::type() const
+{
+ return _imp->type;
+}
+
+template <typename T_>
+const std::string
+LiteralMetadataValueKey<T_>::human_name() const
+{
+ return _imp->human_name;
+}
+
+template <typename T_>
+const std::string
+LiteralMetadataValueKey<T_>::raw_name() const
+{
+ return _imp->raw_name;
+}
+
+template <typename T_>
+MetadataKeyType
+LiteralMetadataValueKey<T_>::type() const
+{
+ return _imp->type;
+}
+
ExtraLiteralMetadataValueKeyMethods<long>::~ExtraLiteralMetadataValueKeyMethods()
{
}
@@ -206,8 +305,7 @@ ExtraLiteralMetadataValueKeyMethods<std::tr1::shared_ptr<const PackageID> >::pre
template <typename T_>
LiteralMetadataValueKey<T_>::LiteralMetadataValueKey(const std::string & r, const std::string & h,
const MetadataKeyType t, const T_ & v) :
- MetadataValueKey<T_>(r, h, t),
- PrivateImplementationPattern<LiteralMetadataValueKey<T_> >(new Implementation<LiteralMetadataValueKey<T_> >(v)),
+ PrivateImplementationPattern<LiteralMetadataValueKey<T_> >(new Implementation<LiteralMetadataValueKey<T_> >(r, h, t, v)),
_imp(PrivateImplementationPattern<LiteralMetadataValueKey<T_ > >::_imp)
{
}
diff --git a/paludis/literal_metadata_key.hh b/paludis/literal_metadata_key.hh
index b15477b..af65131 100644
--- a/paludis/literal_metadata_key.hh
+++ b/paludis/literal_metadata_key.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -111,6 +111,10 @@ namespace paludis
///\}
virtual const T_ value() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
};
/**
@@ -141,6 +145,10 @@ namespace paludis
virtual std::string pretty_print_flat(const Formatter<FSEntry> &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
};
/**
@@ -171,6 +179,10 @@ namespace paludis
virtual std::string pretty_print_flat(const Formatter<std::string> &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
};
/**
@@ -201,6 +213,10 @@ namespace paludis
virtual std::string pretty_print_flat(const Formatter<std::string> &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
};
}
diff --git a/paludis/metadata_key.cc b/paludis/metadata_key.cc
index 9189811..1e9cddf 100644
--- a/paludis/metadata_key.cc
+++ b/paludis/metadata_key.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -51,84 +51,50 @@ namespace paludis
};
}
-MetadataKey::MetadataKey(const std::string & r, const std::string & h, const MetadataKeyType t) :
- PrivateImplementationPattern<MetadataKey>(new Implementation<MetadataKey>(r, h, t))
-{
-}
-
MetadataKey::~MetadataKey()
{
}
-const std::string
-MetadataKey::raw_name() const
-{
- return _imp->raw_name;
-}
-
-const std::string
-MetadataKey::human_name() const
-{
- return _imp->human_name;
-}
-
-MetadataKeyType
-MetadataKey::type() const
-{
- return _imp->type;
-}
-
-MetadataSectionKey::MetadataSectionKey(const std::string & r, const std::string & h, const MetadataKeyType t) :
- MetadataKey(r, h, t)
-{
-}
-
MetadataSectionKey::~MetadataSectionKey()
{
}
-MetadataTimeKey::MetadataTimeKey(const std::string & r, const std::string & h, const MetadataKeyType t) :
- MetadataKey(r, h, t)
+MetadataTimeKey::~MetadataTimeKey()
{
}
-template <typename C_>
-MetadataValueKey<C_>::MetadataValueKey(const std::string & r, const std::string & h, const MetadataKeyType t) :
- MetadataKey(r, h, t)
+ExtraMetadataValueKeyMethods<long>::~ExtraMetadataValueKeyMethods()
{
}
-template <typename C_>
-MetadataCollectionKey<C_>::MetadataCollectionKey(const std::string & r, const std::string & h, const MetadataKeyType t) :
- MetadataKey(r, h, t)
+ExtraMetadataValueKeyMethods<bool>::~ExtraMetadataValueKeyMethods()
{
}
-ExtraMetadataValueKeyMethods<long>::~ExtraMetadataValueKeyMethods()
+ExtraMetadataValueKeyMethods<std::tr1::shared_ptr<const PackageID> >::~ExtraMetadataValueKeyMethods()
{
}
-ExtraMetadataValueKeyMethods<bool>::~ExtraMetadataValueKeyMethods()
+template <typename T_>
+MetadataCollectionKey<T_>::~MetadataCollectionKey()
{
}
-ExtraMetadataValueKeyMethods<std::tr1::shared_ptr<const PackageID> >::~ExtraMetadataValueKeyMethods()
+template <typename T_>
+MetadataSpecTreeKey<T_>::~MetadataSpecTreeKey()
{
}
-template <typename C_>
-MetadataSpecTreeKey<C_>::MetadataSpecTreeKey(const std::string & r, const std::string & h, const MetadataKeyType t) :
- MetadataKey(r, h, t)
+template <typename T_>
+MetadataValueKey<T_>::~MetadataValueKey()
{
}
-MetadataSpecTreeKey<FetchableURISpecTree>::MetadataSpecTreeKey(const std::string & r, const std::string & h, const MetadataKeyType t) :
- MetadataKey(r, h, t)
+MetadataSpecTreeKey<FetchableURISpecTree>::~MetadataSpecTreeKey()
{
}
-MetadataSpecTreeKey<DependencySpecTree>::MetadataSpecTreeKey(const std::string & r, const std::string & h, const MetadataKeyType t) :
- MetadataKey(r, h, t)
+MetadataSpecTreeKey<DependencySpecTree>::~MetadataSpecTreeKey()
{
}
diff --git a/paludis/metadata_key.hh b/paludis/metadata_key.hh
index 380480f..6d30a81 100644
--- a/paludis/metadata_key.hh
+++ b/paludis/metadata_key.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -34,7 +34,6 @@
#include <paludis/util/fs_entry-fwd.hh>
#include <paludis/util/attributes.hh>
#include <paludis/util/instantiation_policy.hh>
-#include <paludis/util/private_implementation_pattern.hh>
#include <paludis/util/remove_shared_ptr.hh>
#include <paludis/util/simple_visitor.hh>
#include <paludis/util/type_list.hh>
@@ -85,7 +84,6 @@ namespace paludis
*/
class PALUDIS_VISIBLE MetadataKey :
private InstantiationPolicy<MetadataKey, instantiation_method::NonCopyableTag>,
- private PrivateImplementationPattern<MetadataKey>,
public virtual DeclareAbstractAcceptMethods<MetadataKey, MakeTypeList<
MetadataCollectionKey<KeywordNameSet>,
MetadataCollectionKey<Set<std::string> >,
@@ -110,13 +108,10 @@ namespace paludis
MetadataSectionKey
>::Type>
{
- protected:
+ public:
///\name Basic operations
///\{
- MetadataKey(const std::string & raw_name, const std::string & human_name, const MetadataKeyType);
-
- public:
virtual ~MetadataKey() = 0;
///\}
@@ -124,17 +119,17 @@ namespace paludis
/**
* Fetch our raw name.
*/
- virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
/**
* Fetch our human name.
*/
- virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
/**
* Fetch our key type.
*/
- virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
};
/**
@@ -150,19 +145,11 @@ namespace paludis
public ImplementAcceptMethods<MetadataKey, MetadataSectionKey>,
public MetadataKeyHolder
{
- protected:
- ///\name Basic operations
- ///\{
-
- MetadataSectionKey(const std::string &, const std::string &, const MetadataKeyType);
-
- ///\}
-
public:
///\name Basic operations
///\{
- virtual ~MetadataSectionKey();
+ virtual ~MetadataSectionKey() = 0;
///\}
};
@@ -250,15 +237,9 @@ namespace paludis
public ImplementAcceptMethods<MetadataKey, MetadataValueKey<C_> >,
public virtual ExtraMetadataValueKeyMethods<C_>
{
- protected:
- ///\name Basic operations
- ///\{
-
- MetadataValueKey(const std::string &, const std::string &, const MetadataKeyType);
-
- ///\}
-
public:
+ virtual ~MetadataValueKey() = 0;
+
/**
* Fetch our value.
*/
@@ -277,15 +258,9 @@ namespace paludis
public MetadataKey,
public ImplementAcceptMethods<MetadataKey, MetadataTimeKey>
{
- protected:
- ///\name Basic operations
- ///\{
-
- MetadataTimeKey(const std::string &, const std::string &, const MetadataKeyType);
-
- ///\}
-
public:
+ virtual ~MetadataTimeKey() = 0;
+
/**
* Fetch our value.
*/
@@ -306,15 +281,9 @@ namespace paludis
public MetadataKey,
public ImplementAcceptMethods<MetadataKey, MetadataCollectionKey<C_> >
{
- protected:
- ///\name Basic operations
- ///\{
-
- MetadataCollectionKey(const std::string &, const std::string &, const MetadataKeyType);
-
- ///\}
-
public:
+ virtual ~MetadataCollectionKey() = 0;
+
/**
* Fetch our value.
*/
@@ -343,15 +312,9 @@ namespace paludis
public MetadataKey,
public ImplementAcceptMethods<MetadataKey, MetadataSpecTreeKey<C_> >
{
- protected:
- ///\name Basic operations
- ///\{
-
- MetadataSpecTreeKey(const std::string &, const std::string &, const MetadataKeyType);
-
- ///\}
-
public:
+ virtual ~MetadataSpecTreeKey() = 0;
+
/**
* Fetch our value.
*/
@@ -389,15 +352,9 @@ namespace paludis
public MetadataKey,
public ImplementAcceptMethods<MetadataKey, MetadataSpecTreeKey<FetchableURISpecTree> >
{
- protected:
- ///\name Basic operations
- ///\{
-
- MetadataSpecTreeKey(const std::string &, const std::string &, const MetadataKeyType);
-
- ///\}
-
public:
+ virtual ~MetadataSpecTreeKey() = 0;
+
/**
* Fetch our value.
*/
@@ -442,15 +399,9 @@ namespace paludis
public MetadataKey,
public ImplementAcceptMethods<MetadataKey, MetadataSpecTreeKey<DependencySpecTree> >
{
- protected:
- ///\name Basic operations
- ///\{
-
- MetadataSpecTreeKey(const std::string &, const std::string &, const MetadataKeyType);
-
- ///\}
-
public:
+ virtual ~MetadataSpecTreeKey() = 0;
+
/**
* Fetch our value.
*/
diff --git a/paludis/repositories/cran/keys.cc b/paludis/repositories/cran/keys.cc
index a8ad2bf..7a1ee4b 100644
--- a/paludis/repositories/cran/keys.cc
+++ b/paludis/repositories/cran/keys.cc
@@ -39,9 +39,11 @@ using namespace paludis::cranrepository;
PackageIDSequenceKey::PackageIDSequenceKey(const Environment * const e,
const std::string & r, const std::string & h, const MetadataKeyType t) :
- MetadataCollectionKey<PackageIDSequence>(r, h, t),
_env(e),
- _v(new PackageIDSequence)
+ _v(new PackageIDSequence),
+ _r(r),
+ _h(h),
+ _t(t)
{
}
@@ -51,6 +53,24 @@ PackageIDSequenceKey::value() const
return _v;
}
+const std::string
+PackageIDSequenceKey::raw_name() const
+{
+ return _r;
+}
+
+const std::string
+PackageIDSequenceKey::human_name() const
+{
+ return _h;
+}
+
+MetadataKeyType
+PackageIDSequenceKey::type() const
+{
+ return _t;
+}
+
void
PackageIDSequenceKey::push_back(const std::tr1::shared_ptr<const PackageID> & i)
{
@@ -69,8 +89,10 @@ PackageIDSequenceKey::pretty_print_flat(const Formatter<PackageID> & f) const
PackageIDKey::PackageIDKey(const std::string & r, const std::string & h,
const CRANPackageID * const v, const MetadataKeyType t) :
- MetadataValueKey<std::tr1::shared_ptr<const PackageID> >(r, h, t),
- _v(v)
+ _v(v),
+ _r(r),
+ _h(h),
+ _t(t)
{
}
@@ -80,6 +102,24 @@ PackageIDKey::value() const
return _v->shared_from_this();
}
+const std::string
+PackageIDKey::raw_name() const
+{
+ return _r;
+}
+
+const std::string
+PackageIDKey::human_name() const
+{
+ return _h;
+}
+
+MetadataKeyType
+PackageIDKey::type() const
+{
+ return _t;
+}
+
std::string
PackageIDKey::pretty_print(const Formatter<PackageID> & f) const
{
@@ -108,11 +148,19 @@ namespace paludis
mutable std::tr1::shared_ptr<const DependencySpecTree> c;
const std::tr1::shared_ptr<const DependencyLabelSequence> labels;
+ const std::string raw_name;
+ const std::string human_name;
+ const MetadataKeyType type;
+
Implementation(const Environment * const e, const std::string & vv,
- const std::tr1::shared_ptr<const DependencyLabelSequence> & s) :
+ const std::tr1::shared_ptr<const DependencyLabelSequence> & s,
+ const std::string & r, const std::string & h, const MetadataKeyType & t) :
env(e),
v(vv),
- labels(s)
+ labels(s),
+ raw_name(r),
+ human_name(h),
+ type(t)
{
}
};
@@ -120,8 +168,7 @@ namespace paludis
DepKey::DepKey(const Environment * const e, const std::string & r, const std::string & h, const std::string & v,
const std::tr1::shared_ptr<const DependencyLabelSequence> & s, const MetadataKeyType t) :
- MetadataSpecTreeKey<DependencySpecTree>(r, h, t),
- PrivateImplementationPattern<DepKey>(new Implementation<DepKey>(e, v, s)),
+ PrivateImplementationPattern<DepKey>(new Implementation<DepKey>(e, v, s, r, h, t)),
_imp(PrivateImplementationPattern<DepKey>::_imp)
{
}
@@ -130,6 +177,24 @@ DepKey::~DepKey()
{
}
+const std::string
+DepKey::raw_name() const
+{
+ return _imp->raw_name;
+}
+
+const std::string
+DepKey::human_name() const
+{
+ return _imp->human_name;
+}
+
+MetadataKeyType
+DepKey::type() const
+{
+ return _imp->type;
+}
+
const std::tr1::shared_ptr<const DependencySpecTree>
DepKey::value() const
{
diff --git a/paludis/repositories/cran/keys.hh b/paludis/repositories/cran/keys.hh
index 004c5a8..f488579 100644
--- a/paludis/repositories/cran/keys.hh
+++ b/paludis/repositories/cran/keys.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -38,6 +38,10 @@ namespace paludis
const Environment * const _env;
const std::tr1::shared_ptr<PackageIDSequence> _v;
+ const std::string _r;
+ const std::string _h;
+ const MetadataKeyType _t;
+
public:
PackageIDSequenceKey(const Environment * const,
const std::string &, const std::string &, const MetadataKeyType);
@@ -49,6 +53,10 @@ namespace paludis
virtual std::string pretty_print_flat(const Formatter<PackageID> &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
};
class PackageIDKey :
@@ -57,6 +65,10 @@ namespace paludis
private:
const CRANPackageID * const _v;
+ const std::string _r;
+ const std::string _h;
+ const MetadataKeyType _t;
+
public:
PackageIDKey(const std::string &, const std::string &, const CRANPackageID * const, const MetadataKeyType);
@@ -65,6 +77,10 @@ namespace paludis
virtual std::string pretty_print(const Formatter<PackageID> &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
};
class DepKey :
@@ -92,6 +108,10 @@ namespace paludis
virtual const std::tr1::shared_ptr<const DependencyLabelSequence> initial_labels() const
PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
};
}
}
diff --git a/paludis/repositories/e/dep_parser.cc b/paludis/repositories/e/dep_parser.cc
index 46a46c6..c652051 100644
--- a/paludis/repositories/e/dep_parser.cc
+++ b/paludis/repositories/e/dep_parser.cc
@@ -288,8 +288,7 @@ namespace
struct AnnotationsKey :
MetadataSectionKey
{
- AnnotationsKey(const std::tr1::shared_ptr<const Map<std::string, std::string> > & m) :
- MetadataSectionKey("Annotations", "Annotations", mkt_normal)
+ AnnotationsKey(const std::tr1::shared_ptr<const Map<std::string, std::string> > & m)
{
for (Map<std::string, std::string>::ConstIterator k(m->begin()), k_end(m->end()) ;
k != k_end ; ++k)
@@ -299,6 +298,21 @@ namespace
void need_keys_added() const
{
}
+
+ virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result))
+ {
+ return "Annotations";
+ }
+
+ virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result))
+ {
+ return "Annotations";
+ }
+
+ virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result))
+ {
+ return mkt_normal;
+ }
};
void set_annotations(std::tr1::shared_ptr<DepSpec> & spec, const std::tr1::shared_ptr<const Map<std::string, std::string> > & m)
diff --git a/paludis/repositories/e/e_choices_key.cc b/paludis/repositories/e/e_choices_key.cc
index 9fba4dd..c2ca3e6 100644
--- a/paludis/repositories/e/e_choices_key.cc
+++ b/paludis/repositories/e/e_choices_key.cc
@@ -64,13 +64,21 @@ namespace paludis
const std::tr1::shared_ptr<const ERepository> maybe_e_repository;
const std::tr1::shared_ptr<const Map<ChoiceNameWithPrefix, std::string> > maybe_descriptions;
+ const std::string raw_name;
+ const std::string human_name;
+ const MetadataKeyType type;
+
Implementation(const Environment * const e, const std::tr1::shared_ptr<const ERepositoryID> & i,
const std::tr1::shared_ptr<const ERepository> & p,
- const std::tr1::shared_ptr<const Map<ChoiceNameWithPrefix, std::string> > & d) :
+ const std::tr1::shared_ptr<const Map<ChoiceNameWithPrefix, std::string> > & d,
+ const std::string & r, const std::string & h, const MetadataKeyType t) :
env(e),
id(i),
maybe_e_repository(p),
- maybe_descriptions(d)
+ maybe_descriptions(d),
+ raw_name(r),
+ human_name(h),
+ type(t)
{
}
};
@@ -82,9 +90,7 @@ EChoicesKey::EChoicesKey(
const std::string & r, const std::string & h, const MetadataKeyType t,
const std::tr1::shared_ptr<const ERepository> & p,
const std::tr1::shared_ptr<const Map<ChoiceNameWithPrefix, std::string> > & d) :
- MetadataValueKey<std::tr1::shared_ptr<const Choices> > (r, h, t),
- PrivateImplementationPattern<EChoicesKey>(new Implementation<EChoicesKey>(e, i, p, d)),
- _imp(PrivateImplementationPattern<EChoicesKey>::_imp)
+ PrivateImplementationPattern<EChoicesKey>(new Implementation<EChoicesKey>(e, i, p, d, r, h, t))
{
}
@@ -481,3 +487,21 @@ EChoicesKey::value() const
return _imp->value;
}
+const std::string
+EChoicesKey::raw_name() const
+{
+ return _imp->raw_name;
+}
+
+const std::string
+EChoicesKey::human_name() const
+{
+ return _imp->human_name;
+}
+
+MetadataKeyType
+EChoicesKey::type() const
+{
+ return _imp->type;
+}
+
diff --git a/paludis/repositories/e/e_choices_key.hh b/paludis/repositories/e/e_choices_key.hh
index 6d48372..c5f4eb7 100644
--- a/paludis/repositories/e/e_choices_key.hh
+++ b/paludis/repositories/e/e_choices_key.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2008 Ciaran McCreesh
+ * Copyright (c) 2008, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -37,9 +37,6 @@ namespace paludis
public MetadataValueKey<std::tr1::shared_ptr<const Choices> >,
private PrivateImplementationPattern<EChoicesKey>
{
- private:
- PrivateImplementationPattern<EChoicesKey>::ImpPtr & _imp;
-
public:
EChoicesKey(
const Environment * const,
@@ -53,6 +50,10 @@ namespace paludis
~EChoicesKey();
const std::tr1::shared_ptr<const Choices> value() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
};
}
}
diff --git a/paludis/repositories/e/e_installed_repository_id.cc b/paludis/repositories/e/e_installed_repository_id.cc
index fa90edc..f05cd82 100644
--- a/paludis/repositories/e/e_installed_repository_id.cc
+++ b/paludis/repositories/e/e_installed_repository_id.cc
@@ -339,8 +339,7 @@ EInstalledRepositoryID::need_keys_added() const
if (! vars->src_uri()->name().empty())
if ((_imp->dir / vars->src_uri()->name()).exists())
{
- _imp->src_uri.reset(new EFetchableURIKey(_imp->environment, shared_from_this(), vars->src_uri()->name(),
- vars->src_uri()->description(),
+ _imp->src_uri.reset(new EFetchableURIKey(_imp->environment, shared_from_this(), vars->src_uri(),
file_contents(_imp->dir / vars->src_uri()->name()), mkt_dependencies));
add_metadata_key(_imp->src_uri);
}
diff --git a/paludis/repositories/e/e_key.cc b/paludis/repositories/e/e_key.cc
index 6fd9877..e72c141 100644
--- a/paludis/repositories/e/e_key.cc
+++ b/paludis/repositories/e/e_key.cc
@@ -57,8 +57,10 @@ using namespace paludis::erepository;
EMutableRepositoryMaskInfoKey::EMutableRepositoryMaskInfoKey(const std::tr1::shared_ptr<const ERepositoryID> &,
const std::string & r, const std::string & h, const std::tr1::shared_ptr<const RepositoryMaskInfo> & v, const MetadataKeyType t) :
- MetadataValueKey<std::tr1::shared_ptr<const RepositoryMaskInfo> > (r, h, t),
- _value(v)
+ _value(v),
+ _r(r),
+ _h(h),
+ _t(t)
{
}
@@ -78,6 +80,24 @@ EMutableRepositoryMaskInfoKey::set_value(const std::tr1::shared_ptr<const Reposi
_value = v;
}
+const std::string
+EMutableRepositoryMaskInfoKey::raw_name() const
+{
+ return _r;
+}
+
+const std::string
+EMutableRepositoryMaskInfoKey::human_name() const
+{
+ return _h;
+}
+
+MetadataKeyType
+EMutableRepositoryMaskInfoKey::type() const
+{
+ return _t;
+}
+
namespace paludis
{
template <>
@@ -91,14 +111,22 @@ namespace paludis
mutable std::tr1::function<void () throw ()> value_used;
const std::tr1::shared_ptr<const DependencyLabelSequence> labels;
+ const std::string raw_name;
+ const std::string human_name;
+ const MetadataKeyType type;
+
Implementation(
const Environment * const e,
const std::tr1::shared_ptr<const ERepositoryID> & i, const std::string & v,
- const std::tr1::shared_ptr<const DependencyLabelSequence> & s) :
+ const std::tr1::shared_ptr<const DependencyLabelSequence> & s,
+ const std::string & r, const std::string & h, const MetadataKeyType & t) :
env(e),
id(i),
string_value(v),
- labels(s)
+ labels(s),
+ raw_name(r),
+ human_name(h),
+ type(t)
{
}
};
@@ -109,9 +137,7 @@ EDependenciesKey::EDependenciesKey(
const std::tr1::shared_ptr<const ERepositoryID> & id,
const std::string & r, const std::string & h, const std::string & v,
const std::tr1::shared_ptr<const DependencyLabelSequence> & l, const MetadataKeyType t) :
- MetadataSpecTreeKey<DependencySpecTree>(r, h, t),
- PrivateImplementationPattern<EDependenciesKey>(new Implementation<EDependenciesKey>(e, id, v, l)),
- _imp(PrivateImplementationPattern<EDependenciesKey>::_imp)
+ PrivateImplementationPattern<EDependenciesKey>(new Implementation<EDependenciesKey>(e, id, v, l, r, h, t))
{
}
@@ -162,6 +188,24 @@ EDependenciesKey::pretty_print_flat(const DependencySpecTree::ItemFormatter & f)
return stringify(p);
}
+const std::string
+EDependenciesKey::raw_name() const
+{
+ return _imp->raw_name;
+}
+
+const std::string
+EDependenciesKey::human_name() const
+{
+ return _imp->human_name;
+}
+
+MetadataKeyType
+EDependenciesKey::type() const
+{
+ return _imp->type;
+}
+
namespace paludis
{
template <>
@@ -174,11 +218,19 @@ namespace paludis
mutable std::tr1::shared_ptr<const LicenseSpecTree> value;
mutable std::tr1::function<void () throw ()> value_used;
+ const std::string raw_name;
+ const std::string human_name;
+ const MetadataKeyType type;
+
Implementation(const Environment * const e,
- const std::tr1::shared_ptr<const ERepositoryID> & i, const std::string & v) :
+ const std::tr1::shared_ptr<const ERepositoryID> & i, const std::string & v,
+ const std::string & r, const std::string & h, const MetadataKeyType t) :
env(e),
id(i),
- string_value(v)
+ string_value(v),
+ raw_name(r),
+ human_name(h),
+ type(t)
{
}
};
@@ -188,9 +240,7 @@ ELicenseKey::ELicenseKey(
const Environment * const e,
const std::tr1::shared_ptr<const ERepositoryID> & id,
const std::string & r, const std::string & h, const std::string & v, const MetadataKeyType t) :
- MetadataSpecTreeKey<LicenseSpecTree>(r, h, t),
- PrivateImplementationPattern<ELicenseKey>(new Implementation<ELicenseKey>(e, id, v)),
- _imp(PrivateImplementationPattern<ELicenseKey>::_imp)
+ PrivateImplementationPattern<ELicenseKey>(new Implementation<ELicenseKey>(e, id, v, r, h, t))
{
}
@@ -235,6 +285,24 @@ ELicenseKey::pretty_print_flat(const LicenseSpecTree::ItemFormatter & f) const
return stringify(p);
}
+const std::string
+ELicenseKey::raw_name() const
+{
+ return _imp->raw_name;
+}
+
+const std::string
+ELicenseKey::human_name() const
+{
+ return _imp->human_name;
+}
+
+MetadataKeyType
+ELicenseKey::type() const
+{
+ return _imp->type;
+}
+
namespace paludis
{
template <>
@@ -242,15 +310,22 @@ namespace paludis
{
const Environment * const env;
const std::tr1::shared_ptr<const ERepositoryID> id;
+ const std::tr1::shared_ptr<const EAPIMetadataVariable> variable;
const std::string string_value;
+ const MetadataKeyType type;
+
mutable Mutex value_mutex;
mutable std::tr1::shared_ptr<const FetchableURISpecTree> value;
mutable std::tr1::shared_ptr<const URILabel> initial_label;
- Implementation(const Environment * const e, const std::tr1::shared_ptr<const ERepositoryID> & i, const std::string & v) :
+ Implementation(const Environment * const e, const std::tr1::shared_ptr<const ERepositoryID> & i,
+ const std::tr1::shared_ptr<const EAPIMetadataVariable> & m, const std::string & v,
+ const MetadataKeyType t) :
env(e),
id(i),
- string_value(v)
+ variable(m),
+ string_value(v),
+ type(t)
{
}
};
@@ -258,10 +333,8 @@ namespace paludis
EFetchableURIKey::EFetchableURIKey(const Environment * const e,
const std::tr1::shared_ptr<const ERepositoryID> & id,
- const std::string & r, const std::string & h, const std::string & v, const MetadataKeyType t) :
- MetadataSpecTreeKey<FetchableURISpecTree>(r, h, t),
- PrivateImplementationPattern<EFetchableURIKey>(new Implementation<EFetchableURIKey>(e, id, v)),
- _imp(PrivateImplementationPattern<EFetchableURIKey>::_imp)
+ const std::tr1::shared_ptr<const EAPIMetadataVariable> & m, const std::string & v, const MetadataKeyType t) :
+ PrivateImplementationPattern<EFetchableURIKey>(new Implementation<EFetchableURIKey>(e, id, m, v, t))
{
}
@@ -336,6 +409,24 @@ EFetchableURIKey::initial_label() const
return _imp->initial_label;
}
+const std::string
+EFetchableURIKey::raw_name() const
+{
+ return _imp->variable->name();
+}
+
+const std::string
+EFetchableURIKey::human_name() const
+{
+ return _imp->variable->description();
+}
+
+MetadataKeyType
+EFetchableURIKey::type() const
+{
+ return _imp->type;
+}
+
namespace paludis
{
template <>
@@ -347,10 +438,19 @@ namespace paludis
mutable Mutex value_mutex;
mutable std::tr1::shared_ptr<const SimpleURISpecTree> value;
- Implementation(const Environment * const e, const std::tr1::shared_ptr<const ERepositoryID> & i, const std::string & v) :
+ const std::string raw_name;
+ const std::string human_name;
+ const MetadataKeyType type;
+
+ Implementation(const Environment * const e, const std::tr1::shared_ptr<const ERepositoryID> & i,
+ const std::string & v,
+ const std::string & r, const std::string & h, const MetadataKeyType t) :
env(e),
id(i),
- string_value(v)
+ string_value(v),
+ raw_name(r),
+ human_name(h),
+ type(t)
{
}
};
@@ -359,9 +459,7 @@ namespace paludis
ESimpleURIKey::ESimpleURIKey(const Environment * const e,
const std::tr1::shared_ptr<const ERepositoryID> & id,
const std::string & r, const std::string & h, const std::string & v, const MetadataKeyType t) :
- MetadataSpecTreeKey<SimpleURISpecTree>(r, h, t),
- PrivateImplementationPattern<ESimpleURIKey>(new Implementation<ESimpleURIKey>(e, id, v)),
- _imp(PrivateImplementationPattern<ESimpleURIKey>::_imp)
+ PrivateImplementationPattern<ESimpleURIKey>(new Implementation<ESimpleURIKey>(e, id, v, r, h, t))
{
}
@@ -400,6 +498,24 @@ ESimpleURIKey::pretty_print_flat(const SimpleURISpecTree::ItemFormatter & f) con
return stringify(p);
}
+const std::string
+ESimpleURIKey::raw_name() const
+{
+ return _imp->raw_name;
+}
+
+const std::string
+ESimpleURIKey::human_name() const
+{
+ return _imp->human_name;
+}
+
+MetadataKeyType
+ESimpleURIKey::type() const
+{
+ return _imp->type;
+}
+
namespace paludis
{
template <>
@@ -411,10 +527,18 @@ namespace paludis
mutable Mutex value_mutex;
mutable std::tr1::shared_ptr<const PlainTextSpecTree> value;
- Implementation(const Environment * const e, const std::tr1::shared_ptr<const ERepositoryID> & i, const std::string & v) :
+ const std::string raw_name;
+ const std::string human_name;
+ const MetadataKeyType type;
+
+ Implementation(const Environment * const e, const std::tr1::shared_ptr<const ERepositoryID> & i, const std::string & v,
+ const std::string & r, const std::string & h, const MetadataKeyType t) :
env(e),
id(i),
- string_value(v)
+ string_value(v),
+ raw_name(r),
+ human_name(h),
+ type(t)
{
}
};
@@ -423,9 +547,7 @@ namespace paludis
EPlainTextSpecKey::EPlainTextSpecKey(const Environment * const e,
const std::tr1::shared_ptr<const ERepositoryID> & id,
const std::string & r, const std::string & h, const std::string & v, const MetadataKeyType t) :
- MetadataSpecTreeKey<PlainTextSpecTree>(r, h, t),
- PrivateImplementationPattern<EPlainTextSpecKey>(new Implementation<EPlainTextSpecKey>(e, id, v)),
- _imp(PrivateImplementationPattern<EPlainTextSpecKey>::_imp)
+ PrivateImplementationPattern<EPlainTextSpecKey>(new Implementation<EPlainTextSpecKey>(e, id, v, r, h, t))
{
}
@@ -464,6 +586,24 @@ EPlainTextSpecKey::pretty_print_flat(const PlainTextSpecTree::ItemFormatter & f)
return stringify(p);
}
+const std::string
+EPlainTextSpecKey::raw_name() const
+{
+ return _imp->raw_name;
+}
+
+const std::string
+EPlainTextSpecKey::human_name() const
+{
+ return _imp->human_name;
+}
+
+MetadataKeyType
+EPlainTextSpecKey::type() const
+{
+ return _imp->type;
+}
+
namespace paludis
{
template <>
@@ -475,10 +615,18 @@ namespace paludis
mutable Mutex value_mutex;
mutable std::tr1::shared_ptr<const PlainTextSpecTree> value;
- Implementation(const Environment * const e, const std::tr1::shared_ptr<const ERepositoryID> & i, const std::string & v) :
+ const std::string raw_name;
+ const std::string human_name;
+ const MetadataKeyType type;
+
+ Implementation(const Environment * const e, const std::tr1::shared_ptr<const ERepositoryID> & i, const std::string & v,
+ const std::string & r, const std::string & h, const MetadataKeyType t) :
env(e),
id(i),
- string_value(v)
+ string_value(v),
+ raw_name(r),
+ human_name(h),
+ type(t)
{
}
};
@@ -487,9 +635,7 @@ namespace paludis
EMyOptionsKey::EMyOptionsKey(const Environment * const e,
const std::tr1::shared_ptr<const ERepositoryID> & id,
const std::string & r, const std::string & h, const std::string & v, const MetadataKeyType t) :
- MetadataSpecTreeKey<PlainTextSpecTree>(r, h, t),
- PrivateImplementationPattern<EMyOptionsKey>(new Implementation<EMyOptionsKey>(e, id, v)),
- _imp(PrivateImplementationPattern<EMyOptionsKey>::_imp)
+ PrivateImplementationPattern<EMyOptionsKey>(new Implementation<EMyOptionsKey>(e, id, v, r, h, t))
{
}
@@ -528,6 +674,24 @@ EMyOptionsKey::pretty_print_flat(const PlainTextSpecTree::ItemFormatter & f) con
return stringify(p);
}
+const std::string
+EMyOptionsKey::raw_name() const
+{
+ return _imp->raw_name;
+}
+
+const std::string
+EMyOptionsKey::human_name() const
+{
+ return _imp->human_name;
+}
+
+MetadataKeyType
+EMyOptionsKey::type() const
+{
+ return _imp->type;
+}
+
namespace paludis
{
template <>
@@ -539,10 +703,18 @@ namespace paludis
mutable Mutex value_mutex;
mutable std::tr1::shared_ptr<const ProvideSpecTree> value;
- Implementation(const Environment * const e, const std::tr1::shared_ptr<const ERepositoryID> & i, const std::string & v) :
+ const std::string raw_name;
+ const std::string human_name;
+ const MetadataKeyType type;
+
+ Implementation(const Environment * const e, const std::tr1::shared_ptr<const ERepositoryID> & i, const std::string & v,
+ const std::string & r, const std::string & h, const MetadataKeyType t) :
env(e),
id(i),
- string_value(v)
+ string_value(v),
+ raw_name(r),
+ human_name(h),
+ type(t)
{
}
};
@@ -550,9 +722,7 @@ namespace paludis
EProvideKey::EProvideKey(const Environment * const e, const std::tr1::shared_ptr<const ERepositoryID> & id,
const std::string & r, const std::string & h, const std::string & v, const MetadataKeyType t) :
- MetadataSpecTreeKey<ProvideSpecTree>(r, h, t),
- PrivateImplementationPattern<EProvideKey>(new Implementation<EProvideKey>(e, id, v)),
- _imp(PrivateImplementationPattern<EProvideKey>::_imp)
+ PrivateImplementationPattern<EProvideKey>(new Implementation<EProvideKey>(e, id, v, r, h, t))
{
}
@@ -591,6 +761,24 @@ EProvideKey::pretty_print_flat(const ProvideSpecTree::ItemFormatter & f) const
return stringify(p);
}
+const std::string
+EProvideKey::raw_name() const
+{
+ return _imp->raw_name;
+}
+
+const std::string
+EProvideKey::human_name() const
+{
+ return _imp->human_name;
+}
+
+MetadataKeyType
+EProvideKey::type() const
+{
+ return _imp->type;
+}
+
namespace paludis
{
template <>
@@ -603,10 +791,18 @@ namespace paludis
mutable std::tr1::shared_ptr<KeywordNameSet> value;
mutable std::tr1::function<void () throw ()> value_used;
- Implementation(const std::tr1::shared_ptr<const ERepositoryID> & i, const Environment * const e, const std::string & v) :
+ const std::string raw_name;
+ const std::string human_name;
+ const MetadataKeyType type;
+
+ Implementation(const std::tr1::shared_ptr<const ERepositoryID> & i, const Environment * const e, const std::string & v,
+ const std::string & r, const std::string & h, const MetadataKeyType t) :
id(i),
env(e),
- string_value(v)
+ string_value(v),
+ raw_name(r),
+ human_name(h),
+ type(t)
{
}
};
@@ -614,9 +810,7 @@ namespace paludis
EKeywordsKey::EKeywordsKey(const Environment * const e, const std::tr1::shared_ptr<const ERepositoryID> & id,
const std::string & r, const std::string & h, const std::string & v, const MetadataKeyType t) :
- MetadataCollectionKey<KeywordNameSet>(r, h, t),
- PrivateImplementationPattern<EKeywordsKey>(new Implementation<EKeywordsKey>(id, e, v)),
- _imp(PrivateImplementationPattern<EKeywordsKey>::_imp)
+ PrivateImplementationPattern<EKeywordsKey>(new Implementation<EKeywordsKey>(id, e, v, r, h, t))
{
}
@@ -665,6 +859,24 @@ EKeywordsKey::pretty_print_flat(const Formatter<KeywordName> & f) const
return result;
}
+const std::string
+EKeywordsKey::raw_name() const
+{
+ return _imp->raw_name;
+}
+
+const std::string
+EKeywordsKey::human_name() const
+{
+ return _imp->human_name;
+}
+
+MetadataKeyType
+EKeywordsKey::type() const
+{
+ return _imp->type;
+}
+
namespace paludis
{
template <>
@@ -675,9 +887,17 @@ namespace paludis
mutable Mutex value_mutex;
mutable std::tr1::shared_ptr<Set<std::string> > value;
- Implementation(const std::tr1::shared_ptr<const ERepositoryID> & i, const std::string & v) :
+ const std::string raw_name;
+ const std::string human_name;
+ const MetadataKeyType type;
+
+ Implementation(const std::tr1::shared_ptr<const ERepositoryID> & i, const std::string & v,
+ const std::string & r, const std::string & h, const MetadataKeyType t) :
id(i),
- string_value(v)
+ string_value(v),
+ raw_name(r),
+ human_name(h),
+ type(t)
{
}
};
@@ -685,9 +905,7 @@ namespace paludis
EStringSetKey::EStringSetKey(const std::tr1::shared_ptr<const ERepositoryID> & id,
const std::string & r, const std::string & h, const std::string & v, const MetadataKeyType t) :
- MetadataCollectionKey<Set<std::string> >(r, h, t),
- PrivateImplementationPattern<EStringSetKey>(new Implementation<EStringSetKey>(id, v)),
- _imp(PrivateImplementationPattern<EStringSetKey>::_imp)
+ PrivateImplementationPattern<EStringSetKey>(new Implementation<EStringSetKey>(id, v, r, h, t))
{
}
@@ -709,6 +927,24 @@ EStringSetKey::value() const
return _imp->value;
}
+const std::string
+EStringSetKey::raw_name() const
+{
+ return _imp->raw_name;
+}
+
+const std::string
+EStringSetKey::human_name() const
+{
+ return _imp->human_name;
+}
+
+MetadataKeyType
+EStringSetKey::type() const
+{
+ return _imp->type;
+}
+
namespace
{
std::string format_string(const std::string & i, const Formatter<std::string> & f)
@@ -734,9 +970,17 @@ namespace paludis
mutable Mutex value_mutex;
mutable std::tr1::shared_ptr<Contents> value;
- Implementation(const std::tr1::shared_ptr<const ERepositoryID> & i, const FSEntry & v) :
+ const std::string raw_name;
+ const std::string human_name;
+ const MetadataKeyType type;
+
+ Implementation(const std::tr1::shared_ptr<const ERepositoryID> & i, const FSEntry & v,
+ const std::string & r, const std::string & h, const MetadataKeyType & t) :
id(i),
- filename(v)
+ filename(v),
+ raw_name(r),
+ human_name(h),
+ type(t)
{
}
};
@@ -744,9 +988,7 @@ namespace paludis
EContentsKey::EContentsKey(const std::tr1::shared_ptr<const ERepositoryID> & id,
const std::string & r, const std::string & h, const FSEntry & v, const MetadataKeyType t) :
- MetadataValueKey<std::tr1::shared_ptr<const Contents> > (r, h, t),
- PrivateImplementationPattern<EContentsKey>(new Implementation<EContentsKey>(id, v)),
- _imp(PrivateImplementationPattern<EContentsKey>::_imp)
+ PrivateImplementationPattern<EContentsKey>(new Implementation<EContentsKey>(id, v, r, h, t))
{
}
@@ -809,6 +1051,24 @@ EContentsKey::value() const
return _imp->value;
}
+const std::string
+EContentsKey::raw_name() const
+{
+ return _imp->raw_name;
+}
+
+const std::string
+EContentsKey::human_name() const
+{
+ return _imp->human_name;
+}
+
+MetadataKeyType
+EContentsKey::type() const
+{
+ return _imp->type;
+}
+
namespace paludis
{
template <>
@@ -819,9 +1079,17 @@ namespace paludis
mutable Mutex value_mutex;
mutable std::tr1::shared_ptr<time_t> value;
- Implementation(const std::tr1::shared_ptr<const ERepositoryID> & i, const FSEntry & v) :
+ const std::string raw_name;
+ const std::string human_name;
+ const MetadataKeyType type;
+
+ Implementation(const std::tr1::shared_ptr<const ERepositoryID> & i, const FSEntry & v,
+ const std::string & r, const std::string & h, const MetadataKeyType t) :
id(i),
- filename(v)
+ filename(v),
+ raw_name(r),
+ human_name(h),
+ type(t)
{
}
};
@@ -829,9 +1097,7 @@ namespace paludis
EMTimeKey::EMTimeKey(const std::tr1::shared_ptr<const ERepositoryID> & id,
const std::string & r, const std::string & h, const FSEntry & v, const MetadataKeyType t) :
- MetadataTimeKey(r, h, t),
- PrivateImplementationPattern<EMTimeKey>(new Implementation<EMTimeKey>(id, v)),
- _imp(PrivateImplementationPattern<EMTimeKey>::_imp)
+ PrivateImplementationPattern<EMTimeKey>(new Implementation<EMTimeKey>(id, v, r, h, t))
{
}
@@ -863,3 +1129,21 @@ EMTimeKey::value() const
return *_imp->value;
}
+const std::string
+EMTimeKey::raw_name() const
+{
+ return _imp->raw_name;
+}
+
+const std::string
+EMTimeKey::human_name() const
+{
+ return _imp->human_name;
+}
+
+MetadataKeyType
+EMTimeKey::type() const
+{
+ return _imp->type;
+}
+
diff --git a/paludis/repositories/e/e_key.hh b/paludis/repositories/e/e_key.hh
index cd7c629..65e830b 100644
--- a/paludis/repositories/e/e_key.hh
+++ b/paludis/repositories/e/e_key.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -24,6 +24,7 @@
#include <paludis/util/fs_entry.hh>
#include <paludis/util/set.hh>
#include <paludis/util/map-fwd.hh>
+#include <paludis/repositories/e/eapi-fwd.hh>
namespace paludis
{
@@ -38,6 +39,9 @@ namespace paludis
{
private:
std::tr1::shared_ptr<const RepositoryMaskInfo> _value;
+ const std::string _r;
+ const std::string _h;
+ const MetadataKeyType _t;
public:
EMutableRepositoryMaskInfoKey(const std::tr1::shared_ptr<const ERepositoryID> &,
@@ -48,15 +52,16 @@ namespace paludis
PALUDIS_ATTRIBUTE((warn_unused_result));
void set_value(const std::tr1::shared_ptr<const RepositoryMaskInfo> &);
+
+ virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
};
class EDependenciesKey :
public MetadataSpecTreeKey<DependencySpecTree>,
private PrivateImplementationPattern<EDependenciesKey>
{
- private:
- PrivateImplementationPattern<EDependenciesKey>::ImpPtr & _imp;
-
public:
EDependenciesKey(
const Environment * const,
@@ -77,19 +82,22 @@ namespace paludis
virtual const std::tr1::shared_ptr<const DependencyLabelSequence> initial_labels() const
PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
};
class EFetchableURIKey :
public MetadataSpecTreeKey<FetchableURISpecTree>,
private PrivateImplementationPattern<EFetchableURIKey>
{
- private:
- PrivateImplementationPattern<EFetchableURIKey>::ImpPtr & _imp;
-
public:
EFetchableURIKey(const Environment * const,
const std::tr1::shared_ptr<const ERepositoryID> &,
- const std::string &, const std::string &, const std::string &, const MetadataKeyType);
+ const std::tr1::shared_ptr<const EAPIMetadataVariable> &,
+ const std::string &,
+ const MetadataKeyType);
~EFetchableURIKey();
virtual const std::tr1::shared_ptr<const FetchableURISpecTree> value() const
@@ -103,15 +111,16 @@ namespace paludis
virtual const std::tr1::shared_ptr<const URILabel> initial_label() const
PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
};
class ESimpleURIKey :
public MetadataSpecTreeKey<SimpleURISpecTree>,
private PrivateImplementationPattern<ESimpleURIKey>
{
- private:
- PrivateImplementationPattern<ESimpleURIKey>::ImpPtr & _imp;
-
public:
ESimpleURIKey(const Environment * const,
const std::tr1::shared_ptr<const ERepositoryID> &,
@@ -126,15 +135,16 @@ namespace paludis
virtual std::string pretty_print_flat(const SimpleURISpecTree::ItemFormatter &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
};
class EPlainTextSpecKey :
public MetadataSpecTreeKey<PlainTextSpecTree>,
private PrivateImplementationPattern<EPlainTextSpecKey>
{
- private:
- PrivateImplementationPattern<EPlainTextSpecKey>::ImpPtr & _imp;
-
public:
EPlainTextSpecKey(const Environment * const,
const std::tr1::shared_ptr<const ERepositoryID> &,
@@ -149,15 +159,16 @@ namespace paludis
virtual std::string pretty_print_flat(const PlainTextSpecTree::ItemFormatter &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
};
class EMyOptionsKey :
public MetadataSpecTreeKey<PlainTextSpecTree>,
private PrivateImplementationPattern<EMyOptionsKey>
{
- private:
- PrivateImplementationPattern<EMyOptionsKey>::ImpPtr & _imp;
-
public:
EMyOptionsKey(const Environment * const,
const std::tr1::shared_ptr<const ERepositoryID> &,
@@ -172,15 +183,16 @@ namespace paludis
virtual std::string pretty_print_flat(const PlainTextSpecTree::ItemFormatter &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
};
class EProvideKey :
public MetadataSpecTreeKey<ProvideSpecTree>,
private PrivateImplementationPattern<EProvideKey>
{
- private:
- PrivateImplementationPattern<EProvideKey>::ImpPtr & _imp;
-
public:
EProvideKey(const Environment * const,
const std::tr1::shared_ptr<const ERepositoryID> &,
@@ -195,15 +207,16 @@ namespace paludis
virtual std::string pretty_print_flat(const ProvideSpecTree::ItemFormatter &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
};
class ELicenseKey :
public MetadataSpecTreeKey<LicenseSpecTree>,
private PrivateImplementationPattern<ELicenseKey>
{
- private:
- PrivateImplementationPattern<ELicenseKey>::ImpPtr & _imp;
-
public:
ELicenseKey(
const Environment * const,
@@ -219,15 +232,16 @@ namespace paludis
virtual std::string pretty_print_flat(const LicenseSpecTree::ItemFormatter &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
};
class EKeywordsKey :
public MetadataCollectionKey<KeywordNameSet>,
private PrivateImplementationPattern<EKeywordsKey>
{
- private:
- PrivateImplementationPattern<EKeywordsKey>::ImpPtr & _imp;
-
public:
EKeywordsKey(
const Environment * const,
@@ -240,15 +254,16 @@ namespace paludis
virtual std::string pretty_print_flat(const Formatter<KeywordName> &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
};
class EStringSetKey :
public MetadataCollectionKey<Set<std::string> >,
private PrivateImplementationPattern<EStringSetKey>
{
- private:
- PrivateImplementationPattern<EStringSetKey>::ImpPtr & _imp;
-
public:
EStringSetKey(const std::tr1::shared_ptr<const ERepositoryID> &,
const std::string &, const std::string &, const std::string &, const MetadataKeyType);
@@ -259,15 +274,16 @@ namespace paludis
virtual std::string pretty_print_flat(const Formatter<std::string> &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
};
class EContentsKey :
public MetadataValueKey<std::tr1::shared_ptr<const Contents> >,
private PrivateImplementationPattern<EContentsKey>
{
- private:
- PrivateImplementationPattern<EContentsKey>::ImpPtr & _imp;
-
public:
EContentsKey(
const std::tr1::shared_ptr<const ERepositoryID> &,
@@ -276,15 +292,16 @@ namespace paludis
const std::tr1::shared_ptr<const Contents> value() const
PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
};
class EMTimeKey :
public MetadataTimeKey,
private PrivateImplementationPattern<EMTimeKey>
{
- private:
- PrivateImplementationPattern<EMTimeKey>::ImpPtr & _imp;
-
public:
EMTimeKey(const std::tr1::shared_ptr<const ERepositoryID> &,
const std::string &, const std::string &, const FSEntry &, const MetadataKeyType);
@@ -292,6 +309,10 @@ namespace paludis
time_t value() const
PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
};
}
}
diff --git a/paludis/repositories/e/eapi-fwd.hh b/paludis/repositories/e/eapi-fwd.hh
index 27611bc..8dcfe9b 100644
--- a/paludis/repositories/e/eapi-fwd.hh
+++ b/paludis/repositories/e/eapi-fwd.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -43,6 +43,8 @@ namespace paludis
class EAPIEbuildEnvironmentVariables;
class SupportedEAPI;
class EAPI;
+
+ class EAPIMetadataVariable;
}
}
diff --git a/paludis/repositories/e/ebuild.cc b/paludis/repositories/e/ebuild.cc
index e234098..bc854a4 100644
--- a/paludis/repositories/e/ebuild.cc
+++ b/paludis/repositories/e/ebuild.cc
@@ -490,7 +490,7 @@ EbuildMetadataCommand::load(const std::tr1::shared_ptr<const EbuildID> & id)
}
if (! m.src_uri()->name().empty())
- id->load_src_uri(m.src_uri()->name(), m.src_uri()->description(), get(keys, m.src_uri()->name()));
+ id->load_src_uri(m.src_uri(), get(keys, m.src_uri()->name()));
if (! m.homepage()->name().empty())
id->load_homepage(m.homepage()->name(), m.homepage()->description(), get(keys, m.homepage()->name()));
diff --git a/paludis/repositories/e/ebuild_flat_metadata_cache.cc b/paludis/repositories/e/ebuild_flat_metadata_cache.cc
index f7fbdf1..493dcf2 100644
--- a/paludis/repositories/e/ebuild_flat_metadata_cache.cc
+++ b/paludis/repositories/e/ebuild_flat_metadata_cache.cc
@@ -178,7 +178,7 @@ namespace
id->set_slot(SlotName(lines.at(m.slot()->flat_list_index())));
if (-1 != m.src_uri()->flat_list_index() && ! m.src_uri()->name().empty())
- id->load_src_uri(m.src_uri()->name(), m.src_uri()->description(), lines.at(m.src_uri()->flat_list_index()));
+ id->load_src_uri(m.src_uri(), lines.at(m.src_uri()->flat_list_index()));
if (-1 != m.restrictions()->flat_list_index() && ! m.restrictions()->name().empty())
id->load_restrict(m.restrictions()->name(), m.restrictions()->description(), lines.at(m.restrictions()->flat_list_index()));
@@ -492,7 +492,7 @@ EbuildFlatMetadataCache::load(const std::tr1::shared_ptr<const EbuildID> & id)
id->set_slot(SlotName(keys[m.slot()->name()]));
if (! m.src_uri()->name().empty())
- id->load_src_uri(m.src_uri()->name(), m.src_uri()->description(), keys[m.src_uri()->name()]);
+ id->load_src_uri(m.src_uri(), keys[m.src_uri()->name()]);
if (! m.restrictions()->name().empty())
id->load_restrict(m.restrictions()->name(), m.restrictions()->description(), keys[m.restrictions()->name()]);
diff --git a/paludis/repositories/e/ebuild_id.cc b/paludis/repositories/e/ebuild_id.cc
index 4dc62e7..0976475 100644
--- a/paludis/repositories/e/ebuild_id.cc
+++ b/paludis/repositories/e/ebuild_id.cc
@@ -842,10 +842,10 @@ EbuildID::load_post_depend(const std::string & r, const std::string & h, const s
}
void
-EbuildID::load_src_uri(const std::string & r, const std::string & h, const std::string & v) const
+EbuildID::load_src_uri(const std::tr1::shared_ptr<const EAPIMetadataVariable> & m, const std::string & v) const
{
Lock l(_imp->mutex);
- _imp->src_uri.reset(new EFetchableURIKey(_imp->environment, shared_from_this(), r, h, v, mkt_dependencies));
+ _imp->src_uri.reset(new EFetchableURIKey(_imp->environment, shared_from_this(), m, v, mkt_dependencies));
add_metadata_key(_imp->src_uri);
}
diff --git a/paludis/repositories/e/ebuild_id.hh b/paludis/repositories/e/ebuild_id.hh
index 5b5b73a..b6461f6 100644
--- a/paludis/repositories/e/ebuild_id.hh
+++ b/paludis/repositories/e/ebuild_id.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -118,7 +118,7 @@ namespace paludis
void load_build_depend(const std::string &, const std::string &, const std::string &) const;
void load_run_depend(const std::string &, const std::string &, const std::string &) const;
void load_post_depend(const std::string &, const std::string &, const std::string &) const;
- void load_src_uri(const std::string &, const std::string &, const std::string &) const;
+ void load_src_uri(const std::tr1::shared_ptr<const EAPIMetadataVariable> &, const std::string &) const;
void load_homepage(const std::string &, const std::string &, const std::string &) const;
void load_license(const std::string &, const std::string &, const std::string &) const;
void load_provide(const std::string &, const std::string &, const std::string &) const;
diff --git a/paludis/repositories/e/exndbam_id.cc b/paludis/repositories/e/exndbam_id.cc
index 270a4a0..073781f 100644
--- a/paludis/repositories/e/exndbam_id.cc
+++ b/paludis/repositories/e/exndbam_id.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2008 Ciaran McCreesh
+ * Copyright (c) 2008, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -58,7 +58,6 @@ namespace
public:
ExndbamContentsKey(const PackageID * const i, const NDBAM * const d) :
- MetadataValueKey<std::tr1::shared_ptr<const Contents> > ("contents", "Contents", mkt_internal),
_id(i),
_db(d)
{
@@ -79,6 +78,21 @@ namespace
);
return _v;
}
+
+ virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result))
+ {
+ return "contents";
+ }
+
+ virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result))
+ {
+ return "Contents";
+ }
+
+ virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result))
+ {
+ return mkt_internal;
+ }
};
}
diff --git a/paludis/repositories/e/info_metadata_key.cc b/paludis/repositories/e/info_metadata_key.cc
index 8bd84eb..32ae6b8 100644
--- a/paludis/repositories/e/info_metadata_key.cc
+++ b/paludis/repositories/e/info_metadata_key.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2008 Ciaran McCreesh
+ * Copyright (c) 2008, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -85,9 +85,7 @@ namespace paludis
}
InfoVarsMetadataKey::InfoVarsMetadataKey(const std::tr1::shared_ptr<const FSEntrySequence> & f) :
- MetadataCollectionKey<Set<std::string> >("info_vars", "Variable information names", mkt_internal),
- PrivateImplementationPattern<InfoVarsMetadataKey>(new Implementation<InfoVarsMetadataKey>(f)),
- _imp(PrivateImplementationPattern<InfoVarsMetadataKey>::_imp)
+ PrivateImplementationPattern<InfoVarsMetadataKey>(new Implementation<InfoVarsMetadataKey>(f))
{
}
@@ -121,10 +119,27 @@ InfoVarsMetadataKey::value() const
return _imp->value;
}
+const std::string
+InfoVarsMetadataKey::raw_name() const
+{
+ return "info_vars";
+}
+
+const std::string
+InfoVarsMetadataKey::human_name() const
+{
+ return "Variable information names";
+}
+
+MetadataKeyType
+InfoVarsMetadataKey::type() const
+{
+ return mkt_internal;
+}
+
InfoPkgsMetadataKey::InfoPkgsMetadataKey(const Environment * const e,
const std::tr1::shared_ptr<const FSEntrySequence> & f,
const ERepository * const r) :
- MetadataSectionKey("info_pkgs", "Package information", mkt_normal),
PrivateImplementationPattern<InfoPkgsMetadataKey>(new Implementation<InfoPkgsMetadataKey>(e, f, r)),
_imp(PrivateImplementationPattern<InfoPkgsMetadataKey>::_imp)
{
@@ -205,6 +220,25 @@ InfoVarsMetadataKey::pretty_print_flat(const Formatter<std::string> & f) const
return join(value()->begin(), value()->end(), " ", std::tr1::bind(&format_string, _1, f));
}
+const std::string
+InfoPkgsMetadataKey::raw_name() const
+{
+ return "info_pkgs";
+}
+
+const std::string
+InfoPkgsMetadataKey::human_name() const
+{
+ return "Package information";
+}
+
+MetadataKeyType
+InfoPkgsMetadataKey::type() const
+{
+ return mkt_internal;
+}
+
+
template class PrivateImplementationPattern<InfoPkgsMetadataKey>;
template class PrivateImplementationPattern<InfoVarsMetadataKey>;
diff --git a/paludis/repositories/e/info_metadata_key.hh b/paludis/repositories/e/info_metadata_key.hh
index 3010c43..be1495d 100644
--- a/paludis/repositories/e/info_metadata_key.hh
+++ b/paludis/repositories/e/info_metadata_key.hh
@@ -30,22 +30,27 @@ namespace paludis
const std::tr1::shared_ptr<const FSEntrySequence> & f,
const ERepository * const);
~InfoPkgsMetadataKey();
+
+ virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
};
class InfoVarsMetadataKey :
public MetadataCollectionKey<Set<std::string> >,
private PrivateImplementationPattern<InfoVarsMetadataKey>
{
- private:
- PrivateImplementationPattern<InfoVarsMetadataKey>::ImpPtr & _imp;
-
public:
InfoVarsMetadataKey(const std::tr1::shared_ptr<const FSEntrySequence> &);
~InfoVarsMetadataKey();
const std::tr1::shared_ptr<const Set<std::string> > value() const;
- std::string pretty_print_flat(const Formatter<std::string> &) const;
+ std::string pretty_print_flat(const Formatter<std::string> &) const;
+
+ virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
};
}
diff --git a/paludis/repositories/fake/fake_package_id.cc b/paludis/repositories/fake/fake_package_id.cc
index 4959172..f4eddcb 100644
--- a/paludis/repositories/fake/fake_package_id.cc
+++ b/paludis/repositories/fake/fake_package_id.cc
@@ -58,9 +58,17 @@ namespace paludis
const PackageID * const id;
const Environment * const env;
- Implementation(const PackageID * const i, const Environment * const e) :
+ const std::string raw_name;
+ const std::string human_name;
+ const MetadataKeyType type;
+
+ Implementation(const PackageID * const i, const Environment * const e,
+ const std::string & r, const std::string & h, const MetadataKeyType t) :
id(i),
- env(e)
+ env(e),
+ raw_name(r),
+ human_name(h),
+ type(t)
{
}
};
@@ -70,8 +78,7 @@ template <typename C_>
FakeMetadataCollectionKey<C_>::FakeMetadataCollectionKey(
const std::string & r, const std::string & h, const MetadataKeyType t, const PackageID * const i,
const Environment * const e) :
- MetadataCollectionKey<C_>(r, h, t),
- PrivateImplementationPattern<FakeMetadataCollectionKey<C_> >(new Implementation<FakeMetadataCollectionKey<C_> >(i, e)),
+ PrivateImplementationPattern<FakeMetadataCollectionKey<C_> >(new Implementation<FakeMetadataCollectionKey<C_> >(i, e, r, h, t)),
_imp(PrivateImplementationPattern<FakeMetadataCollectionKey<C_> >::_imp)
{
}
@@ -85,7 +92,28 @@ template <typename C_>
const std::tr1::shared_ptr<const C_>
FakeMetadataCollectionKey<C_>::value() const
{
- return _imp->collection;
+ return this->_imp->collection;
+}
+
+template <typename C_>
+const std::string
+FakeMetadataCollectionKey<C_>::raw_name() const
+{
+ return this->_imp->raw_name;
+}
+
+template <typename C_>
+const std::string
+FakeMetadataCollectionKey<C_>::human_name() const
+{
+ return this->_imp->human_name;
+}
+
+template <typename C_>
+MetadataKeyType
+FakeMetadataCollectionKey<C_>::type() const
+{
+ return this->_imp->type;
}
FakeMetadataKeywordSetKey::FakeMetadataKeywordSetKey(const std::string & r,
@@ -115,8 +143,16 @@ namespace paludis
std::string string_value;
const std::tr1::function<const std::tr1::shared_ptr<const C_> (const std::string &)> func;
- Implementation(const std::tr1::function<const std::tr1::shared_ptr<const C_> (const std::string &)> & f) :
- func(f)
+ const std::string raw_name;
+ const std::string human_name;
+ const MetadataKeyType type;
+
+ Implementation(const std::tr1::function<const std::tr1::shared_ptr<const C_> (const std::string &)> & f,
+ const std::string & r, const std::string & h, const MetadataKeyType t) :
+ func(f),
+ raw_name(r),
+ human_name(h),
+ type(t)
{
}
};
@@ -129,9 +165,17 @@ namespace paludis
const std::tr1::function<const std::tr1::shared_ptr<const FetchableURISpecTree> (const std::string &)> func;
std::tr1::shared_ptr<const URILabel> initial_label;
- Implementation(const std::tr1::function<const std::tr1::shared_ptr<const FetchableURISpecTree> (const std::string &)> & f) :
+ const std::string raw_name;
+ const std::string human_name;
+ const MetadataKeyType type;
+
+ Implementation(const std::tr1::function<const std::tr1::shared_ptr<const FetchableURISpecTree> (const std::string &)> & f,
+ const std::string & r, const std::string & h, const MetadataKeyType t) :
func(f),
- initial_label(new URIListedThenMirrorsLabel("listed-then-mirrors"))
+ initial_label(new URIListedThenMirrorsLabel("listed-then-mirrors")),
+ raw_name(r),
+ human_name(h),
+ type(t)
{
}
};
@@ -144,10 +188,18 @@ namespace paludis
const std::tr1::function<const std::tr1::shared_ptr<const DependencySpecTree> (const std::string &)> func;
std::tr1::shared_ptr<const DependencyLabelSequence> labels;
+ const std::string raw_name;
+ const std::string human_name;
+ const MetadataKeyType type;
+
Implementation(const std::tr1::function<const std::tr1::shared_ptr<const DependencySpecTree> (const std::string &)> & f,
- const std::tr1::shared_ptr<const DependencyLabelSequence> & s) :
+ const std::tr1::shared_ptr<const DependencyLabelSequence> & s,
+ const std::string & r, const std::string & h, const MetadataKeyType t) :
func(f),
- labels(s)
+ labels(s),
+ raw_name(r),
+ human_name(h),
+ type(t)
{
}
};
@@ -156,8 +208,7 @@ namespace paludis
template <typename C_>
FakeMetadataSpecTreeKey<C_>::FakeMetadataSpecTreeKey(const std::string & r, const std::string & h, const std::string & v,
const std::tr1::function<const std::tr1::shared_ptr<const C_> (const std::string &)> & f, const MetadataKeyType t) :
- MetadataSpecTreeKey<C_>(r, h, t),
- PrivateImplementationPattern<FakeMetadataSpecTreeKey<C_> >(new Implementation<FakeMetadataSpecTreeKey<C_> >(f)),
+ PrivateImplementationPattern<FakeMetadataSpecTreeKey<C_> >(new Implementation<FakeMetadataSpecTreeKey<C_> >(f, r, h, t)),
_imp(PrivateImplementationPattern<FakeMetadataSpecTreeKey<C_> >::_imp)
{
set_from_string(v);
@@ -184,6 +235,27 @@ FakeMetadataSpecTreeKey<C_>::value() const
}
template <typename C_>
+const std::string
+FakeMetadataSpecTreeKey<C_>::raw_name() const
+{
+ return this->_imp->raw_name;
+}
+
+template <typename C_>
+const std::string
+FakeMetadataSpecTreeKey<C_>::human_name() const
+{
+ return this->_imp->human_name;
+}
+
+template <typename C_>
+MetadataKeyType
+FakeMetadataSpecTreeKey<C_>::type() const
+{
+ return this->_imp->type;
+}
+
+template <typename C_>
std::string
FakeMetadataSpecTreeKey<C_>::pretty_print(const typename C_::ItemFormatter &) const
{
@@ -199,9 +271,8 @@ FakeMetadataSpecTreeKey<C_>::pretty_print_flat(const typename C_::ItemFormatter
FakeMetadataSpecTreeKey<FetchableURISpecTree>::FakeMetadataSpecTreeKey(const std::string & r, const std::string & h, const std::string & v,
const std::tr1::function<const std::tr1::shared_ptr<const FetchableURISpecTree> (const std::string &)> & f, const MetadataKeyType t) :
- MetadataSpecTreeKey<FetchableURISpecTree>(r, h, t),
PrivateImplementationPattern<FakeMetadataSpecTreeKey<FetchableURISpecTree> >(
- new Implementation<FakeMetadataSpecTreeKey<FetchableURISpecTree> >(f)),
+ new Implementation<FakeMetadataSpecTreeKey<FetchableURISpecTree> >(f, r, h, t)),
_imp(PrivateImplementationPattern<FakeMetadataSpecTreeKey<FetchableURISpecTree> >::_imp)
{
set_from_string(v);
@@ -218,6 +289,24 @@ FakeMetadataSpecTreeKey<FetchableURISpecTree>::set_from_string(const std::string
_imp->value = _imp->func(s);
}
+const std::string
+FakeMetadataSpecTreeKey<FetchableURISpecTree>::raw_name() const
+{
+ return _imp->raw_name;
+}
+
+const std::string
+FakeMetadataSpecTreeKey<FetchableURISpecTree>::human_name() const
+{
+ return _imp->human_name;
+}
+
+MetadataKeyType
+FakeMetadataSpecTreeKey<FetchableURISpecTree>::type() const
+{
+ return _imp->type;
+}
+
const std::tr1::shared_ptr<const FetchableURISpecTree>
FakeMetadataSpecTreeKey<FetchableURISpecTree>::value() const
{
@@ -245,9 +334,8 @@ FakeMetadataSpecTreeKey<FetchableURISpecTree>::initial_label() const
FakeMetadataSpecTreeKey<DependencySpecTree>::FakeMetadataSpecTreeKey(const std::string & r, const std::string & h, const std::string & v,
const std::tr1::function<const std::tr1::shared_ptr<const DependencySpecTree> (const std::string &)> & f,
const std::tr1::shared_ptr<const DependencyLabelSequence> & s, const MetadataKeyType t) :
- MetadataSpecTreeKey<DependencySpecTree>(r, h, t),
PrivateImplementationPattern<FakeMetadataSpecTreeKey<DependencySpecTree> >(
- new Implementation<FakeMetadataSpecTreeKey<DependencySpecTree> >(f, s)),
+ new Implementation<FakeMetadataSpecTreeKey<DependencySpecTree> >(f, s, r, h, t)),
_imp(PrivateImplementationPattern<FakeMetadataSpecTreeKey<DependencySpecTree> >::_imp)
{
set_from_string(v);
@@ -288,6 +376,24 @@ FakeMetadataSpecTreeKey<DependencySpecTree>::initial_labels() const
return _imp->labels;
}
+const std::string
+FakeMetadataSpecTreeKey<DependencySpecTree>::raw_name() const
+{
+ return _imp->raw_name;
+}
+
+const std::string
+FakeMetadataSpecTreeKey<DependencySpecTree>::human_name() const
+{
+ return _imp->human_name;
+}
+
+MetadataKeyType
+FakeMetadataSpecTreeKey<DependencySpecTree>::type() const
+{
+ return _imp->type;
+}
+
namespace paludis
{
template <>
@@ -368,7 +474,6 @@ namespace
FakeMetadataChoicesKey::FakeMetadataChoicesKey(const Environment * const e,
const std::tr1::shared_ptr<const PackageID> & i) :
- MetadataValueKey<std::tr1::shared_ptr<const Choices> >("Choices", "Choices", mkt_normal),
PrivateImplementationPattern<FakeMetadataChoicesKey>(new Implementation<FakeMetadataChoicesKey>(e, i)),
_imp(PrivateImplementationPattern<FakeMetadataChoicesKey>::_imp)
{
@@ -399,6 +504,24 @@ FakeMetadataChoicesKey::value() const
return _imp->value;
}
+const std::string
+FakeMetadataChoicesKey::raw_name() const
+{
+ return "PALUDIS_CHOICES";
+}
+
+const std::string
+FakeMetadataChoicesKey::human_name() const
+{
+ return "Choices";
+}
+
+MetadataKeyType
+FakeMetadataChoicesKey::type() const
+{
+ return mkt_internal;
+}
+
namespace paludis
{
template <>
diff --git a/paludis/repositories/fake/fake_package_id.hh b/paludis/repositories/fake/fake_package_id.hh
index c9aef68..7f43ee9 100644
--- a/paludis/repositories/fake/fake_package_id.hh
+++ b/paludis/repositories/fake/fake_package_id.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -45,6 +45,10 @@ namespace paludis
~FakeMetadataCollectionKey();
virtual const std::tr1::shared_ptr<const C_> value() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
};
class PALUDIS_VISIBLE FakeMetadataKeywordSetKey :
@@ -83,6 +87,10 @@ namespace paludis
virtual std::string pretty_print_flat(const typename C_::ItemFormatter &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
};
template <>
@@ -112,6 +120,10 @@ namespace paludis
virtual const std::tr1::shared_ptr<const URILabel> initial_label() const
PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
};
template <>
@@ -142,6 +154,10 @@ namespace paludis
virtual const std::tr1::shared_ptr<const DependencyLabelSequence> initial_labels() const
PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
};
class PALUDIS_VISIBLE FakeMetadataChoicesKey :
@@ -159,6 +175,10 @@ namespace paludis
void add(const std::string &, const std::string &);
const std::tr1::shared_ptr<const Choices> value() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
};
class PALUDIS_VISIBLE FakeUnacceptedMask :
diff --git a/paludis/repositories/unpackaged/installed_id.cc b/paludis/repositories/unpackaged/installed_id.cc
index f8f0215..33cafdc 100644
--- a/paludis/repositories/unpackaged/installed_id.cc
+++ b/paludis/repositories/unpackaged/installed_id.cc
@@ -62,7 +62,6 @@ namespace
public:
InstalledUnpackagedFSEntryKey(const FSEntry & l) :
- MetadataValueKey<FSEntry> ("location", "Location", mkt_internal),
_location(l)
{
}
@@ -71,6 +70,21 @@ namespace
{
return _location;
}
+
+ virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result))
+ {
+ return "location";
+ }
+
+ virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result))
+ {
+ return "Location";
+ }
+
+ virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result))
+ {
+ return mkt_internal;
+ }
};
void create_file(Contents & c, const FSEntry & f)
@@ -99,7 +113,6 @@ namespace
public:
InstalledUnpackagedContentsKey(const PackageID * const i, const NDBAM * const d) :
- MetadataValueKey<std::tr1::shared_ptr<const Contents> > ("contents", "Contents", mkt_internal),
_id(i),
_db(d)
{
@@ -120,6 +133,21 @@ namespace
);
return _v;
}
+
+ virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result))
+ {
+ return "contents";
+ }
+
+ virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result))
+ {
+ return "Contents";
+ }
+
+ virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result))
+ {
+ return mkt_internal;
+ }
};
class InstalledUnpackagedTimeKey :
@@ -130,7 +158,6 @@ namespace
public:
InstalledUnpackagedTimeKey(const FSEntry & f) :
- MetadataTimeKey("installed_time", "Installed time", mkt_normal),
_time(f.mtime())
{
}
@@ -139,6 +166,21 @@ namespace
{
return _time;
}
+
+ virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result))
+ {
+ return "installed_time";
+ }
+
+ virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result))
+ {
+ return "Installed time";
+ }
+
+ virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result))
+ {
+ return mkt_normal;
+ }
};
class InstalledUnpackagedStringKey :
@@ -149,10 +191,16 @@ namespace
mutable Mutex _mutex;
const FSEntry _f;
+ const std::string _raw_name;
+ const std::string _human_name;
+ const MetadataKeyType _type;
+
public:
InstalledUnpackagedStringKey(const std::string & r, const std::string & h, const FSEntry & f, const MetadataKeyType t) :
- MetadataValueKey<std::string> (r, h, t),
- _f(f)
+ _f(f),
+ _raw_name(r),
+ _human_name(h),
+ _type(t)
{
}
@@ -171,6 +219,21 @@ namespace
strip_trailing(std::string((std::istreambuf_iterator<char>(f)), std::istreambuf_iterator<char>()), "\n")));
return *_v;
}
+
+ virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result))
+ {
+ return _raw_name;
+ }
+
+ virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result))
+ {
+ return _human_name;
+ }
+
+ virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result))
+ {
+ return _type;
+ }
};
class InstalledUnpackagedStringSetKey :
@@ -181,9 +244,15 @@ namespace
mutable Mutex _mutex;
FSEntrySequence _f;
+ const std::string _raw_name;
+ const std::string _human_name;
+ const MetadataKeyType _type;
+
public:
InstalledUnpackagedStringSetKey(const std::string & r, const std::string & h, const MetadataKeyType t) :
- MetadataCollectionKey<Set<std::string> > (r, h, t)
+ _raw_name(r),
+ _human_name(h),
+ _type(t)
{
}
@@ -219,6 +288,21 @@ namespace
using namespace std::tr1::placeholders;
return join(value()->begin(), value()->end(), " ", std::tr1::bind(&format_string, _1, f));
}
+
+ virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result))
+ {
+ return _raw_name;
+ }
+
+ virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result))
+ {
+ return _human_name;
+ }
+
+ virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result))
+ {
+ return _type;
+ }
};
class InstalledUnpackagedDependencyKey :
@@ -231,14 +315,20 @@ namespace
const FSEntry _f;
const std::tr1::shared_ptr<const DependencyLabelSequence> _labels;
+ const std::string _raw_name;
+ const std::string _human_name;
+ const MetadataKeyType _type;
+
public:
InstalledUnpackagedDependencyKey(const Environment * const e,
const std::string & r, const std::string & h, const FSEntry & f,
const std::tr1::shared_ptr<const DependencyLabelSequence> & l, const MetadataKeyType t) :
- MetadataSpecTreeKey<DependencySpecTree>(r, h, t),
_env(e),
_f(f),
- _labels(l)
+ _labels(l),
+ _raw_name(r),
+ _human_name(h),
+ _type(t)
{
}
@@ -279,6 +369,21 @@ namespace
{
return _labels;
}
+
+ virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result))
+ {
+ return _raw_name;
+ }
+
+ virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result))
+ {
+ return _human_name;
+ }
+
+ virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result))
+ {
+ return _type;
+ }
};
}
diff --git a/paludis/repositories/unpackaged/unpackaged_key.cc b/paludis/repositories/unpackaged/unpackaged_key.cc
index 8d0f5b8..4086205 100644
--- a/paludis/repositories/unpackaged/unpackaged_key.cc
+++ b/paludis/repositories/unpackaged/unpackaged_key.cc
@@ -43,11 +43,19 @@ namespace paludis
const std::tr1::shared_ptr<const DependencySpecTree> value;
const std::tr1::shared_ptr<const DependencyLabelSequence> labels;
+ const std::string raw_name;
+ const std::string human_name;
+ const MetadataKeyType type;
+
Implementation(const Environment * const e, const std::string & v,
- const std::tr1::shared_ptr<const DependencyLabelSequence> & l) :
+ const std::tr1::shared_ptr<const DependencyLabelSequence> & l,
+ const std::string & r, const std::string & h, const MetadataKeyType t) :
env(e),
value(DepParser::parse(env, v)),
- labels(l)
+ labels(l),
+ raw_name(r),
+ human_name(h),
+ type(t)
{
}
};
@@ -57,9 +65,7 @@ UnpackagedDependencyKey::UnpackagedDependencyKey(const Environment * const env,
const std::string & r, const std::string & h, const MetadataKeyType t,
const std::tr1::shared_ptr<const DependencyLabelSequence> & l,
const std::string & v) :
- MetadataSpecTreeKey<DependencySpecTree>(r, h, t),
- PrivateImplementationPattern<UnpackagedDependencyKey>(new Implementation<UnpackagedDependencyKey>(env, v, l)),
- _imp(PrivateImplementationPattern<UnpackagedDependencyKey>::_imp)
+ PrivateImplementationPattern<UnpackagedDependencyKey>(new Implementation<UnpackagedDependencyKey>(env, v, l, r, h, t))
{
}
@@ -73,6 +79,24 @@ UnpackagedDependencyKey::value() const
return _imp->value;
}
+const std::string
+UnpackagedDependencyKey::raw_name() const
+{
+ return _imp->raw_name;
+}
+
+const std::string
+UnpackagedDependencyKey::human_name() const
+{
+ return _imp->human_name;
+}
+
+MetadataKeyType
+UnpackagedDependencyKey::type() const
+{
+ return _imp->type;
+}
+
std::string
UnpackagedDependencyKey::pretty_print(const DependencySpecTree::ItemFormatter & f) const
{
@@ -106,9 +130,17 @@ namespace paludis
mutable Mutex mutex;
mutable std::tr1::shared_ptr<Choices> value;
- Implementation(const Environment * const e, const UnpackagedID * const i) :
+ const std::string raw_name;
+ const std::string human_name;
+ const MetadataKeyType type;
+
+ Implementation(const Environment * const e, const UnpackagedID * const i,
+ const std::string & r, const std::string & h, const MetadataKeyType t) :
env(e),
- id(i)
+ id(i),
+ raw_name(r),
+ human_name(h),
+ type(t)
{
}
};
@@ -116,9 +148,7 @@ namespace paludis
UnpackagedChoicesKey::UnpackagedChoicesKey(const Environment * const env, const std::string & r, const std::string & h,
const MetadataKeyType t, const UnpackagedID * const id) :
- MetadataValueKey<std::tr1::shared_ptr<const Choices> >(r, h, t),
- PrivateImplementationPattern<UnpackagedChoicesKey>(new Implementation<UnpackagedChoicesKey>(env, id)),
- _imp(PrivateImplementationPattern<UnpackagedChoicesKey>::_imp)
+ PrivateImplementationPattern<UnpackagedChoicesKey>(new Implementation<UnpackagedChoicesKey>(env, id, r, h, t))
{
}
@@ -143,3 +173,21 @@ UnpackagedChoicesKey::value() const
return _imp->value;
}
+const std::string
+UnpackagedChoicesKey::raw_name() const
+{
+ return _imp->raw_name;
+}
+
+const std::string
+UnpackagedChoicesKey::human_name() const
+{
+ return _imp->human_name;
+}
+
+MetadataKeyType
+UnpackagedChoicesKey::type() const
+{
+ return _imp->type;
+}
+
diff --git a/paludis/repositories/unpackaged/unpackaged_key.hh b/paludis/repositories/unpackaged/unpackaged_key.hh
index 5896e05..16ea2fc 100644
--- a/paludis/repositories/unpackaged/unpackaged_key.hh
+++ b/paludis/repositories/unpackaged/unpackaged_key.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -33,9 +33,6 @@ namespace paludis
public MetadataSpecTreeKey<DependencySpecTree>,
private PrivateImplementationPattern<UnpackagedDependencyKey>
{
- private:
- PrivateImplementationPattern<UnpackagedDependencyKey>::ImpPtr & _imp;
-
public:
UnpackagedDependencyKey(const Environment * const env,
const std::string & r, const std::string & h, const MetadataKeyType t,
@@ -51,15 +48,16 @@ namespace paludis
virtual const std::tr1::shared_ptr<const DependencyLabelSequence> initial_labels() const
PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
};
class UnpackagedChoicesKey :
public MetadataValueKey<std::tr1::shared_ptr<const Choices> >,
private PrivateImplementationPattern<UnpackagedChoicesKey>
{
- private:
- PrivateImplementationPattern<UnpackagedChoicesKey>::ImpPtr & _imp;
-
public:
UnpackagedChoicesKey(const Environment * const env,
const std::string & r, const std::string & h, const MetadataKeyType t,
@@ -67,6 +65,10 @@ namespace paludis
~UnpackagedChoicesKey();
virtual const std::tr1::shared_ptr<const Choices> value() const;
+
+ virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
};
}
}
diff --git a/paludis/repositories/unwritten/unwritten_repository_file.cc b/paludis/repositories/unwritten/unwritten_repository_file.cc
index 5297a29..d3fe389 100644
--- a/paludis/repositories/unwritten/unwritten_repository_file.cc
+++ b/paludis/repositories/unwritten/unwritten_repository_file.cc
@@ -106,10 +106,16 @@ namespace
{
const std::tr1::shared_ptr<const SimpleURISpecTree> vv;
+ const std::string _raw_name;
+ const std::string _human_name;
+ const MetadataKeyType _type;
+
UnwrittenHomepageKey(const std::string & r, const std::string & h, const MetadataKeyType t,
const std::tr1::shared_ptr<const SimpleURISpecTree> & v) :
- MetadataSpecTreeKey<SimpleURISpecTree>(r, h, t),
- vv(v)
+ vv(v),
+ _raw_name(r),
+ _human_name(h),
+ _type(t)
{
}
@@ -131,6 +137,21 @@ namespace
value()->root()->accept(p);
return p.s.str();
}
+
+ virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result))
+ {
+ return _raw_name;
+ }
+
+ virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result))
+ {
+ return _human_name;
+ }
+
+ virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result))
+ {
+ return _type;
+ }
};
}
diff --git a/paludis/repositories/virtuals/package_id.cc b/paludis/repositories/virtuals/package_id.cc
index b650402..99654af 100644
--- a/paludis/repositories/virtuals/package_id.cc
+++ b/paludis/repositories/virtuals/package_id.cc
@@ -56,9 +56,12 @@ namespace paludis
const std::tr1::shared_ptr<const DependencyLabelSequence> labels;
const std::tr1::shared_ptr<const PackageDepSpec> spec;
+ const std::string raw_name;
+ const std::string human_name;
+
Implementation(const Environment * const e, const std::tr1::shared_ptr<const PackageID> & v,
const std::tr1::shared_ptr<const DependencyLabelSequence> & l,
- bool exact) :
+ bool exact, const std::string & h, const std::string & r) :
env(e),
value(new DependencySpecTree(make_shared_ptr(new AllDepSpec))),
labels(l),
@@ -76,7 +79,9 @@ namespace paludis
make_package_dep_spec()
.package(v->name())
))
- )
+ ),
+ raw_name(r),
+ human_name(h)
{
value->root()->append(spec);
}
@@ -87,8 +92,7 @@ VirtualsDepKey::VirtualsDepKey(const Environment * const e, const std::string &
const std::tr1::shared_ptr<const PackageID> & v,
const std::tr1::shared_ptr<const DependencyLabelSequence> & l,
const bool exact) :
- MetadataSpecTreeKey<DependencySpecTree>(r, h, mkt_dependencies),
- PrivateImplementationPattern<VirtualsDepKey>(new Implementation<VirtualsDepKey>(e, v, l, exact)),
+ PrivateImplementationPattern<VirtualsDepKey>(new Implementation<VirtualsDepKey>(e, v, l, exact, r, h)),
_imp(PrivateImplementationPattern<VirtualsDepKey>::_imp)
{
}
@@ -103,6 +107,24 @@ VirtualsDepKey::value() const
return _imp->value;
}
+const std::string
+VirtualsDepKey::raw_name() const
+{
+ return _imp->raw_name;
+}
+
+const std::string
+VirtualsDepKey::human_name() const
+{
+ return _imp->human_name;
+}
+
+MetadataKeyType
+VirtualsDepKey::type() const
+{
+ return mkt_dependencies;
+}
+
std::string
VirtualsDepKey::pretty_print(const DependencySpecTree::ItemFormatter & f) const
{
diff --git a/paludis/repositories/virtuals/package_id.hh b/paludis/repositories/virtuals/package_id.hh
index 91786a9..95c2ee7 100644
--- a/paludis/repositories/virtuals/package_id.hh
+++ b/paludis/repositories/virtuals/package_id.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -53,6 +53,10 @@ namespace paludis
virtual const std::tr1::shared_ptr<const DependencyLabelSequence> initial_labels() const
PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
};
class VirtualsPackageID :
diff --git a/paludis/unchoices_key.cc b/paludis/unchoices_key.cc
index fdf1b79..84b3abb 100644
--- a/paludis/unchoices_key.cc
+++ b/paludis/unchoices_key.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2008 Ciaran McCreesh
+ * Copyright (c) 2008, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -37,7 +37,6 @@ namespace
public:
UnChoicesKey() :
- MetadataValueKey<std::tr1::shared_ptr<const Choices> >("PALUDIS_CHOICES", "Choices", mkt_internal),
_value(new Choices)
{
_value->add(make_shared_ptr(new Choice("Choices", "Choices", ChoicePrefixName(""), true, true, true, false)));
@@ -51,6 +50,21 @@ namespace
{
return _value;
}
+
+ virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result))
+ {
+ return "Choices";
+ }
+
+ virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result))
+ {
+ return "PALUDIS_CHOICES";
+ }
+
+ virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result))
+ {
+ return mkt_internal;
+ }
};
}
diff --git a/python/mask_TEST.py b/python/mask_TEST.py
index 73cda43..426823d 100755
--- a/python/mask_TEST.py
+++ b/python/mask_TEST.py
@@ -124,7 +124,7 @@ class TestCase_02_Masks_subclassing(unittest.TestCase):
return "test"
def unaccepted_key(self):
- return MetadataStringKey("raw", "human", MetadataKeyType.NORMAL)
+ return MetadataStringKey()
test_unaccepted_mask(TestUnacceptedMask())
@@ -137,7 +137,7 @@ class TestCase_02_Masks_subclassing(unittest.TestCase):
return "test"
def mask_key(self):
- return MetadataStringKey("raw", "human", MetadataKeyType.NORMAL)
+ return MetadataStringKey()
test_repository_mask(TestRepositoryMask())
diff --git a/python/metadata_key.cc b/python/metadata_key.cc
index 0140f18..8cdee84 100644
--- a/python/metadata_key.cc
+++ b/python/metadata_key.cc
@@ -173,11 +173,6 @@ struct MetadataPackageIDKeyWrapper :
MetadataValueKey<std::tr1::shared_ptr<const PackageID> > ,
bp::wrapper<MetadataValueKey<std::tr1::shared_ptr<const PackageID> > >
{
- MetadataPackageIDKeyWrapper(const std::string & r, const std::string & h, const MetadataKeyType t) :
- MetadataValueKey<std::tr1::shared_ptr<const PackageID> > (r, h, t)
- {
- }
-
virtual const std::tr1::shared_ptr<const PackageID> value() const
PALUDIS_ATTRIBUTE((warn_unused_result))
{
@@ -198,17 +193,42 @@ struct MetadataPackageIDKeyWrapper :
else
throw PythonMethodNotImplemented("MetadataPackageIDKey", "pretty_print");
}
+
+ virtual const std::string raw_name() const
+ {
+ Lock l(get_mutex());
+
+ if (bp::override f = get_override("raw_name"))
+ return f();
+ else
+ throw PythonMethodNotImplemented("MetadataPackageIDKey", "raw_name");
+ }
+
+ virtual const std::string human_name() const
+ {
+ Lock l(get_mutex());
+
+ if (bp::override f = get_override("human_name"))
+ return f();
+ else
+ throw PythonMethodNotImplemented("MetadataPackageIDKey", "human_name");
+ }
+
+ virtual MetadataKeyType type() const
+ {
+ Lock l(get_mutex());
+
+ if (bp::override f = get_override("type"))
+ return f();
+ else
+ throw PythonMethodNotImplemented("MetadataPackageIDKey", "type");
+ }
};
struct MetadataStringKeyWrapper :
MetadataValueKey<std::string> ,
bp::wrapper<MetadataValueKey<std::string> >
{
- MetadataStringKeyWrapper(const std::string & r, const std::string & h, const MetadataKeyType t) :
- MetadataValueKey<std::string> (r, h, t)
- {
- }
-
virtual const std::string value() const
PALUDIS_ATTRIBUTE((warn_unused_result))
{
@@ -219,17 +239,42 @@ struct MetadataStringKeyWrapper :
else
throw PythonMethodNotImplemented("MetadataStringKey", "value");
}
+
+ virtual const std::string raw_name() const
+ {
+ Lock l(get_mutex());
+
+ if (bp::override f = get_override("raw_name"))
+ return f();
+ else
+ throw PythonMethodNotImplemented("MetadataStringKey", "raw_name");
+ }
+
+ virtual const std::string human_name() const
+ {
+ Lock l(get_mutex());
+
+ if (bp::override f = get_override("human_name"))
+ return f();
+ else
+ throw PythonMethodNotImplemented("MetadataStringKey", "human_name");
+ }
+
+ virtual MetadataKeyType type() const
+ {
+ Lock l(get_mutex());
+
+ if (bp::override f = get_override("type"))
+ return f();
+ else
+ throw PythonMethodNotImplemented("MetadataStringKey", "type");
+ }
};
struct MetadataSectionKeyWrapper :
MetadataSectionKey,
bp::wrapper<MetadataSectionKey>
{
- MetadataSectionKeyWrapper(const std::string & r, const std::string & h, const MetadataKeyType t) :
- MetadataSectionKey(r, h, t)
- {
- }
-
static PyObject *
find_metadata(const MetadataSectionKey & self, const std::string & key)
{
@@ -259,17 +304,42 @@ struct MetadataSectionKeyWrapper :
else
throw PythonMethodNotImplemented("MetadataSectionKey", "title_key");
}
+
+ virtual const std::string raw_name() const
+ {
+ Lock l(get_mutex());
+
+ if (bp::override f = get_override("raw_name"))
+ return f();
+ else
+ throw PythonMethodNotImplemented("MetadataSectionKey", "raw_name");
+ }
+
+ virtual const std::string human_name() const
+ {
+ Lock l(get_mutex());
+
+ if (bp::override f = get_override("human_name"))
+ return f();
+ else
+ throw PythonMethodNotImplemented("MetadataSectionKey", "human_name");
+ }
+
+ virtual MetadataKeyType type() const
+ {
+ Lock l(get_mutex());
+
+ if (bp::override f = get_override("type"))
+ return f();
+ else
+ throw PythonMethodNotImplemented("MetadataSectionKey", "type");
+ }
};
struct MetadataTimeKeyWrapper :
MetadataTimeKey,
bp::wrapper<MetadataTimeKey>
{
- MetadataTimeKeyWrapper(const std::string & r, const std::string & h, const MetadataKeyType t) :
- MetadataTimeKey(r, h, t)
- {
- }
-
virtual time_t value() const
PALUDIS_ATTRIBUTE((warn_unused_result))
{
@@ -280,17 +350,42 @@ struct MetadataTimeKeyWrapper :
else
throw PythonMethodNotImplemented("MetadataTimeKey", "value");
}
+
+ virtual const std::string raw_name() const
+ {
+ Lock l(get_mutex());
+
+ if (bp::override f = get_override("raw_name"))
+ return f();
+ else
+ throw PythonMethodNotImplemented("MetadataTimeKey", "raw_name");
+ }
+
+ virtual const std::string human_name() const
+ {
+ Lock l(get_mutex());
+
+ if (bp::override f = get_override("human_name"))
+ return f();
+ else
+ throw PythonMethodNotImplemented("MetadataTimeKey", "human_name");
+ }
+
+ virtual MetadataKeyType type() const
+ {
+ Lock l(get_mutex());
+
+ if (bp::override f = get_override("type"))
+ return f();
+ else
+ throw PythonMethodNotImplemented("MetadataTimeKey", "type");
+ }
};
struct MetadataContentsKeyWrapper :
MetadataValueKey<std::tr1::shared_ptr<const Contents> > ,
bp::wrapper<MetadataValueKey<std::tr1::shared_ptr<const Contents> > >
{
- MetadataContentsKeyWrapper(const std::string & r, const std::string & h, const MetadataKeyType t) :
- MetadataValueKey<std::tr1::shared_ptr<const Contents> > (r, h, t)
- {
- }
-
virtual const std::tr1::shared_ptr<const Contents> value() const
PALUDIS_ATTRIBUTE((warn_unused_result))
{
@@ -301,17 +396,42 @@ struct MetadataContentsKeyWrapper :
else
throw PythonMethodNotImplemented("MetadataContentsKey", "value");
}
+
+ virtual const std::string raw_name() const
+ {
+ Lock l(get_mutex());
+
+ if (bp::override f = get_override("raw_name"))
+ return f();
+ else
+ throw PythonMethodNotImplemented("MetadataContentsKey", "raw_name");
+ }
+
+ virtual const std::string human_name() const
+ {
+ Lock l(get_mutex());
+
+ if (bp::override f = get_override("human_name"))
+ return f();
+ else
+ throw PythonMethodNotImplemented("MetadataContentsKey", "human_name");
+ }
+
+ virtual MetadataKeyType type() const
+ {
+ Lock l(get_mutex());
+
+ if (bp::override f = get_override("type"))
+ return f();
+ else
+ throw PythonMethodNotImplemented("MetadataContentsKey", "type");
+ }
};
struct MetadataChoicesKeyWrapper :
MetadataValueKey<std::tr1::shared_ptr<const Choices> > ,
bp::wrapper<MetadataValueKey<std::tr1::shared_ptr<const Choices> > >
{
- MetadataChoicesKeyWrapper(const std::string & r, const std::string & h, const MetadataKeyType t) :
- MetadataValueKey<std::tr1::shared_ptr<const Choices> > (r, h, t)
- {
- }
-
virtual const std::tr1::shared_ptr<const Choices> value() const
PALUDIS_ATTRIBUTE((warn_unused_result))
{
@@ -322,17 +442,42 @@ struct MetadataChoicesKeyWrapper :
else
throw PythonMethodNotImplemented("MetadataChoicesKey", "value");
}
+
+ virtual const std::string raw_name() const
+ {
+ Lock l(get_mutex());
+
+ if (bp::override f = get_override("raw_name"))
+ return f();
+ else
+ throw PythonMethodNotImplemented("MetadataChoicesKey", "raw_name");
+ }
+
+ virtual const std::string human_name() const
+ {
+ Lock l(get_mutex());
+
+ if (bp::override f = get_override("human_name"))
+ return f();
+ else
+ throw PythonMethodNotImplemented("MetadataChoicesKey", "human_name");
+ }
+
+ virtual MetadataKeyType type() const
+ {
+ Lock l(get_mutex());
+
+ if (bp::override f = get_override("type"))
+ return f();
+ else
+ throw PythonMethodNotImplemented("MetadataChoicesKey", "type");
+ }
};
struct MetadataFSEntryKeyWrapper :
MetadataValueKey<FSEntry> ,
bp::wrapper<MetadataValueKey<FSEntry> >
{
- MetadataFSEntryKeyWrapper(const std::string & r, const std::string & h, const MetadataKeyType t) :
- MetadataValueKey<FSEntry> (r, h, t)
- {
- }
-
virtual const FSEntry value() const
PALUDIS_ATTRIBUTE((warn_unused_result))
{
@@ -343,17 +488,42 @@ struct MetadataFSEntryKeyWrapper :
else
throw PythonMethodNotImplemented("MetadataValueKey<FSEntry> ", "value");
}
+
+ virtual const std::string raw_name() const
+ {
+ Lock l(get_mutex());
+
+ if (bp::override f = get_override("raw_name"))
+ return f();
+ else
+ throw PythonMethodNotImplemented("MetadataFSEntryKey", "raw_name");
+ }
+
+ virtual const std::string human_name() const
+ {
+ Lock l(get_mutex());
+
+ if (bp::override f = get_override("human_name"))
+ return f();
+ else
+ throw PythonMethodNotImplemented("MetadataFSEntryKey", "human_name");
+ }
+
+ virtual MetadataKeyType type() const
+ {
+ Lock l(get_mutex());
+
+ if (bp::override f = get_override("type"))
+ return f();
+ else
+ throw PythonMethodNotImplemented("MetadataFSEntryKey", "type");
+ }
};
struct MetadataRepositoryMaskInfoKeyWrapper :
MetadataValueKey<std::tr1::shared_ptr<const RepositoryMaskInfo> > ,
bp::wrapper<MetadataValueKey<std::tr1::shared_ptr<const RepositoryMaskInfo> > >
{
- MetadataRepositoryMaskInfoKeyWrapper(const std::string & r, const std::string & h, const MetadataKeyType t) :
- MetadataValueKey<std::tr1::shared_ptr<const RepositoryMaskInfo> > (r, h, t)
- {
- }
-
virtual const std::tr1::shared_ptr<const RepositoryMaskInfo> value() const
PALUDIS_ATTRIBUTE((warn_unused_result))
{
@@ -364,6 +534,36 @@ struct MetadataRepositoryMaskInfoKeyWrapper :
else
throw PythonMethodNotImplemented("MetadataRepositoryMaskInfoKey", "value");
}
+
+ virtual const std::string raw_name() const
+ {
+ Lock l(get_mutex());
+
+ if (bp::override f = get_override("raw_name"))
+ return f();
+ else
+ throw PythonMethodNotImplemented("MetadataRepositoryMaskInfoKey", "raw_name");
+ }
+
+ virtual const std::string human_name() const
+ {
+ Lock l(get_mutex());
+
+ if (bp::override f = get_override("human_name"))
+ return f();
+ else
+ throw PythonMethodNotImplemented("MetadataRepositoryMaskInfoKey", "human_name");
+ }
+
+ virtual MetadataKeyType type() const
+ {
+ Lock l(get_mutex());
+
+ if (bp::override f = get_override("type"))
+ return f();
+ else
+ throw PythonMethodNotImplemented("MetadataRepositoryMaskInfoKey", "type");
+ }
};
template <typename C_>
@@ -371,11 +571,6 @@ struct MetadataCollectionKeyWrapper :
MetadataCollectionKey<C_>,
bp::wrapper<MetadataCollectionKey<C_> >
{
- MetadataCollectionKeyWrapper(const std::string & r, const std::string & h, const MetadataKeyType t) :
- MetadataCollectionKey<C_>(r, h, t)
- {
- }
-
virtual const std::tr1::shared_ptr<const C_> value() const
PALUDIS_ATTRIBUTE((warn_unused_result))
{
@@ -399,6 +594,36 @@ struct MetadataCollectionKeyWrapper :
else
throw PythonMethodNotImplemented("MetadataCollectionKey", "pretty_print_flat");
}
+
+ virtual const std::string raw_name() const
+ {
+ Lock l(get_mutex());
+
+ if (bp::override f = this->get_override("raw_name"))
+ return f();
+ else
+ throw PythonMethodNotImplemented("MetadataCollectionKey", "raw_name");
+ }
+
+ virtual const std::string human_name() const
+ {
+ Lock l(get_mutex());
+
+ if (bp::override f = this->get_override("human_name"))
+ return f();
+ else
+ throw PythonMethodNotImplemented("MetadataCollectionKey", "human_name");
+ }
+
+ virtual MetadataKeyType type() const
+ {
+ Lock l(get_mutex());
+
+ if (bp::override f = this->get_override("type"))
+ return f();
+ else
+ throw PythonMethodNotImplemented("MetadataCollectionKey", "type");
+ }
};
template <typename C_>
@@ -406,11 +631,6 @@ struct MetadataSpecTreeKeyWrapper :
MetadataSpecTreeKey<C_>,
bp::wrapper<MetadataSpecTreeKey<C_> >
{
- MetadataSpecTreeKeyWrapper(const std::string & r, const std::string & h, const MetadataKeyType t) :
- MetadataSpecTreeKey<C_>(r, h, t)
- {
- }
-
virtual const std::tr1::shared_ptr<const C_> value() const
PALUDIS_ATTRIBUTE((warn_unused_result))
{
@@ -443,6 +663,36 @@ struct MetadataSpecTreeKeyWrapper :
else
throw PythonMethodNotImplemented("MetadataSpecTreeKey", "pretty_print_flat");
}
+
+ virtual const std::string raw_name() const
+ {
+ Lock l(get_mutex());
+
+ if (bp::override f = this->get_override("raw_name"))
+ return f();
+ else
+ throw PythonMethodNotImplemented("MetadataSpecTreeKey", "raw_name");
+ }
+
+ virtual const std::string human_name() const
+ {
+ Lock l(get_mutex());
+
+ if (bp::override f = this->get_override("human_name"))
+ return f();
+ else
+ throw PythonMethodNotImplemented("MetadataSpecTreeKey", "human_name");
+ }
+
+ virtual MetadataKeyType type() const
+ {
+ Lock l(get_mutex());
+
+ if (bp::override f = this->get_override("type"))
+ return f();
+ else
+ throw PythonMethodNotImplemented("MetadataSpecTreeKey", "type");
+ }
};
template <>
@@ -450,11 +700,6 @@ struct MetadataSpecTreeKeyWrapper<FetchableURISpecTree> :
MetadataSpecTreeKey<FetchableURISpecTree>,
bp::wrapper<MetadataSpecTreeKey<FetchableURISpecTree> >
{
- MetadataSpecTreeKeyWrapper(const std::string & r, const std::string & h, const MetadataKeyType t) :
- MetadataSpecTreeKey<FetchableURISpecTree>(r, h, t)
- {
- }
-
virtual const std::tr1::shared_ptr<const FetchableURISpecTree> value() const
PALUDIS_ATTRIBUTE((warn_unused_result))
{
@@ -498,6 +743,36 @@ struct MetadataSpecTreeKeyWrapper<FetchableURISpecTree> :
else
throw PythonMethodNotImplemented("MetadataSpecTreeKey", "initial_label");
}
+
+ virtual const std::string raw_name() const
+ {
+ Lock l(get_mutex());
+
+ if (bp::override f = get_override("raw_name"))
+ return f();
+ else
+ throw PythonMethodNotImplemented("MetadataSpecTreeKey", "raw_name");
+ }
+
+ virtual const std::string human_name() const
+ {
+ Lock l(get_mutex());
+
+ if (bp::override f = get_override("human_name"))
+ return f();
+ else
+ throw PythonMethodNotImplemented("MetadataSpecTreeKey", "human_name");
+ }
+
+ virtual MetadataKeyType type() const
+ {
+ Lock l(get_mutex());
+
+ if (bp::override f = get_override("type"))
+ return f();
+ else
+ throw PythonMethodNotImplemented("MetadataSpecTreeKey", "type");
+ }
};
template <>
@@ -505,11 +780,6 @@ struct MetadataSpecTreeKeyWrapper<DependencySpecTree> :
MetadataSpecTreeKey<DependencySpecTree>,
bp::wrapper<MetadataSpecTreeKey<DependencySpecTree> >
{
- MetadataSpecTreeKeyWrapper(const std::string & r, const std::string & h, const MetadataKeyType t) :
- MetadataSpecTreeKey<DependencySpecTree>(r, h, t)
- {
- }
-
virtual const std::tr1::shared_ptr<const DependencySpecTree> value() const
PALUDIS_ATTRIBUTE((warn_unused_result))
{
@@ -553,6 +823,36 @@ struct MetadataSpecTreeKeyWrapper<DependencySpecTree> :
else
throw PythonMethodNotImplemented("MetadataSpecTreeKey", "initial_labels");
}
+
+ virtual const std::string raw_name() const
+ {
+ Lock l(get_mutex());
+
+ if (bp::override f = get_override("raw_name"))
+ return f();
+ else
+ throw PythonMethodNotImplemented("MetadataSpecTreeKey", "raw_name");
+ }
+
+ virtual const std::string human_name() const
+ {
+ Lock l(get_mutex());
+
+ if (bp::override f = get_override("human_name"))
+ return f();
+ else
+ throw PythonMethodNotImplemented("MetadataSpecTreeKey", "human_name");
+ }
+
+ virtual MetadataKeyType type() const
+ {
+ Lock l(get_mutex());
+
+ if (bp::override f = get_override("type"))
+ return f();
+ else
+ throw PythonMethodNotImplemented("MetadataSpecTreeKey", "type");
+ }
};
template <typename C_>
@@ -568,8 +868,8 @@ struct class_set_key :
"as its value.\n\n"
"This class can be subclassed in Python.",
- bp::init<const std::string &, const std::string &, MetadataKeyType>(
- "__init__(raw_name, human_name, MetadataKeyType)"
+ bp::init<>(
+ "__init__()"
)
)
{
@@ -603,8 +903,8 @@ struct class_spec_tree_key :
"kind as its value.\n\n"
"This class can be subclassed in Python.",
- bp::init<const std::string &, const std::string &, MetadataKeyType>(
- "__init__(raw_name, human_name, MetadataKeyType)"
+ bp::init<>(
+ "__init__()"
)
)
{
@@ -646,8 +946,8 @@ struct class_spec_tree_key<FetchableURISpecTree> :
"kind as its value.\n\n"
"This class can be subclassed in Python.",
- bp::init<const std::string &, const std::string &, MetadataKeyType>(
- "__init__(raw_name, human_name, MetadataKeyType)"
+ bp::init<>(
+ "__init__()"
)
)
{
@@ -695,8 +995,8 @@ struct class_spec_tree_key<DependencySpecTree> :
"kind as its value.\n\n"
"This class can be subclassed in Python.",
- bp::init<const std::string &, const std::string &, MetadataKeyType>(
- "__init__(raw_name, human_name, MetadataKeyType)"
+ bp::init<>(
+ "__init__()"
)
)
{
@@ -796,8 +1096,8 @@ void expose_metadata_key()
"value.\n\n"
"This class can be subclassed in Python.",
- bp::init<const std::string &, const std::string &, MetadataKeyType>(
- "__init__(raw_name, human_name, MetadataKeyType)"
+ bp::init<>(
+ "__init__()"
)
)
.def("value", bp::pure_virtual(&MetadataValueKey<std::tr1::shared_ptr<const PackageID> > ::value),
@@ -820,8 +1120,8 @@ void expose_metadata_key()
"value.\n\n"
"This class can be subclassed in Python.",
- bp::init<const std::string &, const std::string &, MetadataKeyType>(
- "__init__(raw_name, human_name, MetadataKeyType)"
+ bp::init<>(
+ "__init__()"
)
)
.def("value", bp::pure_virtual(&MetadataValueKey<std::string> ::value),
@@ -844,8 +1144,8 @@ void expose_metadata_key()
"may have a title.\n\n"
"This class can be subclassed in Python.",
- bp::init<const std::string &, const std::string &, MetadataKeyType>(
- "__init__(raw_name, human_name, MetadataKeyType)"
+ bp::init<>(
+ "__init__()"
)
)
.add_property("metadata", bp::range(&MetadataSectionKey::begin_metadata, &MetadataSectionKey::end_metadata),
@@ -872,8 +1172,8 @@ void expose_metadata_key()
"A MetadataTimeKey is a MetadataKey that has a int(time_t) as its value.\n\n"
"This class can be subclassed in Python.",
- bp::init<const std::string &, const std::string &, MetadataKeyType>(
- "__init__(raw_name, human_name, MetadataKeyType)"
+ bp::init<>(
+ "__init__()"
)
)
.def("value", bp::pure_virtual(&MetadataTimeKey::value),
@@ -895,8 +1195,8 @@ void expose_metadata_key()
"A MetadataFSEntryKey is a MetadataKey that has an string(FSEntry) as its value.\n\n"
"This class can be subclassed in Python.",
- bp::init<const std::string &, const std::string &, MetadataKeyType>(
- "__init__(raw_name, human_name, MetadataKeyType)"
+ bp::init<>(
+ "__init__()"
)
)
.def("value", bp::pure_virtual(&MetadataValueKey<FSEntry> ::value),
@@ -918,8 +1218,8 @@ void expose_metadata_key()
"A MetadataContentsKey is a MetadataKey that holds a Contents heirarchy.\n\n"
"This class can be subclassed in Python.",
- bp::init<const std::string &, const std::string &, MetadataKeyType>(
- "__init__(raw_name, human_name, MetadataKeyType)"
+ bp::init<>(
+ "__init__()"
)
)
.def("value", bp::pure_virtual(&MetadataValueKey<std::tr1::shared_ptr<const Contents> > ::value),
@@ -959,8 +1259,8 @@ void expose_metadata_key()
"A MetadataChoicesKey is a MetadataKey that holds a Choices heirarchy.\n\n"
"This class can be subclassed in Python.",
- bp::init<const std::string &, const std::string &, MetadataKeyType>(
- "__init__(raw_name, human_name, MetadataKeyType)"
+ bp::init<>(
+ "__init__()"
)
)
.def("value", bp::pure_virtual(&MetadataValueKey<std::tr1::shared_ptr<const Choices> > ::value),
@@ -1002,8 +1302,8 @@ void expose_metadata_key()
"RepositoryMaskInfo as its value.\n\n"
"This class can be subclassed in Python.",
- bp::init<const std::string &, const std::string &, MetadataKeyType>(
- "__init__(raw_name, human_name, MetadataKeyType)"
+ bp::init<>(
+ "__init__()"
)
)
.def("value", bp::pure_virtual(&MetadataValueKey<std::tr1::shared_ptr<const RepositoryMaskInfo> > ::value),
diff --git a/python/metadata_key_TEST.py b/python/metadata_key_TEST.py
index c552b3b..92a0d6a 100755
--- a/python/metadata_key_TEST.py
+++ b/python/metadata_key_TEST.py
@@ -69,60 +69,105 @@ class TestCase_02_MetadataKeys_suclassing(unittest.TestCase):
def test_01_package_id(self):
class TestKey(MetadataPackageIDKey):
def __init__(self):
- MetadataPackageIDKey.__init__(self, "raw", "human", MetadataKeyType.NORMAL)
+ MetadataPackageIDKey.__init__(self)
def value(self):
e = NoConfigEnvironment(repo_path, "/var/empty")
pid = iter(e.package_database.fetch_repository("testrepo").package_ids("foo/bar")).next()
return pid
+ def raw_name(self):
+ return "raw"
+
+ def human_name(self):
+ return "human"
+
+ def type(self):
+ return MetadataKeyType.NORMAL
+
test_metadata_package_id_key(TestKey())
def test_02_string(self):
class TestKey(MetadataStringKey):
def __init__(self):
- MetadataStringKey.__init__(self, "raw", "human", MetadataKeyType.NORMAL)
+ MetadataStringKey.__init__(self)
def value(self):
return "str"
+ def raw_name(self):
+ return "raw"
+
+ def human_name(self):
+ return "human"
+
+ def type(self):
+ return MetadataKeyType.NORMAL
+
test_metadata_string_key(TestKey())
def test_03_time(self):
class TestKey(MetadataTimeKey):
def __init__(self):
- MetadataTimeKey.__init__(self, "raw", "human", MetadataKeyType.NORMAL)
+ MetadataTimeKey.__init__(self)
def value(self):
return 123
+ def raw_name(self):
+ return "raw"
+
+ def human_name(self):
+ return "human"
+
+ def type(self):
+ return MetadataKeyType.NORMAL
+
test_metadata_time_key(TestKey())
def test_04_contents(self):
class TestKey(MetadataContentsKey):
def __init__(self):
- MetadataContentsKey.__init__(self, "raw", "human", MetadataKeyType.NORMAL)
+ MetadataContentsKey.__init__(self)
def value(self):
return Contents()
+ def raw_name(self):
+ return "raw"
+
+ def human_name(self):
+ return "human"
+
+ def type(self):
+ return MetadataKeyType.NORMAL
+
test_metadata_contents_key(TestKey())
def test_05_repository_mask_info(self):
class TestKey(MetadataRepositoryMaskInfoKey):
def __init__(self):
- MetadataRepositoryMaskInfoKey.__init__(self, "raw", "human", MetadataKeyType.NORMAL)
+ MetadataRepositoryMaskInfoKey.__init__(self)
def value(self):
return RepositoryMaskInfo(["comment"], "/foo")
+ def raw_name(self):
+ return "raw"
+
+ def human_name(self):
+ return "human"
+
+ def type(self):
+ return MetadataKeyType.NORMAL
+
test_metadata_repository_mask_info_key(TestKey())
def test_06_keyword_name_iterable(self):
class TestKey(MetadataKeywordNameIterableKey):
def __init__(self):
- MetadataKeywordNameIterableKey.__init__(self, "raw", "human", MetadataKeyType.NORMAL)
+ MetadataKeywordNameIterableKey.__init__(self)
def value(self):
return ["keyword"]
@@ -130,13 +175,22 @@ class TestCase_02_MetadataKeys_suclassing(unittest.TestCase):
def pretty_print_flat(self, f):
return f.format_keyword_name_plain(KeywordName("foo"))
+ def raw_name(self):
+ return "raw"
+
+ def human_name(self):
+ return "human"
+
+ def type(self):
+ return MetadataKeyType.NORMAL
+
test_metadata_keyword_name_set_key(TestKey())
def test_09_string_iterable(self):
class TestKey(MetadataStringIterableKey):
def __init__(self):
- MetadataStringIterableKey.__init__(self, "raw", "human", MetadataKeyType.NORMAL)
+ MetadataStringIterableKey.__init__(self)
def value(self):
return ["string"]
@@ -144,12 +198,21 @@ class TestCase_02_MetadataKeys_suclassing(unittest.TestCase):
def pretty_print_flat(self, f):
return f.format_string_plain("foo")
+ def raw_name(self):
+ return "raw"
+
+ def human_name(self):
+ return "human"
+
+ def type(self):
+ return MetadataKeyType.NORMAL
+
test_metadata_string_set_key(TestKey())
def test_10_license_spec_tree(self):
class TestKey(MetadataLicenseSpecTreeKey):
def __init__(self):
- MetadataLicenseSpecTreeKey.__init__(self, "raw", "human", MetadataKeyType.NORMAL)
+ MetadataLicenseSpecTreeKey.__init__(self)
def value(self):
return AllDepSpec()
@@ -164,12 +227,21 @@ class TestCase_02_MetadataKeys_suclassing(unittest.TestCase):
#return f.format_use_dep_spec_plain(...)
return "str"
+ def raw_name(self):
+ return "raw"
+
+ def human_name(self):
+ return "human"
+
+ def type(self):
+ return MetadataKeyType.NORMAL
+
test_metadata_license_spec_tree_key(TestKey())
def test_11_provide_spec_tree(self):
class TestKey(MetadataProvideSpecTreeKey):
def __init__(self):
- MetadataProvideSpecTreeKey.__init__(self, "raw", "human", MetadataKeyType.NORMAL)
+ MetadataProvideSpecTreeKey.__init__(self)
self.e = NoConfigEnvironment(repo_path, "/var/empty")
def value(self):
@@ -183,13 +255,22 @@ class TestCase_02_MetadataKeys_suclassing(unittest.TestCase):
pds = parse_user_package_dep_spec("cat/pkg", self.e, [])
return f.format_package_dep_spec_plain(pds)
+ def raw_name(self):
+ return "raw"
+
+ def human_name(self):
+ return "human"
+
+ def type(self):
+ return MetadataKeyType.NORMAL
+
test_metadata_provide_spec_tree_key(TestKey())
def test_12_dependency_spec_tree(self):
class TestKey(MetadataDependencySpecTreeKey):
def __init__(self):
self.e = NoConfigEnvironment(repo_path, "/var/empty")
- MetadataDependencySpecTreeKey.__init__(self, "raw", "human", MetadataKeyType.NORMAL)
+ MetadataDependencySpecTreeKey.__init__(self)
def value(self):
return AllDepSpec()
@@ -202,13 +283,22 @@ class TestCase_02_MetadataKeys_suclassing(unittest.TestCase):
pds = parse_user_package_dep_spec("cat/pkg", self.e, [])
return f.format_package_dep_spec_plain(pds)
+ def raw_name(self):
+ return "raw"
+
+ def human_name(self):
+ return "human"
+
+ def type(self):
+ return MetadataKeyType.NORMAL
+
test_metadata_dependency_spec_tree_key(TestKey())
def test_13_plain_text_spec_tree(self):
class TestKey(MetadataPlainTextSpecTreeKey):
def __init__(self):
- MetadataPlainTextSpecTreeKey.__init__(self, "raw", "human", MetadataKeyType.NORMAL)
+ MetadataPlainTextSpecTreeKey.__init__(self)
def value(self):
return AllDepSpec()
@@ -223,12 +313,21 @@ class TestCase_02_MetadataKeys_suclassing(unittest.TestCase):
#return f.format_plain_text_dep_spec_plain(PlainTextDepSpec("foo"))
return "str"
+ def raw_name(self):
+ return "raw"
+
+ def human_name(self):
+ return "human"
+
+ def type(self):
+ return MetadataKeyType.NORMAL
+
test_metadata_plain_text_spec_tree_key(TestKey())
def test_14_fetchable_uri_spec_tree(self):
class TestKey(MetadataFetchableURISpecTreeKey):
def __init__(self):
- MetadataFetchableURISpecTreeKey.__init__(self, "raw", "human", MetadataKeyType.NORMAL)
+ MetadataFetchableURISpecTreeKey.__init__(self)
def value(self):
return AllDepSpec()
@@ -246,12 +345,21 @@ class TestCase_02_MetadataKeys_suclassing(unittest.TestCase):
def initial_label(self):
return URIMirrorsOnlyLabel("foo")
+ def raw_name(self):
+ return "raw"
+
+ def human_name(self):
+ return "human"
+
+ def type(self):
+ return MetadataKeyType.NORMAL
+
test_metadata_fetchable_uri_spec_tree_key(TestKey())
def test_15_simple_uri_spec_tree(self):
class TestKey(MetadataSimpleURISpecTreeKey):
def __init__(self):
- MetadataSimpleURISpecTreeKey.__init__(self, "raw", "human", MetadataKeyType.NORMAL)
+ MetadataSimpleURISpecTreeKey.__init__(self)
def value(self):
return AllDepSpec()
@@ -266,12 +374,21 @@ class TestCase_02_MetadataKeys_suclassing(unittest.TestCase):
#return f.format_use_dep_spec_plain(...)
return "str"
+ def raw_name(self):
+ return "raw"
+
+ def human_name(self):
+ return "human"
+
+ def type(self):
+ return MetadataKeyType.NORMAL
+
test_metadata_simple_uri_spec_tree_key(TestKey())
def test_16_section(self):
class TestKey(MetadataSectionKey):
def __init__(self):
- MetadataSectionKey.__init__(self, "raw", "human", MetadataKeyType.NORMAL)
+ MetadataSectionKey.__init__(self)
def need_keys_added(self):
return
@@ -279,16 +396,34 @@ class TestCase_02_MetadataKeys_suclassing(unittest.TestCase):
def title_key(self):
return None
+ def raw_name(self):
+ return "raw"
+
+ def human_name(self):
+ return "human"
+
+ def type(self):
+ return MetadataKeyType.NORMAL
+
test_metadata_section_key(TestKey())
def test_17_choices(self):
class TestKey(MetadataChoicesKey):
def __init__(self):
- MetadataChoicesKey.__init__(self, "raw", "human", MetadataKeyType.NORMAL)
+ MetadataChoicesKey.__init__(self)
def value(self):
return Choices()
+ def raw_name(self):
+ return "raw"
+
+ def human_name(self):
+ return "human"
+
+ def type(self):
+ return MetadataKeyType.NORMAL
+
test_metadata_choices_key(TestKey())