aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-03-12 13:47:26 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-03-12 14:10:29 +0000
commit68e5f8e0a16e1499748f91a0ac324204d73cb7cd (patch)
tree77ef054ee775f6ddaac257d27c1795d13e43f126
parent98e338b79e3e4aac332265e132cc92e4583fbd47 (diff)
downloadpaludis-68e5f8e0a16e1499748f91a0ac324204d73cb7cd.tar.gz
paludis-68e5f8e0a16e1499748f91a0ac324204d73cb7cd.tar.xz
Export 'about' info as metadata keys
-rw-r--r--paludis/about_metadata-fwd.hh28
-rw-r--r--paludis/about_metadata.cc87
-rw-r--r--paludis/about_metadata.hh67
-rw-r--r--paludis/files.m41
4 files changed, 183 insertions, 0 deletions
diff --git a/paludis/about_metadata-fwd.hh b/paludis/about_metadata-fwd.hh
new file mode 100644
index 0000000..d103fc9
--- /dev/null
+++ b/paludis/about_metadata-fwd.hh
@@ -0,0 +1,28 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2010 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_ABOUT_METADATA_FWD_HH
+#define PALUDIS_GUARD_PALUDIS_ABOUT_METADATA_FWD_HH 1
+
+namespace paludis
+{
+ class AboutMetadata;
+}
+
+#endif
diff --git a/paludis/about_metadata.cc b/paludis/about_metadata.cc
new file mode 100644
index 0000000..1646ec2
--- /dev/null
+++ b/paludis/about_metadata.cc
@@ -0,0 +1,87 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2010 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <paludis/about_metadata.hh>
+#include <paludis/util/instantiation_policy-impl.hh>
+#include <paludis/util/private_implementation_pattern-impl.hh>
+#include <paludis/literal_metadata_key.hh>
+#include <paludis/about.hh>
+
+using namespace paludis;
+
+namespace paludis
+{
+ template <>
+ struct Implementation<AboutMetadata>
+ {
+ std::tr1::shared_ptr<LiteralMetadataValueKey<std::string> > package_key;
+ std::tr1::shared_ptr<LiteralMetadataValueKey<std::string> > version_key;
+
+ std::tr1::shared_ptr<LiteralMetadataValueKey<std::string> > build_cxxflags_key;
+ std::tr1::shared_ptr<LiteralMetadataValueKey<std::string> > build_ldflags_key;
+ std::tr1::shared_ptr<LiteralMetadataValueKey<std::string> > build_cxx_key;
+ std::tr1::shared_ptr<LiteralMetadataValueKey<std::string> > build_date_key;
+
+ Implementation() :
+ package_key(new LiteralMetadataValueKey<std::string>("PALUDIS_PACKAGE", "Package Name", mkt_significant, PALUDIS_PACKAGE)),
+ version_key(new LiteralMetadataValueKey<std::string>("PALUDIS_VERSION", "Package Version", mkt_significant,
+ stringify(PALUDIS_VERSION_MAJOR) + "." + stringify(PALUDIS_VERSION_MINOR) + "." +
+ stringify(PALUDIS_VERSION_MICRO) + PALUDIS_VERSION_SUFFIX + (std::string(PALUDIS_GIT_HEAD).empty() ? "" :
+ " " + stringify(PALUDIS_GIT_HEAD)))),
+ build_cxxflags_key(new LiteralMetadataValueKey<std::string>("PALUDIS_BUILD_CXXFLAGS", "Built with CXXFLAGS", mkt_normal,
+ PALUDIS_BUILD_CXXFLAGS)),
+ build_ldflags_key(new LiteralMetadataValueKey<std::string>("PALUDIS_BUILD_LDFLAGS", "Built with LDFLAGS", mkt_normal,
+ PALUDIS_BUILD_LDFLAGS)),
+ build_cxx_key(new LiteralMetadataValueKey<std::string>("PALUDIS_BUILD_CXX", "Built with CXX", mkt_normal,
+ stringify(PALUDIS_BUILD_CXX)
+#ifdef __VERSION__
+ + " " + stringify(__VERSION__)
+#endif
+ )),
+ build_date_key(new LiteralMetadataValueKey<std::string>("PALUDIS_BUILD_DATE", "Build Date", mkt_normal,
+ PALUDIS_BUILD_DATE))
+ {
+ }
+ };
+}
+
+AboutMetadata::AboutMetadata() :
+ PrivateImplementationPattern<AboutMetadata>(new Implementation<AboutMetadata>),
+ _imp(PrivateImplementationPattern<AboutMetadata>::_imp)
+{
+ add_metadata_key(_imp->package_key);
+ add_metadata_key(_imp->version_key);
+ add_metadata_key(_imp->build_cxxflags_key);
+ add_metadata_key(_imp->build_ldflags_key);
+ add_metadata_key(_imp->build_cxx_key);
+ add_metadata_key(_imp->build_date_key);
+}
+
+AboutMetadata::~AboutMetadata()
+{
+}
+
+void
+AboutMetadata::need_keys_added() const
+{
+}
+
+template class PrivateImplementationPattern<AboutMetadata>;
+template class InstantiationPolicy<AboutMetadata, instantiation_method::SingletonTag>;
+
diff --git a/paludis/about_metadata.hh b/paludis/about_metadata.hh
new file mode 100644
index 0000000..3573caa
--- /dev/null
+++ b/paludis/about_metadata.hh
@@ -0,0 +1,67 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2010 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_ABOUT_METADATA_HH
+#define PALUDIS_GUARD_PALUDIS_ABOUT_METADATA_HH 1
+
+#include <paludis/about_metadata-fwd.hh>
+#include <paludis/util/attributes.hh>
+#include <paludis/util/private_implementation_pattern.hh>
+#include <paludis/util/instantiation_policy.hh>
+#include <paludis/metadata_key_holder.hh>
+
+/** \file
+ * Provides information about Paludis, similar to that in "paludis/about.hh", in
+ * the form of MetadataKey values.
+ *
+ * \ingroup g_about
+ */
+
+namespace paludis
+{
+ /**
+ * Information about Paludis, provided as MetadataKey instances.
+ *
+ * \ingroup g_about
+ * \since 0.46
+ */
+ class PALUDIS_VISIBLE AboutMetadata :
+ private PrivateImplementationPattern<AboutMetadata>,
+ public InstantiationPolicy<AboutMetadata, instantiation_method::SingletonTag>,
+ public MetadataKeyHolder
+ {
+ friend class InstantiationPolicy<AboutMetadata, instantiation_method::SingletonTag>;
+
+ private:
+ PrivateImplementationPattern<AboutMetadata>::ImpPtr & _imp;
+
+ AboutMetadata();
+ ~AboutMetadata();
+
+ protected:
+ void need_keys_added() const;
+ };
+
+#ifdef PALUDIS_HAVE_EXTERN_TEMPLATE
+ extern template class PrivateImplementationPattern<AboutMetadata>;
+ extern template class InstantiationPolicy<AboutMetadata, instantiation_method::SingletonTag>;
+#endif
+}
+
+#endif
diff --git a/paludis/files.m4 b/paludis/files.m4
index 1d9b874..c29b9f1 100644
--- a/paludis/files.m4
+++ b/paludis/files.m4
@@ -9,6 +9,7 @@ dnl `test', `impl', `testscript'. Note that there isn't much error checking done
dnl on this file at present...
add(`about', `hh', `test')
+add(`about_metadata', `hh', `cc', `fwd')
add(`action', `hh', `cc', `fwd', `se')
add(`action_names', `hh', `cc', `fwd')
add(`buffer_output_manager', `hh', `cc', `fwd')