aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-02-19 10:39:58 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-02-19 17:18:21 +0000
commit2c935c797ce74dacaface739c080d2e3daf3d325 (patch)
tree4a38e6e77e987900b5eb35f6178fe62324345939
parentf40a4273d3a6001148eea6d053923e8af753038a (diff)
downloadpaludis-2c935c797ce74dacaface739c080d2e3daf3d325.tar.gz
paludis-2c935c797ce74dacaface739c080d2e3daf3d325.tar.xz
ELikeAnnotations
-rw-r--r--paludis/elike_annotations-fwd.hh28
-rw-r--r--paludis/elike_annotations.cc74
-rw-r--r--paludis/elike_annotations.hh50
-rw-r--r--paludis/files.m41
-rw-r--r--paludis/repositories/e/dep_parser.cc33
5 files changed, 155 insertions, 31 deletions
diff --git a/paludis/elike_annotations-fwd.hh b/paludis/elike_annotations-fwd.hh
new file mode 100644
index 0000000..d54845c
--- /dev/null
+++ b/paludis/elike_annotations-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_ELIKE_ANNOTATIONS_FWD_HH
+#define PALUDIS_GUARD_PALUDIS_ELIKE_ANNOTATIONS_FWD_HH 1
+
+namespace paludis
+{
+ struct ELikeAnnotations;
+}
+
+#endif
diff --git a/paludis/elike_annotations.cc b/paludis/elike_annotations.cc
new file mode 100644
index 0000000..7b9bbe5
--- /dev/null
+++ b/paludis/elike_annotations.cc
@@ -0,0 +1,74 @@
+/* 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/elike_annotations.hh>
+#include <paludis/util/private_implementation_pattern-impl.hh>
+#include <paludis/util/map.hh>
+#include <paludis/util/wrapped_forward_iterator.hh>
+#include <paludis/literal_metadata_key.hh>
+
+using namespace paludis;
+
+namespace paludis
+{
+ template <>
+ struct Implementation<ELikeAnnotations>
+ {
+ };
+}
+
+ELikeAnnotations::ELikeAnnotations(const std::tr1::shared_ptr<const Map<std::string, std::string> > & m) :
+ PrivateImplementationPattern<ELikeAnnotations>(new Implementation<ELikeAnnotations>)
+{
+ for (Map<std::string, std::string>::ConstIterator k(m->begin()), k_end(m->end()) ;
+ k != k_end ; ++k)
+ add_metadata_key(make_shared_ptr(new LiteralMetadataValueKey<std::string>(
+ k->first, k->first, mkt_normal, k->second)));
+}
+
+ELikeAnnotations::~ELikeAnnotations()
+{
+}
+
+
+void
+ELikeAnnotations::need_keys_added() const
+{
+}
+
+const std::string
+ELikeAnnotations::human_name() const
+{
+ return "Annotations";
+}
+
+const std::string
+ELikeAnnotations::raw_name() const
+{
+ return "Annotations";
+}
+
+MetadataKeyType
+ELikeAnnotations::type() const
+{
+ return mkt_normal;
+}
+
+template class PrivateImplementationPattern<ELikeAnnotations>;
+
diff --git a/paludis/elike_annotations.hh b/paludis/elike_annotations.hh
new file mode 100644
index 0000000..f97fbb2
--- /dev/null
+++ b/paludis/elike_annotations.hh
@@ -0,0 +1,50 @@
+/* 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_ELIKE_ANNOTATIONS_HH
+#define PALUDIS_GUARD_PALUDIS_ELIKE_ANNOTATIONS_HH 1
+
+#include <paludis/elike_annotations-fwd.hh>
+#include <paludis/util/private_implementation_pattern.hh>
+#include <paludis/util/map-fwd.hh>
+#include <paludis/metadata_key.hh>
+#include <tr1/memory>
+
+namespace paludis
+{
+ class PALUDIS_VISIBLE ELikeAnnotations :
+ private PrivateImplementationPattern<ELikeAnnotations>,
+ public MetadataSectionKey
+ {
+ public:
+ ELikeAnnotations(const std::tr1::shared_ptr<const Map<std::string, std::string> > &);
+ ~ELikeAnnotations();
+
+ void need_keys_added() const;
+ virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ };
+
+#ifdef PALUDIS_HAVE_EXTERN_TEMPLATE
+ extern template class PrivateImplementationPattern<ELikeAnnotations>;
+#endif
+}
+
+#endif
diff --git a/paludis/files.m4 b/paludis/files.m4
index 2767d66..1d9b874 100644
--- a/paludis/files.m4
+++ b/paludis/files.m4
@@ -24,6 +24,7 @@ add(`dep_spec', `hh', `cc', `test', `fwd', `se')
add(`dep_spec_flattener', `hh', `cc')
add(`dep_tag', `hh', `cc', `fwd')
add(`distribution', `hh', `cc', `impl', `fwd')
+add(`elike_annotations', `hh', `cc', `fwd')
add(`elike_choices', `hh', `cc', `fwd')
add(`elike_dep_parser', `hh', `cc', `fwd', `test')
add(`elike_conditional_dep_spec', `hh', `cc', `fwd')
diff --git a/paludis/repositories/e/dep_parser.cc b/paludis/repositories/e/dep_parser.cc
index e9c1b0a..509762c 100644
--- a/paludis/repositories/e/dep_parser.cc
+++ b/paludis/repositories/e/dep_parser.cc
@@ -28,6 +28,7 @@
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/return_literal_function.hh>
#include <paludis/util/log.hh>
+#include <paludis/elike_annotations.hh>
#include <paludis/elike_dep_parser.hh>
#include <paludis/elike_conditional_dep_spec.hh>
#include <paludis/elike_package_dep_spec.hh>
@@ -301,39 +302,9 @@ namespace
{
}
- struct AnnotationsKey :
- MetadataSectionKey
- {
- 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)
- add_metadata_key(make_shared_ptr(new LiteralMetadataValueKey<std::string>(k->first, k->first, mkt_normal, k->second)));
- }
-
- 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)
{
- std::tr1::shared_ptr<AnnotationsKey> key(new AnnotationsKey(m));
+ std::tr1::shared_ptr<ELikeAnnotations> key(new ELikeAnnotations(m));
spec->set_annotations_key(key);
}