From 87fa2298eb73bf6213ec836937c236df25e2a4a7 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Tue, 26 Jun 2012 14:34:55 +0000 Subject: Changed the Bu::Uuid generate interface. It's now one function that takes a type parameter. I think it's much nicer overall, the old gen function is stil there for now, but marked deprecated. --- src/unstable/uuid.h | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'src/unstable/uuid.h') diff --git a/src/unstable/uuid.h b/src/unstable/uuid.h index 73b34bc..de20d4c 100644 --- a/src/unstable/uuid.h +++ b/src/unstable/uuid.h @@ -8,6 +8,7 @@ #ifndef BU_UUID_H #define BU_UUID_H +#include "bu/util.h" #include "bu/string.h" namespace Bu @@ -26,20 +27,27 @@ namespace Bu Bu::String toString() const; Bu::String toUrn() const; + enum Type + { + System, + Version1, + Version2, + Version3, + Version4, + Version5, + }; + int getVersion(); - static Uuid gen(); - static Uuid genV1(); - static Uuid genV2(); - static Uuid genV3(); - static Uuid genV4(); - static Uuid genV5(); + static Uuid generate( Type eType = System ); + DEPRECATED static Uuid gen() { return generate(); } void clear(); void set( const Bu::String &sSrc ); bool operator==( const Uuid &rhs ) const; Uuid &operator=( const Bu::String &rhs ) { set( rhs ); return *this; } + Uuid &operator=( const Uuid &rhs ); private: unsigned char data[16]; -- cgit v1.2.3