aboutsummaryrefslogtreecommitdiff
path: root/0.26.0_alpha1/paludis/util/map.hh
diff options
context:
space:
mode:
Diffstat (limited to '0.26.0_alpha1/paludis/util/map.hh')
-rw-r--r--0.26.0_alpha1/paludis/util/map.hh102
1 files changed, 102 insertions, 0 deletions
diff --git a/0.26.0_alpha1/paludis/util/map.hh b/0.26.0_alpha1/paludis/util/map.hh
new file mode 100644
index 000000000..91cd755ed
--- /dev/null
+++ b/0.26.0_alpha1/paludis/util/map.hh
@@ -0,0 +1,102 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2007 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk>
+ *
+ * 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_UTIL_MAP_HH
+#define PALUDIS_GUARD_PALUDIS_UTIL_MAP_HH 1
+
+#include <paludis/util/map-fwd.hh>
+#include <paludis/util/attributes.hh>
+#include <paludis/util/instantiation_policy.hh>
+#include <paludis/util/private_implementation_pattern.hh>
+
+#include <libwrapiter/libwrapiter_forward_iterator-fwd.hh>
+#include <libwrapiter/libwrapiter_output_iterator-fwd.hh>
+
+#include <utility>
+
+/** \file
+ * Declarations for the Map<> class.
+ *
+ * \ingroup g_data_structures
+ *
+ * \section Examples
+ *
+ * - None at this time.
+ */
+
+namespace paludis
+{
+ /**
+ * A wrapper around a map, avoiding the need to include lots of STL bloat
+ * everywhere.
+ *
+ * \ingroup g_data_structures
+ * \since 0.26
+ * \nosubgrouping
+ */
+ template <typename K_, typename V_, typename C_>
+ class PALUDIS_VISIBLE Map :
+ private PrivateImplementationPattern<Map<K_, V_, C_> >,
+ private InstantiationPolicy<Map<K_, V_, C_>, instantiation_method::NonCopyableTag>
+ {
+ private:
+ using PrivateImplementationPattern<Map<K_, V_, C_> >::_imp;
+
+ public:
+ ///\name Basic operations
+ ///\{
+
+ Map();
+ ~Map();
+
+ ///\}
+
+ ///\name Iteration
+ ///\{
+
+ typedef libwrapiter::ForwardIterator<Map<K_, V_, C_>, const std::pair<const K_, V_> > ConstIterator;
+ ConstIterator begin() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ ConstIterator end() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ ConstIterator find(const K_ &) const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ typedef libwrapiter::OutputIterator<Map<K_, V_, C_>, std::pair<const K_, V_> > Inserter;
+ Inserter inserter() PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ ///\}
+
+ ///\name Content information
+ ///\{
+
+ bool empty() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ unsigned size() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ ///\}
+
+ ///\name Content modification
+ ///\{
+
+ void insert(const K_ &, const V_ &);
+ void erase(const ConstIterator &);
+ void erase(const K_ &);
+
+ ///\}
+ };
+}
+
+#endif