paludis Version 3.0.2
The one true package mangler
set.hh
Go to the documentation of this file.
1/* vim: set sw=4 sts=4 et foldmethod=syntax : */
2
3/*
4 * Copyright (c) 2007, 2009, 2010, 2011 Ciaran McCreesh
5 *
6 * This file is part of the Paludis package manager. Paludis is free software;
7 * you can redistribute it and/or modify it under the terms of the GNU General
8 * Public License version 2, as published by the Free Software Foundation.
9 *
10 * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
11 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 * details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
17 * Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#ifndef PALUDIS_GUARD_PALUDIS_UTIL_SET_HH
21#define PALUDIS_GUARD_PALUDIS_UTIL_SET_HH 1
22
25#include <paludis/util/pimp.hh>
26#include <paludis/util/wrapped_forward_iterator-fwd.hh>
27#include <paludis/util/wrapped_output_iterator-fwd.hh>
28#include <string>
29
30/** \file
31 * Declarations for the Set<> class.
32 *
33 * \ingroup g_data_structures
34 *
35 * \section Examples
36 *
37 * - None at this time.
38 */
39
40namespace paludis
41{
42 /**
43 * A wrapper around a set, avoiding the need to include lots of STL bloat
44 * all over the place.
45 *
46 * \ingroup g_data_structures
47 * \since 0.26
48 */
49 template <typename T_, typename C_>
51 {
52 private:
53 Pimp<Set<T_, C_> > _imp;
54
55 public:
56 typedef T_ Tag;
57
58 ///\name Standard library typedefs
59 ///\{
60
61 typedef T_ value_type;
62 typedef T_ & reference;
63 typedef const T_ & const_reference;
64
65 ///\}
66
67 ///\name Basic operations
68 ///\{
69
70 Set();
71 ~Set();
72
73 Set(const Set &) = delete;
74 Set & operator= (const Set &) = delete;
75
76 ///\}
77
78 ///\name Iteration
79 ///\{
80
81 typedef SetConstIteratorTag<T_, C_> ConstIteratorTag;
83 ConstIterator begin() const PALUDIS_ATTRIBUTE((warn_unused_result));
84 ConstIterator end() const PALUDIS_ATTRIBUTE((warn_unused_result));
85 ConstIterator find(const T_ &) const PALUDIS_ATTRIBUTE((warn_unused_result));
86
87 typedef SetInsertIteratorTag<T_, C_> InserterTag;
89 Inserter inserter();
90
91 ///\}
92
93 ///\name Content information
94 ///\{
95
96 bool empty() const PALUDIS_ATTRIBUTE((warn_unused_result));
97 unsigned size() const PALUDIS_ATTRIBUTE((warn_unused_result));
98 unsigned count(const T_ &) const PALUDIS_ATTRIBUTE((warn_unused_result));
99
100 ///\}
101
102 ///\name Content modification
103 ///\{
104
105 void insert(const T_ &);
106 void erase(const T_ &);
107 void clear();
108
109 ///\}
110 };
111
112 extern template class PALUDIS_VISIBLE Set<std::string>;
113}
114
115#endif
Definition pimp.hh:52
Definition set.hh:51
Definition wrapped_forward_iterator.hh:42
Definition wrapped_output_iterator.hh:38
#define PALUDIS_ATTRIBUTE(x)
Definition attributes.hh:53
#define PALUDIS_VISIBLE
Definition attributes.hh:59
Definition about_metadata-fwd.hh:24
Definition set-fwd.hh:38
Definition set-fwd.hh:41