4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
6 // Stefan Bund <g0dil@berlios.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.
24 \brief ListNParser internal header */
26 #ifndef IH_SENF_Packets_ListNParser_
27 #define IH_SENF_Packets_ListNParser_ 1
30 #include "ListParser.ih"
32 //-/////////////////////////////////////////////////////////////////////////////////////////////////
37 /** \brief Internal: ListPolicy defining the ListNParser parser
41 template <class ElementParser, class AuxPolicy>
42 struct ListNParser_Policy
45 typedef ListNParser_Policy<
46 ElementParser, typename AuxPolicy::ParserPolicy> parser_policy;
47 typedef ListNParser_Policy<
48 ElementParser, typename AuxPolicy::WrapperPolicy> container_policy;
49 typedef PacketParserBase::data_iterator data_iterator;
50 typedef PacketParserBase::state_type state_type;
51 typedef PacketParserBase::size_type size_type;
52 typedef ElementParser element_type;
53 typedef ListParser<parser_policy> parser_type;
54 typedef ListParser_Container<container_policy> container_type;
56 static const size_type init_bytes = AuxPolicy::aux_bytes;
59 template <class Arg> ListNParser_Policy(Arg const & aux);
60 ListNParser_Policy(parser_policy const & policy);
62 size_type bytes (data_iterator i, state_type s) const;
63 size_type size (data_iterator i, state_type s) const;
64 void init (data_iterator i, state_type s) const;
66 void construct (container_type & c) const;
67 void destruct (container_type & c) const;
68 void erase (container_type & c, data_iterator p) const;
69 void insert (container_type & c, data_iterator p) const;
70 void update (container_type const & c) const;
72 /** Internal: ListNParser iterator specific data */
73 struct iterator_data {
77 data_iterator setBegin (container_type const & c, iterator_data & d) const;
78 data_iterator setEnd (container_type const & c, iterator_data & d) const;
79 void setFromPosition (container_type const & c, iterator_data & d, data_iterator p) const;
80 data_iterator next (container_type const & c, iterator_data & d) const;
81 data_iterator raw (container_type const & c, iterator_data const & d) const;
86 template <class ElementParser, class AuxPolicy>
87 struct ListParserPolicy<ElementParser, AuxPolicy, senf::detail::auxtag::none>
89 typedef ListNParser_Policy<ElementParser, AuxPolicy> type;
92 template <class ElementParser, class AuxPolicy, class Transform>
93 struct ListParserPolicy<ElementParser, AuxPolicy,
94 senf::detail::auxtag::transform<Transform,
95 senf::detail::auxtag::none> >
97 typedef ListNParser_Policy< ElementParser,
98 TransformAuxParserPolicy<AuxPolicy, Transform> > type;
105 //-/////////////////////////////////////////////////////////////////////////////////////////////////
112 // comment-column: 40
113 // c-file-style: "senf"
114 // indent-tabs-mode: nil
115 // ispell-local-dictionary: "american"
116 // compile-command: "scons -u test"