diff options
author | Alexander Smirnov <alex@ydb.tech> | 2024-07-08 15:54:05 +0000 |
---|---|---|
committer | Alexander Smirnov <alex@ydb.tech> | 2024-07-08 15:54:05 +0000 |
commit | fc7be18c76af2e700641f3598c4856baeef1428e (patch) | |
tree | 11dbca45eb321c3a4dd08b12152acc6ef5dd3fa9 /contrib/libs/yaml-cpp/src/streamcharsource.h | |
parent | ec0e7ed6da6fb317741fd8468602949a1362eca5 (diff) | |
parent | c92cb9d3a19331916f0c274d80e67f02a62caa9b (diff) | |
download | ydb-fc7be18c76af2e700641f3598c4856baeef1428e.tar.gz |
Merge branch 'rightlib' into mergelibs-240708-1553
Diffstat (limited to 'contrib/libs/yaml-cpp/src/streamcharsource.h')
-rw-r--r-- | contrib/libs/yaml-cpp/src/streamcharsource.h | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/contrib/libs/yaml-cpp/src/streamcharsource.h b/contrib/libs/yaml-cpp/src/streamcharsource.h index 624599e65d..826ba5347e 100644 --- a/contrib/libs/yaml-cpp/src/streamcharsource.h +++ b/contrib/libs/yaml-cpp/src/streamcharsource.h @@ -7,16 +7,20 @@ #pragma once #endif -#include "yaml-cpp/noncopyable.h" +#include "yaml-cpp/noexcept.h" +#include "stream.h" #include <cstddef> namespace YAML { + class StreamCharSource { public: StreamCharSource(const Stream& stream) : m_offset(0), m_stream(stream) {} - StreamCharSource(const StreamCharSource& source) - : m_offset(source.m_offset), m_stream(source.m_stream) {} - ~StreamCharSource() {} + StreamCharSource(const StreamCharSource& source) = default; + StreamCharSource(StreamCharSource&&) YAML_CPP_NOEXCEPT = default; + StreamCharSource& operator=(const StreamCharSource&) = delete; + StreamCharSource& operator=(StreamCharSource&&) = delete; + ~StreamCharSource() = default; operator bool() const; char operator[](std::size_t i) const { return m_stream.CharAt(m_offset + i); } @@ -27,8 +31,6 @@ class StreamCharSource { private: std::size_t m_offset; const Stream& m_stream; - - StreamCharSource& operator=(const StreamCharSource&); // non-assignable }; inline StreamCharSource::operator bool() const { @@ -38,11 +40,11 @@ inline StreamCharSource::operator bool() const { inline const StreamCharSource StreamCharSource::operator+(int i) const { StreamCharSource source(*this); if (static_cast<int>(source.m_offset) + i >= 0) - source.m_offset += i; + source.m_offset += static_cast<std::size_t>(i); else source.m_offset = 0; return source; } -} +} // namespace YAML #endif // STREAMCHARSOURCE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 |