1 // $Id: ListOptionTypeParser.ih 965 2008-11-18 16:04:20Z pug $
4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
6 // Philipp.Batroff@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.
24 \brief ListOptionTypeParser internal header */
26 #ifndef IH_SENF_Packets_ListOptionTypeParser_
27 #define IH_SENF_Packets_ListOptionTypeParser_ 1
30 #include "ListParser.ih"
32 ///////////////////////////////ih.p////////////////////////////////////////
37 /** \brief Internal: ListPolicy defing the ListOptionTypeParser parser
39 \see \ref ListOptionTypeParser
41 template <class ElementParser, class AuxPolicy>
42 struct ListOptionTypeParser_Policy
45 struct container_policy;
47 typedef PacketParserBase::data_iterator data_iterator;
48 typedef PacketParserBase::state_type state_type;
49 typedef PacketParserBase::size_type size_type;
51 typedef ElementParser element_type;
52 typedef ListParser< ListOptionTypeParser_Policy > parser_type;
53 typedef ListParser_Container< container_policy > container_type;
55 static const size_type init_bytes = 6u + AuxPolicy::aux_bytes;
57 ListOptionTypeParser_Policy();
58 template <class Arg> ListOptionTypeParser_Policy(Arg const & arg);
60 size_type bytes (data_iterator i, state_type s) const;
61 size_type size (data_iterator i, state_type s) const;
62 void init (data_iterator i, state_type s) const;
64 /** \brief Internal: ListOptionTypeParser container/wrapper policy */
65 struct container_policy
68 typedef PacketParserBase::data_iterator data_iterator;
69 typedef PacketParserBase::state_type state_type;
70 typedef PacketParserBase::size_type size_type;
72 typedef ListOptionTypeParser_Policy<ElementParser, AuxPolicy> parser_policy;
73 typedef typename parser_policy::element_type element_type;
74 typedef typename parser_policy::parser_type parser_type;
75 typedef typename parser_policy::container_type container_type;
77 static const size_type init_bytes = parser_policy::init_bytes;
79 container_policy(parser_policy const & p);
81 size_type bytes (data_iterator i, state_type s) const;
82 size_type size (data_iterator i, state_type s) const;
83 void init (data_iterator i, state_type s);
85 void erase (container_type & c, data_iterator p);
86 void insert (container_type & c, data_iterator p);
87 void update (container_type const & c) const;
89 void destruct(container_type & c);
90 void construct(container_type & c);
92 /** \brief Internal: ListOptionTypeParser specific iterator data */
93 struct iterator_data {};
95 data_iterator setBegin (container_type const & c, iterator_data & d) const;
96 data_iterator setEnd (container_type const & c, iterator_data & d) const;
97 void setFromPosition (container_type const & c, iterator_data & d,data_iterator p) const;
99 data_iterator next (container_type const & c, iterator_data & d) const;
100 data_iterator raw (container_type const & c, iterator_data const & d) const;
103 mutable size_type realAux_;
104 mutable size_type container_size_;
110 ///////////////////////////////ih.e////////////////////////////////////////
117 // comment-column: 40
118 // c-file-style: "senf"
119 // indent-tabs-mode: nil
120 // ispell-local-dictionary: "american"
121 // compile-command: "scons -u test"