name: Updating toEscapedString interface
Actual implementation is now based on const buffer, not const
std::vector.
Change-Id: Ie29c4be9df7cba0f1e71adb6b3684c9da23a0836
diff --git a/include/ndn-cpp/name.hpp b/include/ndn-cpp/name.hpp
index b6b2e01..192fa31 100644
--- a/include/ndn-cpp/name.hpp
+++ b/include/ndn-cpp/name.hpp
@@ -588,17 +588,34 @@
* @param result the string stream to write to.
*/
static void
- toEscapedString(const std::vector<uint8_t>& value, std::ostream& result);
+ toEscapedString(const uint8_t *value, size_t valueSize, std::ostream& result);
+ inline static void
+ toEscapedString(const std::vector<uint8_t>& value, std::ostream& result)
+ {
+ toEscapedString(&*value.begin(), value.size(), 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<uint8_t>& value);
+ inline static std::string
+ toEscapedString(const uint8_t *value, size_t valueSize)
+ {
+ std::ostringstream result;
+ toEscapedString(value, valueSize, result);
+ return result.str();
+ }
+ static inline std::string
+ toEscapedString(const std::vector<uint8_t>& value)
+ {
+ return toEscapedString(&*value.begin(), value.size());
+ }
+
//
// vector equivalent interface.
//