Sort notes when checking verifications.
[libdcp.git] / src / verify.cc
index 7948767a84d8045fcd8c43faf26e6956284b19a4..623794cc9c276684bc00c5f9a97562726d4d0841 100644 (file)
@@ -1618,6 +1618,29 @@ dcp::operator== (dcp::VerificationNote const& a, dcp::VerificationNote const& b)
 }
 
 
+bool
+dcp::operator< (dcp::VerificationNote const& a, dcp::VerificationNote const& b)
+{
+       if (a.type() != b.type()) {
+               return a.type() < b.type();
+       }
+
+       if (a.code() != b.code()) {
+               return a.code() < b.code();
+       }
+
+       if (a.note() != b.note()) {
+               return a.note().get_value_or("") < b.note().get_value_or("");
+       }
+
+       if (a.file() != b.file()) {
+               return a.file().get_value_or("") < b.file().get_value_or("");
+       }
+
+       return a.line().get_value_or(0) < b.line().get_value_or(0);
+}
+
+
 std::ostream&
 dcp::operator<< (std::ostream& s, dcp::VerificationNote const& note)
 {