aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-02-16 00:07:18 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-02-16 00:07:18 +0000
commitca35d755e3758ea2a6e96c8640182af2f809ae45 (patch)
tree729701eb613c8206d27d40b76b6f854d501c4c15
parent0361486bbadd50eaa1bfe97749b69261e55cdce9 (diff)
downloadpaludis-ca35d755e3758ea2a6e96c8640182af2f809ae45.tar.gz
paludis-ca35d755e3758ea2a6e96c8640182af2f809ae45.tar.xz
Add LiteralMetadataTimeKey
-rw-r--r--paludis/literal_metadata_key.cc55
-rw-r--r--paludis/literal_metadata_key.hh30
2 files changed, 85 insertions, 0 deletions
diff --git a/paludis/literal_metadata_key.cc b/paludis/literal_metadata_key.cc
index 4fcb044..f6321bc 100644
--- a/paludis/literal_metadata_key.cc
+++ b/paludis/literal_metadata_key.cc
@@ -341,6 +341,61 @@ LiteralMetadataValueKey<T_>::value() const
return _imp->value;
}
+namespace paludis
+{
+ template <>
+ struct Implementation<LiteralMetadataTimeKey>
+ {
+ const std::string raw_name;
+ const std::string human_name;
+ const MetadataKeyType type;
+ const time_t value;
+
+ Implementation(const std::string & r, const std::string & h, const MetadataKeyType t, const time_t v) :
+ raw_name(r),
+ human_name(h),
+ type(t),
+ value(v)
+ {
+ }
+ };
+}
+
+LiteralMetadataTimeKey::LiteralMetadataTimeKey(
+ const std::string & r, const std::string & h, const MetadataKeyType k, const time_t v) :
+ PrivateImplementationPattern<LiteralMetadataTimeKey>(new Implementation<LiteralMetadataTimeKey>(r, h, k, v)),
+ _imp(PrivateImplementationPattern<LiteralMetadataTimeKey>::_imp)
+{
+}
+
+LiteralMetadataTimeKey::~LiteralMetadataTimeKey()
+{
+}
+
+const std::string
+LiteralMetadataTimeKey::human_name() const
+{
+ return _imp->human_name;
+}
+
+const std::string
+LiteralMetadataTimeKey::raw_name() const
+{
+ return _imp->raw_name;
+}
+
+MetadataKeyType
+LiteralMetadataTimeKey::type() const
+{
+ return _imp->type;
+}
+
+time_t
+LiteralMetadataTimeKey::value() const
+{
+ return _imp->value;
+}
+
template class LiteralMetadataValueKey<FSEntry>;
template class LiteralMetadataValueKey<std::string>;
template class LiteralMetadataValueKey<SlotName>;
diff --git a/paludis/literal_metadata_key.hh b/paludis/literal_metadata_key.hh
index f1dea9d..3895618 100644
--- a/paludis/literal_metadata_key.hh
+++ b/paludis/literal_metadata_key.hh
@@ -240,6 +240,36 @@ namespace paludis
virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
};
+
+ /**
+ * A LiteralMetadataTimeKey is a MetadataTimeKey whose value is known at
+ * construction time.
+ *
+ * \ingroup g_literal_metadata_key
+ * \since 0.36
+ */
+ class PALUDIS_VISIBLE LiteralMetadataTimeKey :
+ public MetadataTimeKey,
+ private PrivateImplementationPattern<LiteralMetadataTimeKey>
+ {
+ private:
+ PrivateImplementationPattern<LiteralMetadataTimeKey>::ImpPtr & _imp;
+
+ public:
+ ///\name Basic operations
+ ///\{
+
+ LiteralMetadataTimeKey(const std::string &, const std::string &, const MetadataKeyType, const time_t);
+ ~LiteralMetadataTimeKey();
+
+ ///\}
+
+ virtual 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));
+ };
}
#endif