aboutsummaryrefslogtreecommitdiff
path: root/paludis/literal_metadata_key.hh
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-02-16 09:17:23 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-02-16 09:17:23 +0000
commit830cd0e27f1acdbfdf66e6dd7a8630a35a6869b5 (patch)
tree1b486967b2b840ea87a8fbf311c13a823540116e /paludis/literal_metadata_key.hh
parent169e91b611f2a12b89467e03abb4c76ddbe3fe7e (diff)
downloadpaludis-830cd0e27f1acdbfdf66e6dd7a8630a35a6869b5.tar.gz
paludis-830cd0e27f1acdbfdf66e6dd7a8630a35a6869b5.tar.xz
Merge various metadata key things.
Diffstat (limited to 'paludis/literal_metadata_key.hh')
-rw-r--r--paludis/literal_metadata_key.hh74
1 files changed, 25 insertions, 49 deletions
diff --git a/paludis/literal_metadata_key.hh b/paludis/literal_metadata_key.hh
index 39adcd59f..ef6387802 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 Ciaran McCreesh
+ * Copyright (c) 2007, 2008 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
@@ -40,84 +40,60 @@
namespace paludis
{
/**
- * A LiteralMetadataStringKey is a MetadataStringKey whose value is a
- * literal string that is known at construction time.
+ * Implement extra methods for LiteralMetadataValueKey.
*
- * \ingroup g_literal_metadata_key
+ * \ingroup g_metadata_key
* \since 0.26
*/
- class PALUDIS_VISIBLE LiteralMetadataStringKey :
- public MetadataStringKey,
- private PrivateImplementationPattern<LiteralMetadataStringKey>
+ template <typename T_>
+ class ExtraLiteralMetadataValueKeyMethods
{
- private:
- PrivateImplementationPattern<LiteralMetadataStringKey>::ImpPtr & _imp;
-
- public:
- ///\name Basic operations
- ///\{
-
- LiteralMetadataStringKey(const std::string &, const std::string &, const MetadataKeyType,
- const std::string &);
- ~LiteralMetadataStringKey();
-
- ///\}
-
- virtual const std::string value() const PALUDIS_ATTRIBUTE((warn_unused_result));
};
/**
- * A LiteralMetadataFSEntryKey is a MetadataFSEntryKey whose value is a
- * literal FSEntry that is known at construction time.
+ * Implement extra methods for LiteralMetadataValueKey for PackageID.
*
- * \ingroup g_literal_metadata_key
+ * \ingroup g_metadata_key
* \since 0.26
*/
- class PALUDIS_VISIBLE LiteralMetadataFSEntryKey :
- public MetadataFSEntryKey,
- private PrivateImplementationPattern<LiteralMetadataFSEntryKey>
+ template <>
+ class ExtraLiteralMetadataValueKeyMethods<tr1::shared_ptr<const PackageID> > :
+ public virtual ExtraMetadataValueKeyMethods<tr1::shared_ptr<const PackageID> >
{
- private:
- PrivateImplementationPattern<LiteralMetadataFSEntryKey>::ImpPtr & _imp;
-
public:
- ///\name Basic operations
- ///\{
+ virtual ~ExtraLiteralMetadataValueKeyMethods() = 0;
- LiteralMetadataFSEntryKey(const std::string &, const std::string &, const MetadataKeyType,
- const FSEntry &);
- ~LiteralMetadataFSEntryKey();
-
- ///\}
-
- virtual const FSEntry value() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual std::string pretty_print(const Formatter<PackageID> &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
};
/**
- * A LiteralMetadataPackageIDKey is a MetadataPackageIDKey whose value is
- * known at construction time.
+ * A LiteralMetadataValueKey is a MetadataValueKey whose value is a
+ * copyable literal that is known at construction time.
*
* \ingroup g_literal_metadata_key
* \since 0.26
*/
- class PALUDIS_VISIBLE LiteralMetadataPackageIDKey :
- public MetadataPackageIDKey,
- private PrivateImplementationPattern<LiteralMetadataPackageIDKey>
+ template <typename T_>
+ class PALUDIS_VISIBLE LiteralMetadataValueKey :
+ public MetadataValueKey<T_>,
+ private PrivateImplementationPattern<LiteralMetadataValueKey<T_> >,
+ public ExtraLiteralMetadataValueKeyMethods<T_>
{
private:
- PrivateImplementationPattern<LiteralMetadataPackageIDKey>::ImpPtr & _imp;
+ typename PrivateImplementationPattern<LiteralMetadataValueKey<T_> >::ImpPtr & _imp;
public:
///\name Basic operations
///\{
- LiteralMetadataPackageIDKey(const std::string &, const std::string &, const MetadataKeyType,
- const tr1::shared_ptr<const PackageID> &);
- ~LiteralMetadataPackageIDKey();
+ LiteralMetadataValueKey(const std::string &, const std::string &, const MetadataKeyType,
+ const T_ &);
+ ~LiteralMetadataValueKey();
///\}
- virtual const tr1::shared_ptr<const PackageID> value() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const T_ value() const PALUDIS_ATTRIBUTE((warn_unused_result));
};
/**