Name: Added toEscapedString to Component.
diff --git a/ndn-cpp/name.cpp b/ndn-cpp/name.cpp
index 86cb843..11d284c 100644
--- a/ndn-cpp/name.cpp
+++ b/ndn-cpp/name.cpp
@@ -301,4 +301,12 @@
}
}
+string
+Name::toEscapedString(const vector<unsigned char>& value)
+{
+ ostringstream result;
+ toEscapedString(value, result);
+ return result.str();
+}
+
}
diff --git a/ndn-cpp/name.hpp b/ndn-cpp/name.hpp
index 8129979..453b939 100644
--- a/ndn-cpp/name.hpp
+++ b/ndn-cpp/name.hpp
@@ -75,6 +75,29 @@
const Blob&
getValue() const { return value_; }
+
+ /**
+ * Write this component value to result, escaping characters according to the NDN URI Scheme.
+ * This also adds "..." to a value with zero or more ".".
+ * @param value the buffer with the value to escape
+ * @param result the string stream to write to.
+ */
+ void
+ toEscapedString(std::ostringstream& result)
+ {
+ Name::toEscapedString(*value_, result);
+ }
+
+ /**
+ * Convert this component value by escaping characters according to the NDN URI Scheme.
+ * This also adds "..." to a value with zero or more ".".
+ * @return The escaped string.
+ */
+ std::string
+ toEscapedString()
+ {
+ return Name::toEscapedString(*value_);
+ }
/**
* Make a component value by decoding the escapedString between beginOffset and endOffset according to the NDN URI Scheme.
@@ -233,6 +256,15 @@
static void
toEscapedString(const std::vector<unsigned char>& value, std::ostringstream& result);
+ /**
+ * Convert the value by escaping characters according to the NDN URI Scheme.
+ * This also adds "..." to a value with zero or more ".".
+ * @param value the buffer with the value to escape
+ * @return The escaped string.
+ */
+ static std::string
+ toEscapedString(const std::vector<unsigned char>& value);
+
private:
std::vector<Component> components_;
};