4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
6 // The contents of this file are subject to the Fraunhofer FOKUS Public License
7 // Version 1.0 (the "License"); you may not use this file except in compliance
8 // with the License. You may obtain a copy of the License at
9 // http://senf.berlios.de/license.html
11 // The Fraunhofer FOKUS Public License Version 1.0 is based on,
12 // but modifies the Mozilla Public License Version 1.1.
13 // See the full license text for the amendments.
15 // Software distributed under the License is distributed on an "AS IS" basis,
16 // WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
17 // for the specific language governing rights and limitations under the License.
19 // The Original Code is Fraunhofer FOKUS code.
21 // The Initial Developer of the Original Code is Fraunhofer-Gesellschaft e.V.
22 // (registered association), Hansastraße 27 c, 80686 Munich, Germany.
23 // All Rights Reserved.
26 // Philipp Batroff <pug@berlios.de>
29 \brief ListOptionTypeParser internal header */
31 #ifndef IH_SENF_Packets_ListOptionTypeParser_
32 #define IH_SENF_Packets_ListOptionTypeParser_ 1
35 #include <senf/Packets/ListParser.ih>
37 //-/////////////////////////////////////////////////////////////////////////////////////////////////
42 /** \brief Internal: ListPolicy defing the ListOptionTypeParser parser
44 \see IPv6HopByHopOptionsPacketParser::ListOptionTypeParser
46 template <class ElementParser, class AuxPolicy>
47 struct ListOptionTypeParser_Policy
50 struct container_policy;
52 typedef PacketParserBase::data_iterator data_iterator;
53 typedef PacketParserBase::state_type state_type;
54 typedef PacketParserBase::size_type size_type;
56 typedef ElementParser element_type;
57 typedef ListParser< ListOptionTypeParser_Policy > parser_type;
58 typedef ListParser_Container< container_policy > container_type;
60 static const size_type init_bytes = 6u + AuxPolicy::aux_bytes;
62 ListOptionTypeParser_Policy();
63 template <class Arg> ListOptionTypeParser_Policy(Arg const & arg);
65 size_type bytes (data_iterator i, state_type s) const;
66 size_type size (data_iterator i, state_type s) const;
67 void init (data_iterator i, state_type s) const;
69 /** \brief Internal: ListOptionTypeParser container/wrapper policy */
70 struct container_policy
73 typedef PacketParserBase::data_iterator data_iterator;
74 typedef PacketParserBase::state_type state_type;
75 typedef PacketParserBase::size_type size_type;
77 typedef ListOptionTypeParser_Policy<ElementParser, AuxPolicy> parser_policy;
78 typedef typename parser_policy::element_type element_type;
79 typedef typename parser_policy::parser_type parser_type;
80 typedef typename parser_policy::container_type container_type;
82 static const size_type init_bytes = parser_policy::init_bytes;
84 container_policy(parser_policy const & p);
86 size_type bytes (data_iterator i, state_type s) const;
87 size_type size (data_iterator i, state_type s) const;
88 void init (data_iterator i, state_type s);
90 void erase (container_type & c, data_iterator p);
91 void insert (container_type & c, data_iterator p);
92 void update (container_type const & c) const;
94 void destruct(container_type & c);
95 void construct(container_type & c);
97 /** \brief Internal: ListOptionTypeParser specific iterator data */
98 struct iterator_data {};
100 data_iterator setBegin (container_type const & c, iterator_data & d) const;
101 data_iterator setEnd (container_type const & c, iterator_data & d) const;
102 void setFromPosition (container_type const & c, iterator_data & d,data_iterator p) const;
104 data_iterator next (container_type const & c, iterator_data & d) const;
105 data_iterator raw (container_type const & c, iterator_data const & d) const;
108 mutable size_type realAux_;
109 mutable size_type container_size_;
115 //-/////////////////////////////////////////////////////////////////////////////////////////////////
122 // comment-column: 40
123 // c-file-style: "senf"
124 // indent-tabs-mode: nil
125 // ispell-local-dictionary: "american"
126 // compile-command: "scons -u test"