exclude: Provide EqualityComparable concept
Change-Id: Iee9a1738881be159b7944ce618869687f61e61b5
diff --git a/src/exclude.cpp b/src/exclude.cpp
index 202ab91..8e44e1a 100644
--- a/src/exclude.cpp
+++ b/src/exclude.cpp
@@ -24,6 +24,7 @@
#include "exclude.hpp"
#include <boost/static_assert.hpp>
+#include <boost/type_traits.hpp>
namespace ndn {
@@ -93,6 +94,8 @@
void
Exclude::wireDecode(const Block& wire)
{
+ clear();
+
if (wire.type() != tlv::Exclude)
throw tlv::Error("Unexpected TLV type when decoding Exclude");
@@ -173,6 +176,7 @@
if (!isExcluded(comp))
{
m_exclude.insert(std::make_pair(comp, false));
+ m_wire.reset();
}
return *this;
}
@@ -235,6 +239,7 @@
m_exclude.erase(newTo, newFrom); // remove any intermediate node, since all of the are excluded
+ m_wire.reset();
return *this;
}
@@ -258,6 +263,7 @@
m_exclude.erase(m_exclude.begin(), newFrom);
}
+ m_wire.reset();
return *this;
}
@@ -280,4 +286,23 @@
return os;
}
+std::string
+Exclude::toUri() const
+{
+ std::ostringstream os;
+ os << *this;
+ return os.str();
+}
+
+bool
+Exclude::operator==(const Exclude& other) const
+{
+ if (empty() && other.empty())
+ return true;
+ if (empty() || other.empty())
+ return false;
+
+ return wireEncode() == other.wireEncode();
+}
+
} // namespace ndn