Pack required boost code together.
[xy_vsfilter.git] / src / thirdparty / boost_1_47_0 / boost / archive / iterators / insert_linebreaks.hpp
blob3e504db129adca32f73dea092d84fe2b2232b1f0
1 #ifndef BOOST_ARCHIVE_ITERATORS_INSERT_LINEBREAKS_HPP
2 #define BOOST_ARCHIVE_ITERATORS_INSERT_LINEBREAKS_HPP
4 // MS compatible compilers support #pragma once
5 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
6 # pragma once
7 #endif
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> // for BOOST_DEDUCED_TYPENAME
22 #if defined(BOOST_NO_STDC_NAMESPACE)
23 namespace std{ using ::memcpy; }
24 #endif
26 #include <boost/serialization/pfto.hpp>
28 #include <boost/iterator/iterator_adaptor.hpp>
29 #include <boost/iterator/iterator_traits.hpp>
31 namespace boost {
32 namespace archive {
33 namespace iterators {
35 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
36 // insert line break every N characters
37 template<
38 class Base,
39 int N,
40 class CharType = BOOST_DEDUCED_TYPENAME boost::iterator_value<Base>::type
42 class insert_linebreaks :
43 public iterator_adaptor<
44 insert_linebreaks<Base, N, CharType>,
45 Base,
46 CharType,
47 single_pass_traversal_tag,
48 CharType
51 private:
52 friend class boost::iterator_core_access;
53 typedef iterator_adaptor<
54 insert_linebreaks<Base, N, CharType>,
55 Base,
56 CharType,
57 single_pass_traversal_tag,
58 CharType
59 > super_t;
61 bool equal(const insert_linebreaks<Base, N, CharType> & rhs) const {
62 return
63 // m_count == rhs.m_count
64 // && base_reference() == rhs.base_reference()
65 this->base_reference() == rhs.base_reference()
69 void increment() {
70 if(m_count == N){
71 m_count = 0;
72 return;
74 ++m_count;
75 ++(this->base_reference());
77 CharType dereference() const {
78 if(m_count == N)
79 return '\n';
80 return * (this->base_reference());
82 unsigned int m_count;
83 public:
84 // make composible buy using templated constructor
85 template<class T>
86 insert_linebreaks(BOOST_PFTO_WRAPPER(T) start) :
87 super_t(Base(BOOST_MAKE_PFTO_WRAPPER(static_cast< T >(start)))),
88 m_count(0)
90 // intel 7.1 doesn't like default copy constructor
91 insert_linebreaks(const insert_linebreaks & rhs) :
92 super_t(rhs.base_reference()),
93 m_count(rhs.m_count)
97 } // namespace iterators
98 } // namespace archive
99 } // namespace boost
101 #endif // BOOST_ARCHIVE_ITERATORS_INSERT_LINEBREAKS_HPP