4 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
5 // Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
6 // Stefan Bund <stefan.bund@fokus.fraunhofer.de>
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the
20 // Free Software Foundation, Inc.,
21 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 #ifndef HH_ParseListS_
24 #define HH_ParseListS_ 1
27 #include <utility> // for std::pair
28 #include <boost/iterator/iterator_facade.hpp>
29 #include <boost/utility.hpp> // for boost::noncopyable
30 #include "ParserBase.hh"
32 //#include "ParseListS.mpp"
33 ///////////////////////////////hh.p////////////////////////////////////////
38 template <class Parser, class Sentinel, class Container> class Parse_ListS_wrapper;
40 template <class Parser, class Sentinel, class Container> class Parse_ListS_iterator;
43 template <class Parser, class Sentinel, class Iterator=nil, class IPacket=nil>
44 struct Parse_ListS : public ParserBase<Iterator,IPacket>
46 ///////////////////////////////////////////////////////////////////////////
49 template <class I=nil, class P=nil>
50 struct rebind { typedef Parse_ListS<Parser,Sentinel,I,P> parser; };
51 typedef Iterator byte_iterator;
54 Parse_ListS(Iterator const & i);
56 unsigned bytes() const;
57 bool check(Iterator const & e) const;
60 ///////////////////////////////////////////////////////////////////////////
61 // Container interface
63 typedef typename Parser::template rebind<Iterator>::parser value_type;
64 typedef Sentinel sentinel;
65 typedef impl::Parse_ListS_iterator<value_type,sentinel,byte_iterator> iterator;
66 typedef unsigned size_type;
67 typedef int difference_type;
68 typedef std::pair<iterator,iterator> range_type;
70 template <class Container>
71 struct wrapper { typedef Parse_ListS_wrapper<value_type, Sentinel, Container> t; };
73 size_type size() const;
76 iterator begin() const;
78 range_type range() const;
79 range_type value() const;
82 template <class P, class S, class C> friend class Parse_ListS_wrapper;
87 Holds a reference to the container !
89 template <class Parser, class Sentinel, class Container>
90 class Parse_ListS_wrapper
91 : public boost::noncopyable
94 ///////////////////////////////////////////////////////////////////////////
97 typedef Container container;
98 typedef Sentinel sentinel;
99 typedef typename Parser::byte_iterator byte_iterator;
100 typedef Parser value_type;
101 typedef impl::Parse_ListS_iterator<value_type,sentinel,byte_iterator> iterator;
102 typedef unsigned size_type;
103 typedef int difference_type;
104 typedef std::pair<iterator,iterator> range_type;
106 ///////////////////////////////////////////////////////////////////////////
107 ///\name Structors and default members
110 template <class P, class S, class I, class IP>
111 Parse_ListS_wrapper(Parse_ListS<P,S,I,IP> const & list, Container & container);
113 // no default constructor
115 // default destructor
116 // no conversion constructors
119 ///////////////////////////////////////////////////////////////////////////
123 size_type size() const;
126 iterator begin() const;
127 iterator end() const;
128 range_type range() const;
131 ///////////////////////////////////////////////////////////////////////////
135 template <class Value> void insert(iterator pos, Value const & t);
136 template <class Value> void insert(iterator pos, size_type n, Value const & t);
137 template <class InputIterator> void insert(iterator pos, InputIterator f, InputIterator l);
139 void erase(iterator pos, size_type n=1);
140 void erase(iterator f, iterator l);
150 Container & container_;
155 ///////////////////////////////hh.e////////////////////////////////////////
156 //#include "ParseListS.cci"
157 #include "ParseListS.ct"
158 #include "ParseListS.cti"
164 // c-file-style: "satcom"