Added appendSegment
diff --git a/ndn-cpp/name.hpp b/ndn-cpp/name.hpp
index 5d707a3..2baee7d 100644
--- a/ndn-cpp/name.hpp
+++ b/ndn-cpp/name.hpp
@@ -65,6 +65,12 @@
bool setFromEscapedString(const char *first, const char *last);
const std::vector<unsigned char> &getValue() const { return value_; }
+
+ /**
+ * Set this component to the encoded segment number.
+ * @param segment The segment number.
+ */
+ void setSegment(unsigned long segment);
private:
std::vector<unsigned char> value_;
@@ -141,6 +147,16 @@
{
return toUri();
}
+
+ /**
+ * Append a component with the encoded segment number.
+ * @param segment The segment number.
+ */
+ void appendSegment(unsigned long segment)
+ {
+ components_.push_back(Component());
+ components_.back().setSegment(segment);
+ }
private:
std::vector<Component> components_;