Om
stream_source.hpp
Go to the documentation of this file.
1 
15 #ifndef Om_Source_StreamSource_
16 
17  #define Om_Source_StreamSource_ \
18  Om::Source::StreamSource
19 
21 
22  #ifndef Om_Macro_Precompilation_
23 
24  #include "boost/optional.hpp"
25 
26  #endif
27 
28 namespace Om {
29 
30  namespace Source {
31 
32  // MARK: - Om::Source::StreamSource
33 
42  template <typename ThisItem = char>
43  class StreamSource:
44  public DefaultSource<
45  ThisItem const,
46  StreamSource<ThisItem>
47  > {
48 
49  public: // MARK: public (non-static)
50 
52 
53  explicit StreamSource(std::istream &);
54 
56 
57  virtual bool operator !() const;
58 
59  virtual ThisItem const & operator *() const;
60 
61  using DefaultSource<
62  ThisItem const,
64  >::Equals;
65 
66  bool Equals(StreamSource const &) const;
67 
68  virtual void Pop();
69 
70  void Swap(StreamSource &);
71 
72  private: // MARK: private (static)
73 
74  typedef std::istreambuf_iterator<ThisItem> StreamIterator;
75 
76  private: // MARK: private (non-static)
77 
79 
84  mutable boost::optional<ThisItem> thisItem;
85 
86  };
87 
88  // MARK: - Om::Source::
89 
90  template <typename TheItem>
92  StreamSource<TheItem> const &,
93  StreamSource<TheItem> const &
94  );
95 
96  template <typename TheItem>
98  StreamSource<TheItem> const &,
99  StreamSource<TheItem> const &
100  );
101 
102  }
103 
104 }
105 
106 namespace boost {
107 
108  // MARK: - boost::
109 
110  template <typename TheItem>
111  void swap(
114  );
115 
116 }
117 
118  #include "om/source/stream_source.cpp"
119 
120 #endif
A partial implementation of Source.
A Source adapter for an input stream.
StreamSource & operator=(StreamSource)
void Swap(StreamSource &)
bool Equals(StreamSource const &) const
boost::optional< ThisItem > thisItem
The current item.
StreamSource(std::istream &)
virtual void Pop()
Pops the current item.
virtual bool operator!() const
virtual ThisItem const & operator*() const
StreamIterator thisStreamIterator
std::istreambuf_iterator< ThisItem > StreamIterator
Om header file.
bool operator==(CodePointSource< TheCodeUnitIterator > const &, CodePointSource< TheCodeUnitIterator > const &)
bool operator!=(CodePointSource< TheCodeUnitIterator > const &, CodePointSource< TheCodeUnitIterator > const &)
The Om library.
Definition: code_point.hpp:26
void swap(Om::Language::Expression &, Om::Language::Expression &)
Om source file.