paludis Version 3.0.2
The one true package mangler
wrapped_output_iterator.hh
1/* vim: set sw=4 sts=4 et foldmethod=syntax : */
2
3/*
4 * Copyright (c) 2007, 2009 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_WRAPPED_OUTPUT_ITERATOR_HH
21#define PALUDIS_GUARD_PALUDIS_UTIL_WRAPPED_OUTPUT_ITERATOR_HH 1
22
23#include <paludis/util/wrapped_output_iterator-fwd.hh>
25#include <iterator>
26
27namespace paludis
28{
29 /**
30 * A WrappedOutputIterator is a generic wrapper around an output iterator,
31 * hiding the underlying base iterator.
32 *
33 * \ingroup g_iterator
34 * \since 0.26
35 */
36 template <typename Tag_, typename Value_>
37 class PALUDIS_VISIBLE WrappedOutputIterator
38 {
39 private:
40 WrappedOutputIteratorUnderlyingIteratorHolder * _iter;
41
42 public:
43 typedef Tag_ Tag;
44
45 ///\name Basic operations
46 ///\{
47
48 ~WrappedOutputIterator();
49 WrappedOutputIterator(const WrappedOutputIterator &);
50
51 template <typename T_>
52 WrappedOutputIterator(const T_ &);
53
54 WrappedOutputIterator & operator= (const WrappedOutputIterator &);
55 WrappedOutputIterator & operator= (const Value_ &);
56
57 ///\}
58
59 ///\name Standard library typedefs
60 ///\{
61
62 typedef WrappedOutputIterator value_type;
63 typedef WrappedOutputIterator & reference;
64 typedef WrappedOutputIterator * pointer;
65 typedef std::ptrdiff_t difference_type;
66 typedef std::output_iterator_tag iterator_category;
67
68 ///\}
69
70 ///\name Increment
71 ///\{
72
73 WrappedOutputIterator & operator++ ();
74 WrappedOutputIterator operator++ (int);
75
76 ///\}
77
78 ///\name Dereference
79 ///\{
80
81 reference operator* ();
82
83 ///\}
84
85 ///\name Underlying iterator
86 ///\{
87
88 template <typename T_> T_ & underlying_iterator();
89 template <typename T_> const T_ & underlying_iterator() const;
90
91 ///\}
92 };
93}
94
95#endif
#define PALUDIS_VISIBLE
Definition attributes.hh:59
Definition about_metadata-fwd.hh:24