mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-09 20:51:16 +00:00
Added a (recursive) ordering, so we have a canonical output that we can compare.
This commit is contained in:
15
scalar.cpp
15
scalar.cpp
@@ -88,4 +88,19 @@ namespace YAML
|
||||
if(!data)
|
||||
throw InvalidScalar();
|
||||
}
|
||||
|
||||
int Scalar::Compare(Content *pContent)
|
||||
{
|
||||
return -pContent->Compare(this);
|
||||
}
|
||||
|
||||
int Scalar::Compare(Scalar *pScalar)
|
||||
{
|
||||
if(m_data < pScalar->m_data)
|
||||
return -1;
|
||||
else if(m_data > pScalar->m_data)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user