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 ListNParser internal header */
17 #ifndef IH_SENF_Packets_ListNParser_
18 #define IH_SENF_Packets_ListNParser_ 1
21 #include "ListParser.ih"
23 //-/////////////////////////////////////////////////////////////////////////////////////////////////
28 /** \brief Internal: ListPolicy defining the ListNParser parser
32 template <class ElementParser, class AuxPolicy>
33 struct ListNParser_Policy
36 typedef ListNParser_Policy<
37 ElementParser, typename AuxPolicy::ParserPolicy> parser_policy;
38 typedef ListNParser_Policy<
39 ElementParser, typename AuxPolicy::WrapperPolicy> container_policy;
40 typedef PacketParserBase::data_iterator data_iterator;
41 typedef PacketParserBase::state_type state_type;
42 typedef PacketParserBase::size_type size_type;
43 typedef ElementParser element_type;
44 typedef ListParser<parser_policy> parser_type;
45 typedef ListParser_Container<container_policy> container_type;
47 static const size_type init_bytes = AuxPolicy::aux_bytes;
50 template <class Arg> ListNParser_Policy(Arg const & aux);
51 ListNParser_Policy(parser_policy const & policy);
53 size_type bytes (data_iterator i, state_type s) const;
54 size_type size (data_iterator i, state_type s) const;
55 void init (data_iterator i, state_type s) const;
57 void construct (container_type & c) const;
58 void destruct (container_type & c) const;
59 void erase (container_type & c, data_iterator p) const;
60 void insert (container_type & c, data_iterator p) const;
61 void update (container_type const & c) const;
63 /** Internal: ListNParser iterator specific data */
64 struct iterator_data {
68 data_iterator setBegin (container_type const & c, iterator_data & d) const;
69 data_iterator setEnd (container_type const & c, iterator_data & d) const;
70 void setFromPosition (container_type const & c, iterator_data & d, data_iterator p) const;
71 data_iterator next (container_type const & c, iterator_data & d) const;
72 data_iterator raw (container_type const & c, iterator_data const & d) const;
77 template <class ElementParser, class AuxPolicy>
78 struct ListParserPolicy<ElementParser, AuxPolicy, senf::detail::auxtag::none>
80 typedef ListNParser_Policy<ElementParser, AuxPolicy> type;
83 template <class ElementParser, class AuxPolicy, class Transform>
84 struct ListParserPolicy<ElementParser, AuxPolicy,
85 senf::detail::auxtag::transform<Transform,
86 senf::detail::auxtag::none> >
88 typedef ListNParser_Policy< ElementParser,
89 TransformAuxParserPolicy<AuxPolicy, Transform> > type;
96 //-/////////////////////////////////////////////////////////////////////////////////////////////////
103 // comment-column: 40
104 // c-file-style: "senf"
105 // indent-tabs-mode: nil
106 // ispell-local-dictionary: "american"
107 // compile-command: "scons -u test"