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 // Definition of non-inline template functions
25 #include "ParseListS.ih"
31 ///////////////////////////////ct.p////////////////////////////////////////
33 template <class Parser, class Sentinel, class Iterator, class IPacket>
34 prefix_ unsigned senf::Parse_ListS<Parser,Sentinel,Iterator,IPacket>::bytes()
42 // The sentinel is not part of the range
43 // but it's part of the list !!
47 template <class Parser, class Sentinel, class Iterator, class IPacket>
49 senf::Parse_ListS<Parser,Sentinel,Iterator,IPacket>::check(Iterator const & e)
52 byte_iterator i (this->i());
55 if (!v.check(e)) return false;
56 if (sentinel::check(v)) return true;
57 size_type s (v.bytes());
58 if (s==0) return false;
63 template <class Parser, class Sentinel, class Iterator, class IPacket>
64 prefix_ void senf::Parse_ListS<Parser,Sentinel,Iterator,IPacket>::init()
71 // The sentinel is not part of the range
72 // but it's part of the list !!
76 ///////////////////////////////////////////////////////////////////////////
77 // senf::Parse_ListS_wrapper<Parser,Sentinel,Container>
79 template <class Parser, class Sentinel, class Container>
80 template <class Value>
82 senf::Parse_ListS_wrapper<Parser,Sentinel,Container>::insert(iterator pos,
85 size_type ix (pos.raw()-container_.begin());
86 container_.insert(pos.raw(),t.bytes(),0);
87 Parser(container_.begin()+ix).value(t);
90 template <class Parser, class Sentinel, class Container>
91 template <class Value>
93 senf::Parse_ListS_wrapper<Parser,Sentinel,Container>::insert(iterator pos, size_type n,
96 size_type ix (pos.raw()-container_.begin());
97 container_.insert(pos.raw(),n*t.bytes(),0);
98 typename Container::iterator i (container_.begin()+ix);
103 template <class Parser, class Sentinel, class Container>
104 template <class InputIterator>
106 senf::Parse_ListS_wrapper<Parser,Sentinel,Container>::insert(iterator pos,
110 /** \todo Optimize this for random-access and multi-pass iterators */
111 for (;f!=l;++f,++pos) insert(pos,*f);
114 ///////////////////////////////ct.e////////////////////////////////////////
121 // c-file-style: "senf"
122 // indent-tabs-mode: nil
123 // ispell-local-dictionary: "american"