Added Read() functions for Node that return true/false, so we can easily check if a read is successful without throwing.

But we still have operator >> that throws on failure.
This commit is contained in:
Jesse Beder
2008-09-24 23:29:00 +00:00
parent 907be0660c
commit 6e4317e37c
5 changed files with 123 additions and 92 deletions

View File

@@ -36,13 +36,13 @@ namespace YAML
virtual bool IsSequence() const { return false; }
// extraction
virtual void Read(std::string& s) { throw InvalidScalar(); }
virtual void Read(int& i) { throw InvalidScalar(); }
virtual void Read(unsigned& u) { throw InvalidScalar(); }
virtual void Read(long& l) { throw InvalidScalar(); }
virtual void Read(float& f) { throw InvalidScalar(); }
virtual void Read(double& d) { throw InvalidScalar(); }
virtual void Read(char& c) { throw InvalidScalar(); }
virtual bool Read(std::string& s) const { return false; }
virtual bool Read(int& i) const { return false; }
virtual bool Read(unsigned& u) const { return false; }
virtual bool Read(long& l) const { return false; }
virtual bool Read(float& f) const { return false; }
virtual bool Read(double& d) const { return false; }
virtual bool Read(char& c) const { return false; }
// ordering
virtual int Compare(Content *pContent) { return 0; }