2 // Copyright (c) 2020 Fraunhofer Institute for Applied Information Technology (FIT)
3 // Network Research Group (NET)
4 // Schloss Birlinghoven, 53754 Sankt Augustin, GERMANY
5 // Contact: support@wiback.org
7 // This file is part of the SENF code tree.
8 // It is licensed under the 3-clause BSD License (aka New BSD License).
9 // See LICENSE.txt in the top level directory for details or visit
10 // https://opensource.org/licenses/BSD-3-Clause
15 \brief ListParser internal header */
17 #ifndef IH_SENF_Packets_ListParser_
18 #define IH_SENF_Packets_ListParser_ 1
21 #include <boost/iterator/iterator_facade.hpp>
23 //-/////////////////////////////////////////////////////////////////////////////////////////////////
28 /** \brief Internal: Iterator used by ListParser
32 template <class Container>
33 class ListParser_Iterator
34 : public boost::iterator_facade< ListParser_Iterator<Container>,
35 typename Container::value_type,
36 boost::forward_traversal_tag,
37 typename Container::value_type >,
39 private Container::policy::iterator_data
43 typedef typename Container::value_type value_type;
45 ListParser_Iterator();
46 explicit ListParser_Iterator(Container const & c);
48 PacketParserBase::data_iterator raw() const;
49 PacketParserBase::data_iterator i() const;
51 static ListParser_Iterator & get(typename Container::policy::iterator_data & d);
52 static ListParser_Iterator const & get(typename Container::policy::iterator_data const & d);
55 friend class boost::iterator_core_access;
56 friend class ListParser_Container<typename Container::policy>;
58 value_type dereference() const;
59 bool equal(ListParser_Iterator const & other) const;
62 PacketParserBase::data_iterator i_;
68 template <class ElementParser, class AuxPolicy, class AuxTag>
69 struct ListParserPolicy
72 template <class ElementParser, typename Enable=void>
73 struct ListParserTraits
75 template <class AuxPolicy, class AuxTag>
77 typedef senf::ListParser<
78 typename ListParserPolicy<ElementParser, AuxPolicy, AuxTag>::type> type;
82 # define SENF_PARSER_LIST_I(access, name, size, elt_type) \
83 SENF_PARSER_REQUIRE_VAR(list) \
84 SENF_PARSER_COLLECTION_I( access, \
87 senf::detail::ListParserTraits<elt_type> )
93 //-/////////////////////////////////////////////////////////////////////////////////////////////////
100 // comment-column: 40
101 // c-file-style: "senf"
102 // indent-tabs-mode: nil
103 // ispell-local-dictionary: "american"
104 // compile-command: "scons -u test"