In Component, added constructor that takes a Blob.
diff --git a/ndn-cpp/name.hpp b/ndn-cpp/name.hpp
index fe250ff..5657efa 100644
--- a/ndn-cpp/name.hpp
+++ b/ndn-cpp/name.hpp
@@ -44,6 +44,15 @@
: value_(value, valueLen)
{
}
+
+ /**
+ * Create a new Name::Component, taking another pointer to the Blob value.
+ * @param value A blob with a pointer to an immutable array. The pointer is copied.
+ */
+ Component(const Blob &value)
+ : value_(value)
+ {
+ }
/**
* Set the componentStruct to point to this component, without copying any memory.
@@ -129,14 +138,21 @@
/**
* Add a new component, copying from value of length valueLength.
*/
- void addComponent(const unsigned char *value, unsigned int valueLength) {
+ void addComponent(const unsigned char *value, unsigned int valueLength)
+ {
components_.push_back(Component(value, valueLength));
}
/**
* Add a new component, copying from value.
*/
- void addComponent(const std::vector<unsigned char>& value) {
+ void addComponent(const std::vector<unsigned char>& value)
+ {
+ components_.push_back(value);
+ }
+
+ void addComponent(const Blob &value)
+ {
components_.push_back(value);
}