Interest: Added Interest::toUri().
diff --git a/include/ndn-cpp/interest.hpp b/include/ndn-cpp/interest.hpp
index e8a498b..d5d8e49 100644
--- a/include/ndn-cpp/interest.hpp
+++ b/include/ndn-cpp/interest.hpp
@@ -303,6 +303,14 @@
   }
   
   /**
+   * Encode the name according to the "NDN URI Scheme".  If there are interest selectors, append "?" and
+   * added the selectors as a query string.  For example "/test/name?ndn.ChildSelector=1".
+   * @return The URI string.
+   */
+  std::string
+  toUri() const;
+  
+  /**
    * Set the interestStruct to point to the components in this interest, without copying any memory.
    * WARNING: The resulting pointers in interestStruct are invalid after a further use of this object which could reallocate memory.
    * @param interestStruct a C ndn_Interest struct where the name components array is already allocated.
diff --git a/src/interest.cpp b/src/interest.cpp
index b81ea6f..fe8faf3 100644
--- a/src/interest.cpp
+++ b/src/interest.cpp
@@ -100,6 +100,47 @@
   interestStruct.interestLifetimeMilliseconds = interestLifetimeMilliseconds_;
   nonce_.get(interestStruct.nonce);
 }
+
+string 
+Interest::toUri() const
+{
+  ostringstream selectors;
+
+  if (minSuffixComponents_ >= 0)
+    selectors << "&ndn.MinSuffixComponents=" << minSuffixComponents_;
+  if (maxSuffixComponents_ >= 0)
+    selectors << "&ndn.MaxSuffixComponents=" << maxSuffixComponents_;
+  if (childSelector_ >= 0)
+    selectors << "&ndn.ChildSelector=" << childSelector_;
+  if (answerOriginKind_ >= 0)
+    selectors << "&ndn.AnswerOriginKind=" << answerOriginKind_;
+  if (scope_ >= 0)
+    selectors << "&ndn.Scope=" << scope_;
+  if (interestLifetimeMilliseconds_ >= 0)
+    selectors << "&ndn.InterestLifetime=" << interestLifetimeMilliseconds_;
+  if (publisherPublicKeyDigest_.getPublisherPublicKeyDigest().size() > 0) {
+    selectors << "&ndn.PublisherPublicKeyDigest=";
+    Name::toEscapedString(*publisherPublicKeyDigest_.getPublisherPublicKeyDigest(), selectors);
+  }
+  if (nonce_.size() > 0) {
+    selectors << "&ndn.Nonce=";
+    Name::toEscapedString(*nonce_, selectors);
+  }
+  if (exclude_.size() > 0)
+    selectors << "&ndn.Exclude=" << exclude_.toUri();
+
+  ostringstream result;
+
+  result << name_.toUri();
+  string selectorsString(selectors.str());
+  if (selectorsString.size() > 0) {
+    // Replace the first & with ?.
+    result << "?";
+    result.write(&selectorsString[1], selectorsString.size() - 1);
+  }
   
+  return result.str();  
+}
+
 }