Fix SCons 1.2.0 build failure
[senf.git] / senf / Packets / ListNParser.cti
1 // $Id$
2 //
3 // Copyright (C) 2007
4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
6 //     Stefan Bund <g0dil@berlios.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 /** \file
24     \brief ListNParser inline template implementation */
25
26 #include "ListNParser.ih"
27
28 // Custom includes
29
30 #define prefix_ inline
31 ///////////////////////////////cti.p///////////////////////////////////////
32
33 template <class ElementParser, class AuxPolicy>
34 prefix_ senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::ListNParser_Policy()
35 {}
36
37 template <class ElementParser, class AuxPolicy>
38 template <class Arg>
39 prefix_
40 senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::ListNParser_Policy(Arg const & aux)
41     : AuxPolicy (aux)
42 {}
43
44 template <class ElementParser, class AuxPolicy>
45 prefix_ typename senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::size_type
46 senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::bytes(data_iterator i, state_type s)
47     const
48 {
49     container_type c (parser_type(*this, i, s));
50     return std::distance(i,c.end().raw());
51 }
52
53 template <class ElementParser, class AuxPolicy>
54 prefix_ typename senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::size_type
55 senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::size(data_iterator i, state_type s)
56     const
57 {
58     return AuxPolicy::aux(i,s);
59 }
60
61 template <class ElementParser, class AuxPolicy>
62 prefix_ void senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::init(data_iterator i,
63                                                                              state_type s)
64     const
65 {
66     AuxPolicy::aux(0,i,s);
67 }
68
69 template <class ElementParser, class AuxPolicy>
70 prefix_ void
71 senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::erase(container_type & c,
72                                                                  data_iterator p)
73     const
74 {
75     this->aux(this->aux(c.i(),c.state())-1,c.i(),c.state());
76 }
77
78 template <class ElementParser, class AuxPolicy>
79 prefix_ void
80 senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::insert(container_type & c,
81                                                                   data_iterator p)
82     const
83 {
84     this->aux(this->aux(c.i(),c.state())+1,c.i(),c.state());
85 }
86
87 template <class ElementParser, class AuxPolicy>
88 prefix_ void
89 senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::update(container_type const & c)
90     const
91 {}
92
93 template <class ElementParser, class AuxPolicy>
94 prefix_ typename senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::data_iterator
95 senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::setBegin(container_type const & c,
96                                                                     iterator_data & d)
97     const
98 {
99     d.n_ = this->aux(c.i(),c.state());
100     return d.n_ ? this->adjust(c.i(),c.state()) : c.data().end();
101 }
102
103 template <class ElementParser, class AuxPolicy>
104 prefix_ typename senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::data_iterator
105 senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::setEnd(container_type const & c,
106                                                                   iterator_data & d)
107     const
108 {
109     d.n_ = 0;
110     return c.data().end();
111 }
112
113 template <class ElementParser, class AuxPolicy>
114 prefix_ typename senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::data_iterator
115 senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::next(container_type const & c,
116                                                                 iterator_data & d)
117     const
118 {
119     --d.n_;
120     return d.n_ ? boost::next( container_type::iterator::get(d).i(),
121                                senf::bytes(* container_type::iterator::get(d)) )
122         : c.data().end();
123 }
124
125 ///////////////////////////////cti.e///////////////////////////////////////
126 #undef prefix_
127
128 \f
129 // Local Variables:
130 // mode: c++
131 // fill-column: 100
132 // comment-column: 40
133 // c-file-style: "senf"
134 // indent-tabs-mode: nil
135 // ispell-local-dictionary: "american"
136 // compile-command: "scons -u test"
137 // End: