Added (unspecified-type) bool conversions for Node (new API)

This commit is contained in:
Jesse Beder
2011-11-13 16:05:42 -06:00
parent d78d16532a
commit 5abfbf5aac
4 changed files with 48 additions and 0 deletions

View File

@@ -10,6 +10,7 @@
#include "yaml-cpp/node/ptr.h"
#include "yaml-cpp/node/type.h"
#include "yaml-cpp/node/detail/iterator_fwd.h"
#include "yaml-cpp/node/detail/bool_type.h"
#include <stdexcept>
namespace YAML
@@ -29,11 +30,16 @@ namespace YAML
~Node();
NodeType::value Type() const;
bool IsDefined() const;
bool IsNull() const { return Type() == NodeType::Null; }
bool IsScalar() const { return Type() == NodeType::Scalar; }
bool IsSequence() const { return Type() == NodeType::Sequence; }
bool IsMap() const { return Type() == NodeType::Map; }
// bool conversions
YAML_CPP_OPERATOR_BOOL();
bool operator!() const { return !IsDefined(); }
// access
template<typename T> const T as() const;
const std::string& Scalar() const;