ListBParser.ct
Go to the documentation of this file.
1 //
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
6 //
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
11 //
12 
13 
14 /** \file
15  \brief ListBParser non-inline template implementation */
16 
17 #include "ListBParser.ih"
18 
19 // Custom includes
20 
21 #define prefix_
22 //-/////////////////////////////////////////////////////////////////////////////////////////////////
23 
24 //-/////////////////////////////////////////////////////////////////////////////////////////////////
25 // senf::detail::ListBParser_Policy<ElementParser,AuxPolicy>::container_policy
26 
27 template <class ElementParser, class AuxPolicy>
28 prefix_
29 senf::detail::ListBParser_Policy<ElementParser,AuxPolicy>::container_policy::
30 container_policy(parser_policy const & p)
31  : AuxPolicy::WrapperPolicy (p)
32 {
33  parser_type selfp (parser_type::get(p));
34  size_type totalsz (selfp.bytes());
35  data_iterator const e (selfp.i(totalsz));
36  data_iterator i (AuxPolicy::WrapperPolicy::adjust(selfp.i(), selfp.state()));
37  n_ = 0;
38  while (i!=e) {
39  ElementParser p (i,selfp.state());
40  size_type sz (senf::bytes(p));
41  SENF_ASSERT(sz, "Broken element parser: reports size of 0 bytes");
42  i = p.i(sz);
43  ++ n_;
44  }
45  container_size_ = selfp.data().size();
46 }
47 
48 //-/////////////////////////////////////////////////////////////////////////////////////////////////
49 #undef prefix_
50 
51 
52 // Local Variables:
53 // mode: c++
54 // fill-column: 100
55 // comment-column: 40
56 // c-file-style: "senf"
57 // indent-tabs-mode: nil
58 // ispell-local-dictionary: "american"
59 // compile-command: "scons -u test"
60 // End: