Files
yaml-cpp/src/scalar.h
jbeder 51457eece9 Changed the way we read different types of scalars.
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.
2009-05-23 23:51:01 +00:00

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;
};
}