set.hh

Go to the documentation of this file.
00001 /* vim: set sw=4 sts=4 et foldmethod=syntax : */
00002 
00003 /*
00004  * Copyright (c) 2007 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_SET_HH
00021 #define PALUDIS_GUARD_PALUDIS_UTIL_SET_HH 1
00022 
00023 #include <paludis/util/set-fwd.hh>
00024 #include <paludis/util/attributes.hh>
00025 #include <paludis/util/private_implementation_pattern.hh>
00026 #include <paludis/util/instantiation_policy.hh>
00027 #include <paludis/util/wrapped_forward_iterator-fwd.hh>
00028 #include <paludis/util/wrapped_output_iterator-fwd.hh>
00029 
00030 /** \file
00031  * Declarations for the Set<> class.
00032  *
00033  * \ingroup g_data_structures
00034  *
00035  * \section Examples
00036  *
00037  * - None at this time.
00038  */
00039 
00040 namespace paludis
00041 {
00042     /**
00043      * A wrapper around a set, avoiding the need to include lots of STL bloat
00044      * all over the place.
00045      *
00046      * \ingroup g_data_structures
00047      * \since 0.26
00048      */
00049     template <typename T_, typename C_>
00050     class PALUDIS_VISIBLE Set :
00051         private PrivateImplementationPattern<Set<T_, C_> >,
00052         private InstantiationPolicy<Set<T_, C_>, instantiation_method::NonCopyableTag>
00053     {
00054         private:
00055             using PrivateImplementationPattern<Set<T_, C_> >::_imp;
00056 
00057         public:
00058             ///\name Standard library typedefs
00059             ///\{
00060 
00061             typedef T_ value_type;
00062             typedef T_ & reference;
00063             typedef const T_ & const_reference;
00064 
00065             ///\}
00066 
00067             ///\name Basic operations
00068             ///\{
00069 
00070             Set();
00071             ~Set();
00072 
00073             ///\}
00074 
00075             ///\name Iteration
00076             ///\{
00077 
00078             struct ConstIteratorTag;
00079             typedef WrappedForwardIterator<ConstIteratorTag, const T_> ConstIterator;
00080             ConstIterator begin() const PALUDIS_ATTRIBUTE((warn_unused_result));
00081             ConstIterator end() const PALUDIS_ATTRIBUTE((warn_unused_result));
00082             ConstIterator find(const T_ &) const PALUDIS_ATTRIBUTE((warn_unused_result));
00083 
00084             struct InserterTag;
00085             typedef WrappedOutputIterator<InserterTag, T_> Inserter;
00086             Inserter inserter();
00087 
00088             ///\}
00089 
00090             ///\name Content information
00091             ///\{
00092 
00093             bool empty() const PALUDIS_ATTRIBUTE((warn_unused_result));
00094             unsigned size() const PALUDIS_ATTRIBUTE((warn_unused_result));
00095             unsigned count(const T_ &) const PALUDIS_ATTRIBUTE((warn_unused_result));
00096 
00097             ///\}
00098 
00099             ///\name Content modification
00100             ///\{
00101 
00102             void insert(const T_ &);
00103             void erase(const T_ &);
00104             void clear();
00105 
00106             ///\}
00107     };
00108 }
00109 
00110 #endif

Generated on Mon Sep 21 10:36:08 2009 for paludis by  doxygen 1.5.4