File indexing completed on 2025-01-30 09:33:00
0001 #ifndef BOOST_ARCHIVE_ITERATORS_UNESCAPE_HPP
0002 #define BOOST_ARCHIVE_ITERATORS_UNESCAPE_HPP
0003
0004
0005 #if defined(_MSC_VER)
0006 # pragma once
0007 #endif
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 #include <boost/assert.hpp>
0020
0021 #include <boost/iterator/iterator_adaptor.hpp>
0022 #include <boost/pointee.hpp>
0023
0024 namespace boost {
0025 namespace archive {
0026 namespace iterators {
0027
0028
0029
0030
0031 template<class Derived, class Base>
0032 class unescape
0033 : public boost::iterator_adaptor<
0034 unescape<Derived, Base>,
0035 Base,
0036 typename pointee<Base>::type,
0037 single_pass_traversal_tag,
0038 typename pointee<Base>::type
0039 >
0040 {
0041 friend class boost::iterator_core_access;
0042 typedef typename boost::iterator_adaptor<
0043 unescape<Derived, Base>,
0044 Base,
0045 typename pointee<Base>::type,
0046 single_pass_traversal_tag,
0047 typename pointee<Base>::type
0048 > super_t;
0049
0050 typedef unescape<Derived, Base> this_t;
0051 public:
0052 typedef typename this_t::value_type value_type;
0053 typedef typename this_t::reference reference;
0054 private:
0055 value_type dereference_impl() {
0056 if(! m_full){
0057 m_current_value = static_cast<Derived *>(this)->drain();
0058 m_full = true;
0059 }
0060 return m_current_value;
0061 }
0062
0063 reference dereference() const {
0064 return const_cast<this_t *>(this)->dereference_impl();
0065 }
0066
0067 value_type m_current_value;
0068 bool m_full;
0069
0070 void increment(){
0071 ++(this->base_reference());
0072 dereference_impl();
0073 m_full = false;
0074 }
0075
0076 public:
0077
0078 unescape(Base base) :
0079 super_t(base),
0080 m_full(false)
0081 {}
0082
0083 };
0084
0085 }
0086 }
0087 }
0088
0089 #endif