Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/generic/include/boost/archive/iterators/unescape.hpp @ 16:2665513ce2d3
Add boost headers
author | Chris Cannam |
---|---|
date | Tue, 05 Aug 2014 11:11:38 +0100 |
parents | |
children | c530137014c0 |
comparison
equal
deleted
inserted
replaced
15:663ca0da4350 | 16:2665513ce2d3 |
---|---|
1 #ifndef BOOST_ARCHIVE_ITERATORS_UNESCAPE_HPP | |
2 #define BOOST_ARCHIVE_ITERATORS_UNESCAPE_HPP | |
3 | |
4 // MS compatible compilers support #pragma once | |
5 #if defined(_MSC_VER) && (_MSC_VER >= 1020) | |
6 # pragma once | |
7 #endif | |
8 | |
9 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 | |
10 // unescape.hpp | |
11 | |
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) | |
16 | |
17 // See http://www.boost.org for updates, documentation, and revision history. | |
18 | |
19 #include <boost/assert.hpp> | |
20 | |
21 #include <boost/config.hpp> // for BOOST_DEDUCED_TYPENAME | |
22 #include <boost/iterator/iterator_adaptor.hpp> | |
23 //#include <boost/iterator/iterator_traits.hpp> | |
24 #include <boost/pointee.hpp> | |
25 | |
26 namespace boost { | |
27 namespace archive { | |
28 namespace iterators { | |
29 | |
30 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 | |
31 // class used by text archives to translate char strings to wchar_t | |
32 // strings of the currently selected locale | |
33 template<class Derived, class Base> | |
34 class unescape | |
35 : public boost::iterator_adaptor< | |
36 unescape<Derived, Base>, | |
37 Base, | |
38 BOOST_DEDUCED_TYPENAME pointee<Base>::type, | |
39 single_pass_traversal_tag, | |
40 BOOST_DEDUCED_TYPENAME pointee<Base>::type | |
41 > | |
42 { | |
43 friend class boost::iterator_core_access; | |
44 typedef BOOST_DEDUCED_TYPENAME boost::iterator_adaptor< | |
45 unescape<Derived, Base>, | |
46 Base, | |
47 BOOST_DEDUCED_TYPENAME pointee<Base>::type, | |
48 single_pass_traversal_tag, | |
49 BOOST_DEDUCED_TYPENAME pointee<Base>::type | |
50 > super_t; | |
51 | |
52 typedef unescape<Derived, Base> this_t; | |
53 public: | |
54 typedef BOOST_DEDUCED_TYPENAME this_t::value_type value_type; | |
55 typedef BOOST_DEDUCED_TYPENAME this_t::reference reference; | |
56 private: | |
57 value_type dereference_impl() { | |
58 if(! m_full){ | |
59 m_current_value = static_cast<Derived *>(this)->drain(); | |
60 m_full = true; | |
61 } | |
62 return m_current_value; | |
63 } | |
64 | |
65 reference dereference() const { | |
66 return const_cast<this_t *>(this)->dereference_impl(); | |
67 } | |
68 | |
69 value_type m_current_value; | |
70 bool m_full; | |
71 | |
72 void increment(){ | |
73 ++(this->base_reference()); | |
74 dereference_impl(); | |
75 m_full = false; | |
76 }; | |
77 | |
78 public: | |
79 | |
80 unescape(Base base) : | |
81 super_t(base), | |
82 m_full(false) | |
83 {} | |
84 | |
85 }; | |
86 | |
87 } // namespace iterators | |
88 } // namespace archive | |
89 } // namespace boost | |
90 | |
91 #endif // BOOST_ARCHIVE_ITERATORS_UNESCAPE_HPP |