Fixed whitespace in all files (no tabs)
[senf.git] / Packets / ParseArray.hh
1 // $Id$
2 //
3 // Copyright (C) 2006
4 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
5 // Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
6 //     Stefan Bund <stefan.bund@fokus.fraunhofer.de>
7 //
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.
12 //
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.
17 //
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.
22
23 #ifndef HH_ParseArray_
24 #define HH_ParseArray_ 1
25
26 // Custom includes
27 #include <utility> // for std::pair
28 #include "ParserBase.hh"
29
30 //#include "ParseArray.mpp"
31 ///////////////////////////////hh.p////////////////////////////////////////
32
33 namespace senf {
34
35
36     namespace impl { template <class,class> class Parse_Array_iterator; }
37
38     /* Parse_Array has the external interface of a container class
39      */
40     template <unsigned elements, class Parser, class Iterator=nil, class IPacket=nil>
41     struct Parse_Array : public ParserBase<Iterator,IPacket>
42     {
43         ///////////////////////////////////////////////////////////////////////////
44         // Parser interface
45
46         template <class I=nil, class P=nil>
47         struct rebind { typedef Parse_Array<elements,Parser,I,P> parser; };
48         typedef Iterator byte_iterator;
49
50         Parse_Array();
51         explicit Parse_Array(Iterator const & i);
52
53         static unsigned bytes();
54         bool check(Iterator const & e) const;
55         void init() const;
56
57         ///////////////////////////////////////////////////////////////////////////
58         // Container interface
59
60         typedef typename Parser::template rebind<Iterator>::parser value_type;
61         typedef impl::Parse_Array_iterator<value_type,Iterator> iterator;
62         typedef unsigned size_type;
63         typedef int difference_type;
64         typedef std::pair<iterator,iterator> range_type;
65
66         static size_type size();
67
68         iterator begin() const;
69         iterator end() const;
70         range_type range() const;
71         iterator value() const;
72
73         value_type operator[](difference_type i) const;
74
75         template <class InputIterator>
76         Parse_Array const & operator= (InputIterator const & i);
77     };
78
79 }
80
81 ///////////////////////////////hh.e////////////////////////////////////////
82 //#include "ParseArray.cci"
83 //#include "ParseArray.ct"
84 #include "ParseArray.cti"
85 #endif
86
87 \f
88 // Local Variables:
89 // mode: c++
90 // fill-column: 100
91 // c-file-style: "senf"
92 // indent-tabs-mode: nil
93 // ispell-local-dictionary: "american"
94 // End: