1 #ifndef STREAMCHARSOURCE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 2 #define STREAMCHARSOURCE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 4 #if defined(_MSC_VER) || \ 5 (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ 6 (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 10 #include "yaml-cpp/noexcept.h" 16 class StreamCharSource {
18 StreamCharSource(
const Stream& stream) : m_offset(0), m_stream(stream) {}
19 StreamCharSource(
const StreamCharSource& source) =
default;
20 StreamCharSource(StreamCharSource&&) YAML_CPP_NOEXCEPT = default;
21 StreamCharSource& operator=(const StreamCharSource&) = delete;
22 StreamCharSource& operator=(StreamCharSource&&) = delete;
23 ~StreamCharSource() = default;
25 operator
bool() const;
26 char operator[](
std::
size_t i)
const {
return m_stream.CharAt(m_offset + i); }
27 bool operator!()
const {
return !
static_cast<bool>(*this); }
29 const StreamCharSource operator+(
int i)
const;
33 const Stream& m_stream;
36 inline StreamCharSource::operator bool()
const {
37 return m_stream.ReadAheadTo(m_offset);
40 inline const StreamCharSource StreamCharSource::operator+(
int i)
const {
41 StreamCharSource source(*
this);
42 if (static_cast<int>(source.m_offset) + i >= 0)
43 source.m_offset +=
static_cast<std::size_t
>(i);
50 #endif // STREAMCHARSOURCE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 Definition: gtest-internal.h:1322