Name: Added appendVersion. Added Name::Component::fromNumberWithMarker.
diff --git a/include/ndn-cpp/name.hpp b/include/ndn-cpp/name.hpp
index 59caef8..7d533d0 100644
--- a/include/ndn-cpp/name.hpp
+++ b/include/ndn-cpp/name.hpp
@@ -153,18 +153,29 @@
      * @param escapedString The escaped string.  It does not need to be null-terminated because we only scan to endOffset.
      * @param beginOffset The offset in escapedString of the beginning of the portion to decode.
      * @param endOffset The offset in escapedString of the end of the portion to decode.
-     * @return The component value as a Blob, or a Blob with a null pointer if escapedString is not a valid escaped component.
+     * @return The component value. If the escapedString is not a valid escaped component, then the component value is a null pointer.
      */
-    static Blob 
-    makeFromEscapedString(const char *escapedString, size_t beginOffset, size_t endOffset);
+    static Component 
+    fromEscapedString(const char *escapedString, size_t beginOffset, size_t endOffset);
+
+    /**
+     * Create a component whose value is the network-ordered encoding of the number.
+     * Note: if the number is zero, the result is empty.
+     * @param number The number to be encoded.
+     * @return The component value.
+     */
+    static Component 
+    fromNumber(uint64_t number);
     
     /**
-     * Make a component as the encoded segment number.
-     * @param segment The segment number.
-     * @return The component value as a Blob.
+     * Create a component whose value is the marker appended with the network-ordered encoding of the number.
+     * Note: if the number is zero, no bytes are used for the number - the result will have only the marker.
+     * @param number The number to be encoded.  
+     * @param marker The marker to use as the first byte of the component.
+     * @return The component value.
      */
-    static Blob 
-    makeSegment(unsigned long segment);
+    static Component 
+    fromNumberWithMarker(uint64_t number, uint8_t marker);
   
   private:
     Blob value_;
@@ -398,9 +409,22 @@
    * @return This name so that you can chain calls to append.
    */  
   Name& 
-  appendSegment(unsigned long segment)
+  appendSegment(uint64_t segment)
   {
-    components_.push_back(Component(Component::makeSegment(segment)));
+    components_.push_back(Component::fromNumberWithMarker(segment, 0x00));
+    return *this;
+  }
+
+  /**
+   * Append a component with the encoded version number.
+   * Note that this encodes the exact value of version without converting from a time representation.
+   * @param version The version number.
+   * @return This name so that you can chain calls to append.
+   */  
+  Name& 
+  appendVersion(uint64_t version)
+  {
+    components_.push_back(Component::fromNumberWithMarker(version, 0xFD));
     return *this;
   }
   
diff --git a/ndn-cpp/name.cpp b/ndn-cpp/name.cpp
index 4e619cc..c9b5e7f 100644
--- a/ndn-cpp/name.cpp
+++ b/ndn-cpp/name.cpp
@@ -124,8 +124,8 @@
   return result;
 }
 
-Blob 
-Name::Component::makeFromEscapedString(const char *escapedString, size_t beginOffset, size_t endOffset)
+Name::Component 
+Name::Component::fromEscapedString(const char *escapedString, size_t beginOffset, size_t endOffset)
 {
   string trimmedString(escapedString + beginOffset, escapedString + endOffset);
   trim(trimmedString);
@@ -135,27 +135,43 @@
     // Special case for component of only periods.  
     if (component.size() <= 2)
       // Zero, one or two periods is illegal.  Ignore this component.
-      return Blob();
+      return Component();
     else
       // Remove 3 periods.
-      return Blob((const uint8_t *)&component[3], component.size() - 3); 
+      return Component((const uint8_t *)&component[3], component.size() - 3); 
   }
   else
-    return Blob((const uint8_t *)&component[0], component.size()); 
+    return Component((const uint8_t *)&component[0], component.size()); 
 }
 
-Blob 
-Name::Component::makeSegment(unsigned long segment)
+Name::Component 
+Name::Component::fromNumber(uint64_t number)
 {
   shared_ptr<vector<uint8_t> > value(new vector<uint8_t>());
   
-  // Add the leading zero.
-  value->push_back(0);
+  // First encode in little endian.
+  while (number != 0) {
+    value->push_back(number & 0xff);
+    number >>= 8;
+  }
+  
+  // Make it big endian.
+  reverse(value->begin(), value->end());
+  return Blob(value);
+}
+
+Name::Component 
+Name::Component::fromNumberWithMarker(uint64_t number, uint8_t marker)
+{
+  shared_ptr<vector<uint8_t> > value(new vector<uint8_t>());
+  
+  // Add the leading marker.
+  value->push_back(marker);
   
   // First encode in little endian.
-  while (segment != 0) {
-    value->push_back(segment & 0xff);
-    segment >>= 8;
+  while (number != 0) {
+    value->push_back(number & 0xff);
+    number >>= 8;
   }
   
   // Make it big endian.
@@ -225,9 +241,9 @@
     if (iComponentEnd == string::npos)
       iComponentEnd = uri.size();
     
-    Blob component = Component::makeFromEscapedString(&uri[0], iComponentStart, iComponentEnd);
+    Component component = Component::fromEscapedString(&uri[0], iComponentStart, iComponentEnd);
     // Ignore illegal components.  This also gets rid of a trailing '/'.
-    if (component)
+    if (component.getValue())
       components_.push_back(Component(component));
     
     iComponentStart = iComponentEnd + 1;