Index: src/OFUUID.h ================================================================== --- src/OFUUID.h +++ src/OFUUID.h @@ -38,10 +38,26 @@ * * @return A new, autoreleased OFUUID */ + (instancetype)UUID; +/** + * @brief Creates a new UUID with the specified bytes. + * + * @param bytes The bytes for the UUID + * @return A new, autoreleased OFUUID + */ ++ (instancetype)UUIDWithUUIDBytes: (const unsigned char [_Nonnull 16])bytes; + +/** + * @brief Creates a new UUID with the specified UUID string. + * + * @param string The UUID string for the UUID + * @return A new, autoreleased OFUUID + */ ++ (instancetype)UUIDWithUUIDString: (OFString *)string; + /** * @brief Initializes an already allocated OFUUID as a new random UUID as per * RFC 4122 version 4. * * @return An initialized OFUUID Index: src/OFUUID.m ================================================================== --- src/OFUUID.m +++ src/OFUUID.m @@ -28,10 +28,20 @@ @implementation OFUUID + (instancetype)UUID { return [[[self alloc] init] autorelease]; } + ++ (instancetype)UUIDWithUUIDBytes: (const unsigned char [16])bytes +{ + return [[[self alloc] initWithUUIDBytes: bytes] autorelease]; +} + ++ (instancetype)UUIDWithUUIDString: (OFString *)string +{ + return [[[self alloc] initWithUUIDString: string] autorelease]; +} - (instancetype)init { uint64_t r;