mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-09 20:51:16 +00:00

It's better organized now, I think - nodes only offer a single main way of getting the fundamental scalar (as a string), and now we can specialize a single template to read specific types.
35 lines
701 B
C++
35 lines
701 B
C++
#pragma once
|
|
|
|
#include "content.h"
|
|
#include <string>
|
|
|
|
namespace YAML
|
|
{
|
|
class Scalar: public Content
|
|
{
|
|
public:
|
|
Scalar();
|
|
virtual ~Scalar();
|
|
|
|
virtual void Parse(Scanner *pScanner, const ParserState& state);
|
|
virtual void Write(std::ostream& out, int indent, bool startedLine, bool onlyOneCharOnLine);
|
|
|
|
virtual bool IsScalar() const { return true; }
|
|
|
|
// extraction
|
|
virtual bool GetScalar(std::string& scalar) const {
|
|
scalar = m_data;
|
|
return true;
|
|
}
|
|
|
|
// ordering
|
|
virtual int Compare(Content *pContent);
|
|
virtual int Compare(Scalar *pScalar);
|
|
virtual int Compare(Sequence *) { return -1; }
|
|
virtual int Compare(Map *) { return -1; }
|
|
|
|
protected:
|
|
std::string m_data;
|
|
};
|
|
}
|