Back to home page

EIC code displayed by LXR

 
 

    


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 // MS compatible compilers support #pragma once
0005 #if defined(_MSC_VER)
0006 # pragma once
0007 #endif
0008 
0009 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
0010 // unescape.hpp
0011 
0012 // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
0013 // Use, modification and distribution is subject to the Boost Software
0014 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0015 // http://www.boost.org/LICENSE_1_0.txt)
0016 
0017 //  See http://www.boost.org for updates, documentation, and revision history.
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 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
0029 // class used by text archives to translate char strings to wchar_t
0030 // strings of the currently selected locale
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 } // namespace iterators
0086 } // namespace archive
0087 } // namespace boost
0088 
0089 #endif // BOOST_ARCHIVE_ITERATORS_UNESCAPE_HPP