sequence.hh

Go to the documentation of this file.
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_SEQUENCE_HH
00021 #define PALUDIS_GUARD_PALUDIS_UTIL_SEQUENCE_HH 1
00022 
00023 #include <paludis/util/sequence-fwd.hh>
00024 #include <paludis/util/private_implementation_pattern.hh>
00025 #include <paludis/util/instantiation_policy.hh>
00026 #include <paludis/util/wrapped_forward_iterator-fwd.hh>
00027 #include <paludis/util/wrapped_output_iterator-fwd.hh>
00028 
00029 /** \file
00030  * Declarations for the Sequence<> class.
00031  *
00032  * \ingroup g_data_structures
00033  *
00034  * \section Examples
00035  *
00036  * - None at this time.
00037  */
00038 
00039 namespace paludis
00040 {
00041     /**
00042      * Wrapper around a list, avoiding the need to include standard library
00043      * headers everywhere.
00044      *
00045      * \ingroup g_data_structures
00046      * \since 0.26
00047      * \nosubgrouping
00048      */
00049     template <typename T_>
00050     class PALUDIS_VISIBLE Sequence :
00051         private PrivateImplementationPattern<Sequence<T_> >,
00052         private InstantiationPolicy<Sequence<T_>, instantiation_method::NonCopyableTag>
00053     {
00054         private:
00055             using PrivateImplementationPattern<Sequence<T_> >::_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             Sequence();
00071             ~Sequence();
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 last() const PALUDIS_ATTRIBUTE((warn_unused_result));
00083 
00084             struct ReverseConstIteratorTag;
00085             typedef WrappedForwardIterator<ReverseConstIteratorTag, const T_> ReverseConstIterator;
00086             ReverseConstIterator rbegin() const PALUDIS_ATTRIBUTE((warn_unused_result));
00087             ReverseConstIterator rend() const PALUDIS_ATTRIBUTE((warn_unused_result));
00088 
00089             struct InserterTag;
00090             typedef WrappedOutputIterator<InserterTag, T_> Inserter;
00091             Inserter back_inserter();
00092             Inserter front_inserter();
00093 
00094             ///\}
00095 
00096             ///\name Content information
00097             ///\{
00098 
00099             bool empty() const PALUDIS_ATTRIBUTE((warn_unused_result));
00100 
00101             ///\}
00102 
00103             ///\name Content modification
00104             ///\{
00105 
00106             void push_back(const T_ &);
00107             void push_front(const T_ &);
00108 
00109             void pop_front();
00110             void pop_back();
00111 
00112             template <typename C_>
00113             void sort(const C_ &);
00114 
00115             ///\}
00116 
00117     };
00118 }
00119 
00120 #endif

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