1 /* LBS: An LFS-inspired filesystem backup system
2 * Copyright (C) 2007 Michael Vrable
4 * Backups are structured as a collection of objects, which may refer to other
5 * objects. Object references are used to name other objects or parts of them.
6 * This file defines the class for representing object references and the
7 * textual representation of these references. */
11 #include <uuid/uuid.h>
19 /* Generate a new UUID, and return the text representation of it. This is
20 * suitable for generating the name for a new segment. */
21 string generate_uuid()
27 uuid_unparse_lower(uuid, buf);
32 ObjectReference::ObjectReference(const std::string& segment, int sequence)
36 sprintf(seq_buf, "%08x", sequence);
43 string ObjectReference::to_string() const
45 string result = segment + "/" + object;
48 result += "(" + checksum + ")";
52 sprintf(buf, "[%zu+%zu]", range_start, range_length);