Browse Source

Added Exclude toUri.

pull/1/head
Jeff Thompson 12 years ago
parent
commit
37527d624f
  1. 19
      ndn-cpp/interest.cpp
  2. 6
      ndn-cpp/interest.hpp

19
ndn-cpp/interest.cpp

@ -36,6 +36,25 @@ void Exclude::set(const struct ndn_Exclude &excludeStruct)
}
}
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);

6
ndn-cpp/interest.hpp

@ -107,6 +107,12 @@ public:
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_;
};

Loading…
Cancel
Save