| 1 | // Copyright (c) 2001-2011 Hartmut Kaiser |
| 2 | // |
| 3 | // Distributed under the Boost Software License, Version 1.0. (See accompanying |
| 4 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
| 5 | |
| 6 | #if !defined(BOOST_SPIRIT_ISTREAM_ITERATOR_JAN_03_2010_0522PM) |
| 7 | #define BOOST_SPIRIT_ISTREAM_ITERATOR_JAN_03_2010_0522PM |
| 8 | |
| 9 | #include <boost/spirit/home/support/iterators/detail/ref_counted_policy.hpp> |
| 10 | #if defined(BOOST_SPIRIT_DEBUG) |
| 11 | #include <boost/spirit/home/support/iterators/detail/buf_id_check_policy.hpp> |
| 12 | #else |
| 13 | #include <boost/spirit/home/support/iterators/detail/no_check_policy.hpp> |
| 14 | #endif |
| 15 | #include <boost/spirit/home/support/iterators/detail/istream_policy.hpp> |
| 16 | #include <boost/spirit/home/support/iterators/detail/split_std_deque_policy.hpp> |
| 17 | #include <boost/spirit/home/support/iterators/detail/combine_policies.hpp> |
| 18 | #include <boost/spirit/home/support/iterators/multi_pass.hpp> |
| 19 | |
| 20 | namespace boost { namespace spirit |
| 21 | { |
| 22 | /////////////////////////////////////////////////////////////////////////// |
| 23 | template <typename Elem, typename Traits = std::char_traits<Elem> > |
| 24 | class basic_istream_iterator : |
| 25 | public multi_pass< |
| 26 | std::basic_istream<Elem, Traits> |
| 27 | , iterator_policies::default_policy< |
| 28 | iterator_policies::ref_counted |
| 29 | #if defined(BOOST_SPIRIT_DEBUG) |
| 30 | , iterator_policies::buf_id_check |
| 31 | #else |
| 32 | , iterator_policies::no_check |
| 33 | #endif |
| 34 | , iterator_policies::istream |
| 35 | , iterator_policies::split_std_deque> |
| 36 | > |
| 37 | { |
| 38 | private: |
| 39 | typedef multi_pass< |
| 40 | std::basic_istream<Elem, Traits> |
| 41 | , iterator_policies::default_policy< |
| 42 | iterator_policies::ref_counted |
| 43 | #if defined(BOOST_SPIRIT_DEBUG) |
| 44 | , iterator_policies::buf_id_check |
| 45 | #else |
| 46 | , iterator_policies::no_check |
| 47 | #endif |
| 48 | , iterator_policies::istream |
| 49 | , iterator_policies::split_std_deque> |
| 50 | > base_type; |
| 51 | |
| 52 | public: |
| 53 | basic_istream_iterator() |
| 54 | : base_type() {} |
| 55 | |
| 56 | explicit basic_istream_iterator(std::basic_istream<Elem, Traits>& x) |
| 57 | : base_type(x) {} |
| 58 | |
| 59 | #if BOOST_WORKAROUND(__GLIBCPP__, == 20020514) |
| 60 | basic_istream_iterator(int) // workaround for a bug in the library |
| 61 | : base_type() {} // shipped with gcc 3.1 |
| 62 | #endif // BOOST_WORKAROUND(__GLIBCPP__, == 20020514) |
| 63 | |
| 64 | basic_istream_iterator operator= (base_type const& rhs) |
| 65 | { |
| 66 | this->base_type::operator=(rhs); |
| 67 | return *this; |
| 68 | } |
| 69 | |
| 70 | // default generated operators, destructor and assignment operator are ok. |
| 71 | }; |
| 72 | |
| 73 | typedef basic_istream_iterator<char> istream_iterator; |
| 74 | |
| 75 | }} |
| 76 | |
| 77 | #endif |
| 78 | |