1 #ifndef BOOST_ARCHIVE_ITERATORS_INSERT_LINEBREAKS_HPP
2 #define BOOST_ARCHIVE_ITERATORS_INSERT_LINEBREAKS_HPP
4 // MS compatible compilers support #pragma once
9 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
10 // insert_linebreaks.hpp
12 // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
13 // Use, modification and distribution is subject to the Boost Software
14 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
15 // http://www.boost.org/LICENSE_1_0.txt)
17 // See http://www.boost.org for updates, documentation, and revision history.
19 #include <boost/assert.hpp>
21 #include <boost/config.hpp>
22 #if defined(BOOST_NO_STDC_NAMESPACE)
23 namespace std{ using ::memcpy; }
26 #include <boost/iterator/iterator_adaptor.hpp>
27 #include <boost/iterator/iterator_traits.hpp>
33 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
34 // insert line break every N characters
38 class CharType = typename boost::iterator_value<Base>::type
40 class insert_linebreaks :
41 public iterator_adaptor<
42 insert_linebreaks<Base, N, CharType>,
45 single_pass_traversal_tag,
50 friend class boost::iterator_core_access;
51 typedef iterator_adaptor<
52 insert_linebreaks<Base, N, CharType>,
55 single_pass_traversal_tag,
59 bool equal(const insert_linebreaks<Base, N, CharType> & rhs) const {
61 // m_count == rhs.m_count
62 // && base_reference() == rhs.base_reference()
63 this->base_reference() == rhs.base_reference()
73 ++(this->base_reference());
75 CharType dereference() const {
78 return * (this->base_reference());
82 // make composible buy using templated constructor
84 insert_linebreaks(T start) :
85 super_t(Base(static_cast< T >(start))),
88 // intel 7.1 doesn't like default copy constructor
89 insert_linebreaks(const insert_linebreaks & rhs) :
90 super_t(rhs.base_reference()),
95 } // namespace iterators
96 } // namespace archive
99 #endif // BOOST_ARCHIVE_ITERATORS_INSERT_LINEBREAKS_HPP