paludis  Version 2.6.0
sequence.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_SEQUENCE_HH
21 #define PALUDIS_GUARD_PALUDIS_UTIL_SEQUENCE_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 
29 /** \file
30  * Declarations for the Sequence<> class.
31  *
32  * \ingroup g_data_structures
33  *
34  * \section Examples
35  *
36  * - None at this time.
37  */
38 
39 namespace paludis
40 {
41  /**
42  * Wrapper around a list, avoiding the need to include standard library
43  * headers everywhere.
44  *
45  * \ingroup g_data_structures
46  * \since 0.26
47  * \nosubgrouping
48  */
49  template <typename T_>
50  class PALUDIS_VISIBLE Sequence
51  {
52  private:
53  Pimp<Sequence<T_> > _imp;
54 
55  public:
56  ///\name Standard library typedefs
57  ///\{
58 
59  typedef T_ value_type;
60  typedef T_ & reference;
61  typedef const T_ & const_reference;
62 
63  ///\}
64 
65  ///\name Basic operations
66  ///\{
67 
68  Sequence();
69  ~Sequence();
70 
71  Sequence(const Sequence &) = delete;
72  Sequence & operator= (const Sequence &) = delete;
73 
74  ///\}
75 
76  ///\name Iteration
77  ///\{
78 
79  typedef SequenceConstIteratorTag<T_> ConstIteratorTag;
80  typedef WrappedForwardIterator<ConstIteratorTag, const T_> ConstIterator;
81  ConstIterator begin() const PALUDIS_ATTRIBUTE((warn_unused_result));
82  ConstIterator end() const PALUDIS_ATTRIBUTE((warn_unused_result));
83  ConstIterator last() const PALUDIS_ATTRIBUTE((warn_unused_result));
84 
85  typedef SequenceReverseConstIteratorTag<T_> ReverseConstIteratorTag;
86  typedef WrappedForwardIterator<ReverseConstIteratorTag, const T_> ReverseConstIterator;
87  ReverseConstIterator rbegin() const PALUDIS_ATTRIBUTE((warn_unused_result));
88  ReverseConstIterator rend() const PALUDIS_ATTRIBUTE((warn_unused_result));
89 
90  typedef SequenceInserterTag<T_> InserterTag;
91  typedef WrappedOutputIterator<InserterTag, T_> Inserter;
92  Inserter back_inserter();
93 
94  ///\}
95 
96  ///\name Content information
97  ///\{
98 
99  bool empty() const PALUDIS_ATTRIBUTE((warn_unused_result));
100 
101  ///\}
102 
103  ///\name Content modification
104  ///\{
105 
106  void push_back(const T_ &);
107  void push_front(const T_ &);
108 
109  void pop_front();
110  void pop_back();
111 
112  template <typename C_>
113  void sort(const C_ &);
114 
115  ///\}
116 
117  };
118 }
119 
120 #endif
Definition: about_metadata-fwd.hh:23
#define PALUDIS_ATTRIBUTE(x)
Definition: attributes.hh:53
#define PALUDIS_VISIBLE
Definition: attributes.hh:59