Class Node
Synopsis
#include <include/yaml-cpp/node/node.h>
class YAML_CPP_API Node
Description
No description yet.
Mentioned in
- Tutorial / Introduction
- Tutorial / Basic Parsing and Node Editing
- Tutorial / Building Nodes
- Tutorial / How Sequences Turn Into Maps
- Tutorial / Converting To/From Native Data Types
- How To Emit YAML / Using Existing Nodes
- Breaking Changes / 0.5.1
- Breaking Changes / 0.2.6
- How To Parse A Document (Old API) / Basic Parsing
- How To Parse A Document (Old API) / Reading From the Document
- How To Parse A Document (Old API) / Optional Keys
- How To Parse A Document (Old API) / Getting More Complicated
- How To Parse A Document (Old API) / A Complete Example
- How To Parse A Document (Old API) / When Something Goes Wrong
- How To Parse A Document (Old API) / Note about copying YAML::Node
Inheritance
Decsendents: iterator_value
Methods
Node overload | ||
~Node | ||
as overload | access | |
Assign | ||
begin overload | Mentioned in
| |
end overload | Mentioned in
| |
force_insert | map | |
is | assignment | |
IsDefined | ||
IsMap | ||
IsNull | ||
IsScalar | ||
IsSequence | Mentioned in
| |
Mark | ||
operator bool | bool conversions | |
operator! | ||
operator= overload | ||
operator[] overload | indexing | |
push_back overload | sequence | |
remove overload | ||
reset | Mentioned in
| |
Scalar | Mentioned in
| |
SetStyle | ||
SetTag | ||
size | size/iterator | |
Style | style WARNING: This API might change in future releases. | |
Tag | Mentioned in
| |
Type | Mentioned in
|
Source
Lines 29-138 in include/yaml-cpp/node/node.h.
class YAML_CPP_API Node {
public:
friend class NodeBuilder;
friend class NodeEvents;
friend struct detail::iterator_value;
friend class detail::node;
friend class detail::node_data;
template <typename>
friend class detail::iterator_base;
template <typename T, typename S>
friend struct as_if;
using iterator = YAML::iterator;
using const_iterator = YAML::const_iterator;
Node();
explicit Node(NodeType::value type);
template <typename T>
explicit Node(const T& rhs);
explicit Node(const detail::iterator_value& rhs);
Node(const Node& rhs);
~Node();
YAML::Mark Mark() const;
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
explicit operator bool() const { return IsDefined(); }
bool operator!() const { return !IsDefined(); }
// access
template <typename T>
T as() const;
template <typename T, typename S>
T as(const S& fallback) const;
const std::string& Scalar() const;
const std::string& Tag() const;
void SetTag(const std::string& tag);
// style
// WARNING: This API might change in future releases.
EmitterStyle::value Style() const;
void SetStyle(EmitterStyle::value style);
// assignment
bool is(const Node& rhs) const;
template <typename T>
Node& operator=(const T& rhs);
Node& operator=(const Node& rhs);
void reset(const Node& rhs = Node());
// size/iterator
std::size_t size() const;
const_iterator begin() const;
iterator begin();
const_iterator end() const;
iterator end();
// sequence
template <typename T>
void push_back(const T& rhs);
void push_back(const Node& rhs);
// indexing
template <typename Key>
const Node operator[](const Key& key) const;
template <typename Key>
Node operator[](const Key& key);
template <typename Key>
bool remove(const Key& key);
const Node operator[](const Node& key) const;
Node operator[](const Node& key);
bool remove(const Node& key);
// map
template <typename Key, typename Value>
void force_insert(const Key& key, const Value& value);
private:
enum Zombie { ZombieNode };
explicit Node(Zombie);
explicit Node(Zombie, const std::string&);
explicit Node(detail::node& node, detail::shared_memory_holder pMemory);
void EnsureNodeExists() const;
template <typename T>
void Assign(const T& rhs);
void Assign(const char* rhs);
void Assign(char* rhs);
void AssignData(const Node& rhs);
void AssignNode(const Node& rhs);
private:
bool m_isValid;
// String representation of invalid key, if the node is invalid.
std::string m_invalidKey;
mutable detail::shared_memory_holder m_pMemory;
mutable detail::node* m_pNode;
};