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 inline template implementation */
17 #include "ListNParser.ih"
21 #define prefix_ inline
22 //-/////////////////////////////////////////////////////////////////////////////////////////////////
24 template <class ElementParser, class AuxPolicy>
25 prefix_ senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::ListNParser_Policy()
28 template <class ElementParser, class AuxPolicy>
29 prefix_ senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::
30 ListNParser_Policy(parser_policy const & policy)
34 template <class ElementParser, class AuxPolicy>
37 senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::ListNParser_Policy(Arg const & aux)
41 template <class ElementParser, class AuxPolicy>
42 prefix_ typename senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::size_type
43 senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::bytes(data_iterator i, state_type s)
46 container_type c (parser_type(*this, i, s));
47 return std::distance(i,c.end().raw());
50 template <class ElementParser, class AuxPolicy>
51 prefix_ typename senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::size_type
52 senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::size(data_iterator i, state_type s)
55 return AuxPolicy::aux(i,s);
58 template <class ElementParser, class AuxPolicy>
59 prefix_ void senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::init(data_iterator i,
63 AuxPolicy::aux(0,i,s);
66 template <class ElementParser, class AuxPolicy>
68 senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::construct(container_type & c)
72 template <class ElementParser, class AuxPolicy>
74 senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::destruct(container_type & c)
78 template <class ElementParser, class AuxPolicy>
80 senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::erase(container_type & c,
84 this->aux(this->aux(c.i(),c.state())-1,c.i(),c.state());
87 template <class ElementParser, class AuxPolicy>
89 senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::insert(container_type & c,
93 this->aux(this->aux(c.i(),c.state())+1,c.i(),c.state());
96 template <class ElementParser, class AuxPolicy>
98 senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::update(container_type const & c)
102 template <class ElementParser, class AuxPolicy>
103 prefix_ typename senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::data_iterator
104 senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::setBegin(container_type const & c,
108 d.n_ = this->aux(c.i(),c.state());
109 return d.n_ ? this->adjust(c.i(),c.state()) : c.data().end();
112 template <class ElementParser, class AuxPolicy>
113 prefix_ typename senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::data_iterator
114 senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::setEnd(container_type const & c,
119 return c.data().end();
122 template <class ElementParser, class AuxPolicy>
123 prefix_ typename senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::data_iterator
124 senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::next(container_type const & c,
129 return d.n_ ? boost::next( container_type::iterator::get(d).i(),
130 senf::bytes(* container_type::iterator::get(d)) )
134 //-/////////////////////////////////////////////////////////////////////////////////////////////////
141 // comment-column: 40
142 // c-file-style: "senf"
143 // indent-tabs-mode: nil
144 // ispell-local-dictionary: "american"
145 // compile-command: "scons -u test"