A few minor adjustments to the ObjectReference interface.
[cumulus.git] / ref.cc
diff --git a/ref.cc b/ref.cc
index e996c7d..ff710d2 100644 (file)
--- a/ref.cc
+++ b/ref.cc
@@ -40,6 +40,14 @@ ObjectReference::ObjectReference(const std::string& segment, int sequence)
     clear_range();
 }
 
+ObjectReference::ObjectReference(const std::string& segment,
+                                 const std::string& sequence)
+    : segment(segment), object(sequence)
+{
+    clear_checksum();
+    clear_range();
+}
+
 string ObjectReference::to_string() const
 {
     string result = segment + "/" + object;
@@ -55,3 +63,12 @@ string ObjectReference::to_string() const
 
     return result;
 }
+
+/* Parse a string object reference and return a pointer to a new
+ * ObjectReference.  The caller is responsible for freeing the object.  NULL is
+ * returned if there is an error in the syntax. */
+ObjectReference *ObjectReference::parse(const std::string& s)
+{
+    // TODO: Implement
+    return NULL;
+}