X-Git-Url: http://git.vrable.net/?a=blobdiff_plain;f=ref.cc;h=ce16cb8914fa649dd40fce3dc0f18a363cee0ac8;hb=534e35d886de4eb7b6022c0ecb4a804475c820ea;hp=e996c7dc7a7af6e022e90882d2da4f119c6a37c9;hpb=3cfc1643082e60fea72539033b7adb094d236b0a;p=cumulus.git diff --git a/ref.cc b/ref.cc index e996c7d..ce16cb8 100644 --- a/ref.cc +++ b/ref.cc @@ -28,6 +28,10 @@ string generate_uuid() return string(buf); } +ObjectReference::ObjectReference() + : segment(""), object("") +{ +} ObjectReference::ObjectReference(const std::string& segment, int sequence) : segment(segment) @@ -40,6 +44,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 +67,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; +}