00001 /* vim: set sw=4 sts=4 et foldmethod=syntax : */ 00002 00003 /* 00004 * Copyright (c) 2007, 2009 Ciaran McCreesh 00005 * 00006 * This file is part of the Paludis package manager. Paludis is free software; 00007 * you can redistribute it and/or modify it under the terms of the GNU General 00008 * Public License version 2, as published by the Free Software Foundation. 00009 * 00010 * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY 00011 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00012 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 00013 * details. 00014 * 00015 * You should have received a copy of the GNU General Public License along with 00016 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 00017 * Place, Suite 330, Boston, MA 02111-1307 USA 00018 */ 00019 00020 #ifndef PALUDIS_GUARD_PALUDIS_UTIL_WRAPPED_OUTPUT_ITERATOR_HH 00021 #define PALUDIS_GUARD_PALUDIS_UTIL_WRAPPED_OUTPUT_ITERATOR_HH 1 00022 00023 #include <paludis/util/wrapped_output_iterator-fwd.hh> 00024 #include <paludis/util/attributes.hh> 00025 #include <iterator> 00026 00027 namespace paludis 00028 { 00029 /** 00030 * A WrappedOutputIterator is a generic wrapper around an output iterator, 00031 * hiding the underlying base iterator. 00032 * 00033 * \ingroup g_iterator 00034 * \since 0.26 00035 */ 00036 template <typename Tag_, typename Value_> 00037 class PALUDIS_VISIBLE WrappedOutputIterator 00038 { 00039 private: 00040 struct Base; 00041 template <typename T_> struct BaseImpl; 00042 00043 Base * _base; 00044 00045 public: 00046 ///\name Basic operations 00047 ///\{ 00048 00049 WrappedOutputIterator(); 00050 ~WrappedOutputIterator(); 00051 WrappedOutputIterator(const WrappedOutputIterator &); 00052 00053 template <typename T_> 00054 WrappedOutputIterator(const T_ &); 00055 00056 WrappedOutputIterator & operator= (const WrappedOutputIterator &); 00057 WrappedOutputIterator & operator= (const Value_ &); 00058 00059 ///\} 00060 00061 ///\name Standard library typedefs 00062 ///\{ 00063 00064 typedef WrappedOutputIterator value_type; 00065 typedef WrappedOutputIterator & reference; 00066 typedef WrappedOutputIterator * pointer; 00067 typedef std::ptrdiff_t difference_type; 00068 typedef std::output_iterator_tag iterator_category; 00069 00070 ///\} 00071 00072 ///\name Increment 00073 ///\{ 00074 00075 WrappedOutputIterator & operator++ (); 00076 WrappedOutputIterator operator++ (int); 00077 00078 ///\} 00079 00080 ///\name Dereference 00081 ///\{ 00082 00083 pointer operator-> (); 00084 reference operator* (); 00085 00086 ///\} 00087 }; 00088 } 00089 00090 #endif