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 ArrayParser internal header */
17 #ifndef IH_SENF_Packets_ArrayParser_
18 #define IH_SENF_Packets_ArrayParser_ 1
21 #include <boost/iterator/iterator_facade.hpp>
23 //-/////////////////////////////////////////////////////////////////////////////////////////////////
25 /** \brief Internal: Array and Vector iterator
29 This is the iterator type used for both ArrayParser and VectorParser. It is a model of random
32 template <class ElementParser>
33 class senf::detail::ArrayParser_iterator
34 : public boost::iterator_facade< ArrayParser_iterator<ElementParser>,
36 boost::random_access_traversal_tag,
40 ArrayParser_iterator();
41 ArrayParser_iterator(PacketParserBase::data_iterator const & i,
42 PacketParserBase::state_type s);
44 // Needed to elide the []-proxy of iterator_facade
45 ElementParser operator[](int i) const;
47 PacketParserBase::data_iterator raw() const; ///< Return data_iterator
48 /**< Returns the raw data_iterator pointing to the beginning
49 of the current element */
54 friend class boost::iterator_core_access;
56 // iterator_facade interface
58 ElementParser dereference() const;
59 bool equal(ArrayParser_iterator const & other) const;
60 int distance_to(ArrayParser_iterator const & other) const;
65 PacketParserBase::data_iterator i_;
66 PacketParserBase::state_type s_;
69 //-/////////////////////////////////////////////////////////////////////////////////////////////////
76 // c-file-style: "senf"
77 // indent-tabs-mode: nil
78 // ispell-local-dictionary: "american"
79 // compile-command: "scons -u test"