add a Node::ContainsKey function for quick checking of subordinated
This commit is contained in:
parent
6bd373fb8a
commit
737117332d
@ -350,6 +350,16 @@ std::string key_to_string(const Key& key) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// indexing
|
// indexing
|
||||||
|
template <typename Key>
|
||||||
|
inline bool Node::ContainsKey(const Key& key) const {
|
||||||
|
EnsureNodeExists();
|
||||||
|
if (! IsMap())
|
||||||
|
return false;
|
||||||
|
detail::node* value =
|
||||||
|
static_cast<const detail::node&>(*m_pNode).get(key, m_pMemory);
|
||||||
|
return (bool)value;
|
||||||
|
}
|
||||||
|
|
||||||
template <typename Key>
|
template <typename Key>
|
||||||
inline const Node Node::operator[](const Key& key) const {
|
inline const Node Node::operator[](const Key& key) const {
|
||||||
EnsureNodeExists();
|
EnsureNodeExists();
|
||||||
|
|||||||
@ -99,6 +99,8 @@ class YAML_CPP_API Node {
|
|||||||
|
|
||||||
// indexing
|
// indexing
|
||||||
template <typename Key>
|
template <typename Key>
|
||||||
|
bool ContainsKey(const Key& key) const;
|
||||||
|
template <typename Key>
|
||||||
const Node operator[](const Key& key) const;
|
const Node operator[](const Key& key) const;
|
||||||
template <typename Key>
|
template <typename Key>
|
||||||
Node operator[](const Key& key);
|
Node operator[](const Key& key);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user