mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-09 12:41:17 +00:00
Implemented is()
This commit is contained in:
@@ -21,6 +21,8 @@ namespace YAML
|
|||||||
node(): m_pRef(new node_ref) {}
|
node(): m_pRef(new node_ref) {}
|
||||||
|
|
||||||
ValueType::value type() const { return m_pRef->type(); }
|
ValueType::value type() const { return m_pRef->type(); }
|
||||||
|
|
||||||
|
bool is(const node& rhs) const { return m_pRef == rhs.m_pRef; }
|
||||||
|
|
||||||
void set_ref(const node& rhs) { m_pRef = rhs.m_pRef; }
|
void set_ref(const node& rhs) { m_pRef = rhs.m_pRef; }
|
||||||
void set_data(const node& rhs) { m_pRef->set_data(*rhs.m_pRef); }
|
void set_data(const node& rhs) { m_pRef->set_data(*rhs.m_pRef); }
|
||||||
|
@@ -57,6 +57,11 @@ namespace YAML
|
|||||||
}
|
}
|
||||||
|
|
||||||
// assignment
|
// assignment
|
||||||
|
inline bool Value::is(const Value& rhs) const
|
||||||
|
{
|
||||||
|
return m_pNode->is(*rhs.m_pNode);
|
||||||
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline Value& Value::operator=(const T& rhs)
|
inline Value& Value::operator=(const T& rhs)
|
||||||
{
|
{
|
||||||
@@ -88,7 +93,7 @@ namespace YAML
|
|||||||
|
|
||||||
inline Value& Value::operator=(const Value& rhs)
|
inline Value& Value::operator=(const Value& rhs)
|
||||||
{
|
{
|
||||||
if(is(*this, rhs))
|
if(is(rhs))
|
||||||
return *this;
|
return *this;
|
||||||
AssignNode(rhs);
|
AssignNode(rhs);
|
||||||
return *this;
|
return *this;
|
||||||
@@ -213,7 +218,7 @@ namespace YAML
|
|||||||
|
|
||||||
inline bool is(const Value& lhs, const Value& rhs)
|
inline bool is(const Value& lhs, const Value& rhs)
|
||||||
{
|
{
|
||||||
return false;
|
return lhs.is(rhs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -31,6 +31,7 @@ namespace YAML
|
|||||||
template<typename T> const T as() const;
|
template<typename T> const T as() const;
|
||||||
|
|
||||||
// assignment
|
// assignment
|
||||||
|
bool is(const Value& rhs) const;
|
||||||
template<typename T> Value& operator=(const T& rhs);
|
template<typename T> Value& operator=(const T& rhs);
|
||||||
Value& operator=(const Value& rhs);
|
Value& operator=(const Value& rhs);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user