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 VariantParser non-inline template implementation */
17 #include "VariantParser.ih"
23 //-/////////////////////////////////////////////////////////////////////////////////////////////////
25 template <class AuxPolicy, class Parsers>
27 prefix_ void senf::VariantParser<AuxPolicy,Parsers>::init()
29 size_type oldSize( bytes() );
30 typedef typename boost::mpl::at<parsers, boost::mpl::int_<N> >::type NewParser;
32 if (oldSize <= senf::init_bytes<NewParser>::value) {
33 data_iterator j (i());
34 std::advance(j, oldSize);
35 std::fill(i(), j, 0u);
36 safe_data_iterator safe_i (*this);
37 typename AuxPolicy::WrapperPolicy safeAux (static_cast<AuxPolicy&>(*this));
38 data().insert(j, senf::init_bytes<NewParser>::value - oldSize, 0u);
39 safeAux.aux(N, safe_i, state());
40 NewParser( safeAux.adjust(safe_i, state()), state() ).init();
42 data_iterator j (i());
43 std::advance(j, senf::init_bytes<NewParser>::value);
44 data().erase(j, boost::next(i(), oldSize));
45 std::fill(i(), j, 0u);
46 AuxPolicy::aux(N, i(), state());
47 NewParser(AuxPolicy::adjust(i(), state()), state()).init();
51 //-/////////////////////////////////////////////////////////////////////////////////////////////////
59 // c-file-style: "senf"
60 // indent-tabs-mode: nil
61 // ispell-local-dictionary: "american"
62 // compile-command: "scons -u test"