File indexing completed on 2025-01-19 09:47:39
0001
0002
0003
0004
0005
0006 #if !defined(BOOST_SPIRIT_KARMA_OSTREAM_ITERATOR_MAY_26_2007_1016PM)
0007 #define BOOST_SPIRIT_KARMA_OSTREAM_ITERATOR_MAY_26_2007_1016PM
0008
0009 #if defined(_MSC_VER)
0010 #pragma once
0011 #endif
0012
0013 #include <iosfwd>
0014 #include <iterator>
0015
0016
0017 namespace boost { namespace spirit { namespace karma
0018 {
0019
0020
0021
0022
0023
0024
0025 template <
0026 typename T, typename Elem = char
0027 , typename Traits = std::char_traits<Elem> >
0028 class ostream_iterator
0029 {
0030 public:
0031 typedef std::output_iterator_tag iterator_category;
0032 typedef void value_type;
0033 typedef void difference_type;
0034 typedef void pointer;
0035 typedef void reference;
0036 typedef Elem char_type;
0037 typedef Traits traits_type;
0038 typedef std::basic_ostream<Elem, Traits> ostream_type;
0039 typedef ostream_iterator<T, Elem, Traits> self_type;
0040
0041 ostream_iterator(ostream_type& os_, Elem const* delim_ = 0)
0042 : os(&os_), delim(delim_) {}
0043
0044 self_type& operator= (T const& val)
0045 {
0046 *os << val;
0047 if (0 != delim)
0048 *os << delim;
0049 return *this;
0050 }
0051
0052 self_type& operator*() { return *this; }
0053 self_type& operator++() { return *this; }
0054 self_type operator++(int) { return *this; }
0055
0056
0057 ostream_type& get_ostream() { return *os; }
0058 ostream_type const& get_ostream() const { return *os; }
0059
0060
0061 bool good() const { return get_ostream().good(); }
0062
0063 protected:
0064 ostream_type *os;
0065 Elem const* delim;
0066 };
0067
0068 }}}
0069
0070 #endif