streamcharsource.h
Go to the documentation of this file.
1 #ifndef STREAMCHARSOURCE_H_62B23520_7C8E_11DE_8A39_0800200C9A66_PM
2 #define STREAMCHARSOURCE_H_62B23520_7C8E_11DE_8A39_0800200C9A66_PM
3 
4 #if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
5 #pragma once
6 #endif
7 
8 
10 #include <cstddef>
11 
12 namespace YAML_PM
13 {
15  {
16  public:
17  StreamCharSource(const Stream& stream): m_offset(0), m_stream(stream) {}
20 
21  operator bool() const;
22  char operator [] (std::size_t i) const { return m_stream.CharAt(m_offset + i); }
23  bool operator !() const { return !static_cast<bool>(*this); }
24 
25  const StreamCharSource operator + (int i) const;
26 
27  private:
28  std::size_t m_offset;
29  const Stream& m_stream;
30 
31  StreamCharSource& operator = (const StreamCharSource&); // non-assignable
32  };
33 
34  inline StreamCharSource::operator bool() const {
36  }
37 
38  inline const StreamCharSource StreamCharSource::operator + (int i) const {
39  StreamCharSource source(*this);
40  if(static_cast<int> (source.m_offset) + i >= 0)
41  source.m_offset += i;
42  else
43  source.m_offset = 0;
44  return source;
45  }
46 }
47 
48 #endif // STREAMCHARSOURCE_H_62B23520_7C8E_11DE_8A39_0800200C9A66_PM
StreamCharSource(const StreamCharSource &source)
bool ReadAheadTo(size_t i) const
Definition: stream.h:72
StreamCharSource(const Stream &stream)
char CharAt(size_t i) const
Definition: stream.h:68
StreamCharSource & operator=(const StreamCharSource &)
const StreamCharSource operator+(int i) const
char operator[](std::size_t i) const


libpointmatcher
Author(s):
autogenerated on Sat May 27 2023 02:38:03