Added Exclude toUri.
diff --git a/ndn-cpp/interest.cpp b/ndn-cpp/interest.cpp
index b9a4b69..f84dd7a 100644
--- a/ndn-cpp/interest.cpp
+++ b/ndn-cpp/interest.cpp
@@ -36,6 +36,25 @@
}
}
+string Exclude::toUri() const
+{
+ if (entries_.size() == 0)
+ return "";
+
+ ostringstream result;
+ for (unsigned i = 0; i < entries_.size(); ++i) {
+ if (i > 0)
+ result << ",";
+
+ if (entries_[i].getType() == ndn_Exclude_ANY)
+ result << "*";
+ else
+ Name::toEscapedString(entries_[i].getComponent().getValue(), result);
+ }
+
+ return result.str();
+}
+
void Interest::set(const struct ndn_Interest &interestStruct)
{
name_.set(interestStruct.name);
diff --git a/ndn-cpp/interest.hpp b/ndn-cpp/interest.hpp
index 149c606..c27af5b 100644
--- a/ndn-cpp/interest.hpp
+++ b/ndn-cpp/interest.hpp
@@ -107,6 +107,12 @@
entries_.clear();
}
+ /**
+ * Encode this Exclude with elements separated by "," and ndn_Exclude_ANY shown as "*".
+ * @return the URI string
+ */
+ std::string toUri() const;
+
private:
std::vector<ExcludeEntry> entries_;
};