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 // Stefan Bund <g0dil@berlios.de>
29 \brief ListParser internal header */
31 #ifndef IH_SENF_Packets_ListParser_
32 #define IH_SENF_Packets_ListParser_ 1
35 #include <boost/iterator/iterator_facade.hpp>
37 //-/////////////////////////////////////////////////////////////////////////////////////////////////
42 /** \brief Internal: Iterator used by ListParser
46 template <class Container>
47 class ListParser_Iterator
48 : public boost::iterator_facade< ListParser_Iterator<Container>,
49 typename Container::value_type,
50 boost::forward_traversal_tag,
51 typename Container::value_type >,
53 private Container::policy::iterator_data
57 typedef typename Container::value_type value_type;
59 ListParser_Iterator();
60 explicit ListParser_Iterator(Container const & c);
62 PacketParserBase::data_iterator raw() const;
63 PacketParserBase::data_iterator i() const;
65 static ListParser_Iterator & get(typename Container::policy::iterator_data & d);
66 static ListParser_Iterator const & get(typename Container::policy::iterator_data const & d);
69 friend class boost::iterator_core_access;
70 friend class ListParser_Container<typename Container::policy>;
72 value_type dereference() const;
73 bool equal(ListParser_Iterator const & other) const;
76 PacketParserBase::data_iterator i_;
82 template <class ElementParser, class AuxPolicy, class AuxTag>
83 struct ListParserPolicy
86 template <class ElementParser>
87 struct ListParserTraits
89 template <class AuxPolicy, class AuxTag>
91 typedef senf::ListParser<
92 typename ListParserPolicy<ElementParser, AuxPolicy, AuxTag>::type > type;
96 # define SENF_PARSER_LIST_I(access, name, size, elt_type) \
97 SENF_PARSER_REQUIRE_VAR(list) \
98 SENF_PARSER_COLLECTION_I( access, \
101 senf::detail::ListParserTraits<elt_type> )
107 //-/////////////////////////////////////////////////////////////////////////////////////////////////
114 // comment-column: 40
115 // c-file-style: "senf"
116 // indent-tabs-mode: nil
117 // ispell-local-dictionary: "american"
118 // compile-command: "scons -u test"