data+interest+selectors+meta-info+signature: Implementing EqualityComparable concept
Change-Id: I54f04820861bdc7b4e001949f1ba8d62f9a66786
diff --git a/src/exclude.cpp b/src/exclude.cpp
index bc1f9d5..be9dcc1 100644
--- a/src/exclude.cpp
+++ b/src/exclude.cpp
@@ -15,7 +15,7 @@
namespace ndn
{
-Exclude::Exclude ()
+Exclude::Exclude()
{
}
@@ -25,17 +25,17 @@
//
// /f (false); /d (true); /b (false); / (true)
//
-// lower_bound (/) -> / (true) <-- excluded (equal)
-// lower_bound (/a) -> / (true) <-- excluded (any)
-// lower_bound (/b) -> /b (false) <--- excluded (equal)
-// lower_bound (/c) -> /b (false) <--- not excluded (not equal and no ANY)
-// lower_bound (/d) -> /d (true) <- excluded
-// lower_bound (/e) -> /d (true) <- excluded
+// lower_bound(/) -> / (true) <-- excluded (equal)
+// lower_bound(/a) -> / (true) <-- excluded (any)
+// lower_bound(/b) -> /b (false) <--- excluded (equal)
+// lower_bound(/c) -> /b (false) <--- not excluded (not equal and no ANY)
+// lower_bound(/d) -> /d (true) <- excluded
+// lower_bound(/e) -> /d (true) <- excluded
bool
-Exclude::isExcluded (const name::Component &comp) const
+Exclude::isExcluded(const name::Component& comp) const
{
- const_iterator lowerBound = m_exclude.lower_bound (comp);
- if (lowerBound == end ())
+ const_iterator lowerBound = m_exclude.lower_bound(comp);
+ if (lowerBound == end())
return false;
if (lowerBound->second)
@@ -46,12 +46,12 @@
return false;
}
-Exclude &
-Exclude::excludeOne (const name::Component &comp)
+Exclude&
+Exclude::excludeOne(const name::Component& comp)
{
- if (!isExcluded (comp))
+ if (!isExcluded(comp))
{
- m_exclude.insert (std::make_pair (comp, false));
+ m_exclude.insert(std::make_pair(comp, false));
}
return *this;
}
@@ -63,42 +63,42 @@
//
// /f0 (false); /d0 (true); /b0 (false); / (true)
//
-// lower_bound (/) -> / (true) <-- excluded (equal)
-// lower_bound (/a0) -> / (true) <-- excluded (any)
-// lower_bound (/b0) -> /b0 (false) <--- excluded (equal)
-// lower_bound (/c0) -> /b0 (false) <--- not excluded (not equal and no ANY)
-// lower_bound (/d0) -> /d0 (true) <- excluded
-// lower_bound (/e0) -> /d0 (true) <- excluded
+// lower_bound(/) -> / (true) <-- excluded (equal)
+// lower_bound(/a0) -> / (true) <-- excluded (any)
+// lower_bound(/b0) -> /b0 (false) <--- excluded (equal)
+// lower_bound(/c0) -> /b0 (false) <--- not excluded (not equal and no ANY)
+// lower_bound(/d0) -> /d0 (true) <- excluded
+// lower_bound(/e0) -> /d0 (true) <- excluded
// examples with desired outcomes
-// excludeRange (/, /f0) -> ANY /f0
+// excludeRange(/, /f0) -> ANY /f0
// /f0 (false); / (true)
-// excludeRange (/, /f1) -> ANY /f1
+// excludeRange(/, /f1) -> ANY /f1
// /f1 (false); / (true)
-// excludeRange (/a0, /e0) -> ANY /f0
+// excludeRange(/a0, /e0) -> ANY /f0
// /f0 (false); / (true)
-// excludeRange (/a0, /e0) -> ANY /f0
+// excludeRange(/a0, /e0) -> ANY /f0
// /f0 (false); / (true)
-// excludeRange (/b1, /c0) -> ANY /b0 /b1 ANY /c0 /d0 ANY /f0
+// excludeRange(/b1, /c0) -> ANY /b0 /b1 ANY /c0 /d0 ANY /f0
// /f0 (false); /d0 (true); /c0 (false); /b1 (true); /b0 (false); / (true)
-Exclude &
-Exclude::excludeRange (const name::Component &from, const name::Component &to)
+Exclude&
+Exclude::excludeRange(const name::Component& from, const name::Component& to)
{
if (from >= to)
{
- throw Error ("Invalid exclude range [" +
- from.toEscapedString() + ", " +
- to.toEscapedString() +
- "] (for single name exclude use Exclude::excludeOne)");
+ throw Error("Invalid exclude range [" +
+ from.toEscapedString() + ", " +
+ to.toEscapedString() +
+ "] (for single name exclude use Exclude::excludeOne)");
}
- iterator newFrom = m_exclude.lower_bound (from);
- if (newFrom == end () || !newFrom->second /*without ANY*/)
+ iterator newFrom = m_exclude.lower_bound(from);
+ if (newFrom == end() || !newFrom->second /*without ANY*/)
{
- std::pair<iterator, bool> fromResult = m_exclude.insert (std::make_pair (from, true));
+ std::pair<iterator, bool> fromResult = m_exclude.insert(std::make_pair(from, true));
newFrom = fromResult.first;
if (!fromResult.second)
{
@@ -109,10 +109,10 @@
// else
// nothing special if start of the range already exists with ANY flag set
- iterator newTo = m_exclude.lower_bound (to); // !newTo cannot be end ()
+ iterator newTo = m_exclude.lower_bound(to); // !newTo cannot be end()
if (newTo == newFrom || !newTo->second)
{
- std::pair<iterator, bool> toResult = m_exclude.insert (std::make_pair (to, false));
+ std::pair<iterator, bool> toResult = m_exclude.insert(std::make_pair(to, false));
newTo = toResult.first;
++ newTo;
}
@@ -121,18 +121,18 @@
// nothing to do really
}
- m_exclude.erase (newTo, newFrom); // remove any intermediate node, since all of the are excluded
+ m_exclude.erase(newTo, newFrom); // remove any intermediate node, since all of the are excluded
return *this;
}
-Exclude &
-Exclude::excludeAfter (const name::Component &from)
+Exclude&
+Exclude::excludeAfter(const name::Component& from)
{
- iterator newFrom = m_exclude.lower_bound (from);
- if (newFrom == end () || !newFrom->second /*without ANY*/)
+ iterator newFrom = m_exclude.lower_bound(from);
+ if (newFrom == end() || !newFrom->second /*without ANY*/)
{
- std::pair<iterator, bool> fromResult = m_exclude.insert (std::make_pair (from, true));
+ std::pair<iterator, bool> fromResult = m_exclude.insert(std::make_pair(from, true));
newFrom = fromResult.first;
if (!fromResult.second)
{
@@ -143,9 +143,9 @@
// else
// nothing special if start of the range already exists with ANY flag set
- if (newFrom != m_exclude.begin ())
+ if (newFrom != m_exclude.begin())
{
- m_exclude.erase (m_exclude.begin (), newFrom); // remove any intermediate node, since all of the are excluded
+ m_exclude.erase(m_exclude.begin(), newFrom); // remove any intermediate node, since all of the are excluded
}
return *this;
@@ -153,15 +153,15 @@
std::ostream&
-operator << (std::ostream &os, const Exclude &exclude)
+operator<<(std::ostream& os, const Exclude& exclude)
{
bool empty = true;
- for (Exclude::const_reverse_iterator i = exclude.rbegin (); i != exclude.rend (); i++)
+ for (Exclude::const_reverse_iterator i = exclude.rbegin(); i != exclude.rend(); i++)
{
if (!i->first.empty())
{
if (!empty) os << ",";
- os << i->first.toEscapedString ();
+ os << i->first.toEscapedString();
empty = false;
}
if (i->second)