mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-09 20:51:16 +00:00
Clarified some copy/assignment issues with the stream/streamcharsource.
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "noncopyable.h"
|
||||||
#include <deque>
|
#include <deque>
|
||||||
#include <ios>
|
#include <ios>
|
||||||
#include <string>
|
#include <string>
|
||||||
@@ -10,7 +11,7 @@ namespace YAML
|
|||||||
{
|
{
|
||||||
static const size_t MAX_PARSER_PUSHBACK = 8;
|
static const size_t MAX_PARSER_PUSHBACK = 8;
|
||||||
|
|
||||||
class Stream
|
class Stream: private noncopyable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
friend class StreamCharSource;
|
friend class StreamCharSource;
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "noncopyable.h"
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
|
||||||
namespace YAML
|
namespace YAML
|
||||||
@@ -7,7 +8,8 @@ namespace YAML
|
|||||||
class StreamCharSource
|
class StreamCharSource
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
StreamCharSource(const Stream& stream);
|
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() {}
|
||||||
|
|
||||||
operator bool() const;
|
operator bool() const;
|
||||||
@@ -19,10 +21,9 @@ namespace YAML
|
|||||||
private:
|
private:
|
||||||
std::size_t m_offset;
|
std::size_t m_offset;
|
||||||
const Stream& m_stream;
|
const Stream& m_stream;
|
||||||
};
|
|
||||||
|
|
||||||
inline StreamCharSource::StreamCharSource(const Stream& stream): m_offset(0), m_stream(stream) {
|
StreamCharSource& operator = (const StreamCharSource&); // non-assignable
|
||||||
}
|
};
|
||||||
|
|
||||||
inline StreamCharSource::operator bool() const {
|
inline StreamCharSource::operator bool() const {
|
||||||
return m_stream.ReadAheadTo(m_offset);
|
return m_stream.ReadAheadTo(m_offset);
|
||||||
|
Reference in New Issue
Block a user