auto_unit_test.ih
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 auto_unit_test internal header */
16 
17 #ifndef IH_SENF_senf_Utils_auto_unit_test_
18 #define IH_SENF_senf_Utils_auto_unit_test_ 1
19 
20 // Custom includes
21 #include <iterator>
22 #include <boost/iterator/iterator_adaptor.hpp>
23 
24 //-/////////////////////////////////////////////////////////////////////////////////////////////////
25 
26 namespace senf {
27 namespace test {
28 namespace detail {
29 
30  template <class Type, class Iterator>
31  struct ConvertingIterator
32  : public boost::iterator_adaptor<
33  ConvertingIterator<Type, Iterator>, Iterator, Type, boost::use_default, Type>
34  {
35  typedef boost::iterator_adaptor<
36  ConvertingIterator<Type, Iterator>, Iterator, Type, boost::use_default, Type> Base;
37  ConvertingIterator(Iterator i) : Base (i) {}
38  };
39 
40  template <class Iterator, class vt = typename std::iterator_traits<Iterator>::value_type>
41  struct NoCharIterator
42  { typedef Iterator type; };
43 
44  template <class Iterator>
45  struct NoCharIterator<Iterator, char>
46  { typedef ConvertingIterator<int,Iterator> type; };
47 
48  template <class Iterator>
49  struct NoCharIterator<Iterator, signed char>
50  { typedef ConvertingIterator<int,Iterator> type; };
51 
52  template <class Iterator>
53  struct NoCharIterator<Iterator, unsigned char>
54  { typedef ConvertingIterator<unsigned,Iterator> type; };
55 
56 }}}
57 
58 //-/////////////////////////////////////////////////////////////////////////////////////////////////
59 #endif
60 
61 
62 // Local Variables:
63 // mode: c++
64 // fill-column: 100
65 // comment-column: 40
66 // c-file-style: "senf"
67 // indent-tabs-mode: nil
68 // ispell-local-dictionary: "american"
69 // compile-command: "scons -u test"
70 // End: