Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | Friends

UT_UUID Class Reference

#include <ut_uuid.h>

Inheritance diagram for UT_UUID:
UT_Win32UUID

List of all members.

Public Member Functions

virtual ~UT_UUID ()
bool makeUUID ()
bool makeUUID (std::string &out)
bool setUUID (const std::string &s)
bool setUUID (const char *s)
bool setUUID (const struct uuid &u)
UT_Option< std::string > toString () const
bool toBinary (struct uuid &u) const
UT_uint32 hash32 () const
UT_uint64 hash64 () const
time_t getTime () const
UT_sint32 getType () const
UT_UUIDVariant getVariant () const
bool resetTime ()
bool operator== (const UT_UUID &u) const
bool operator!= (const UT_UUID &u) const
bool operator< (const UT_UUID &u) const
bool operator> (const UT_UUID &u) const
UT_UUIDoperator= (const UT_UUID &u)
bool isOlder (const UT_UUID &u) const
bool isYounger (const UT_UUID &u) const
bool isOfSameAge (const UT_UUID &u) const
bool isValid () const
bool isNull () const
void clear ()

Static Public Member Functions

static bool toStringFromBinary (char *s, UT_uint32 len, const struct uuid &u)
static const UT_UUIDgetNull ()

Protected Member Functions

 UT_UUID ()
 UT_UUID (const std::string &s)
 UT_UUID (const char *s)
 UT_UUID (const struct uuid &u)
 UT_UUID (const UT_UUID &u)
virtual bool _getRandomBytes (void *buf, int nbytes) const

Private Member Functions

bool _parse (const char *in, struct uuid &u) const
bool _makeUUID (struct uuid &u)
std::string _toString (const struct uuid &uu) const
bool _getClock (UT_uint32 &iHigh, UT_uint32 &iLow, UT_uint16 &iSeq) const

Static Private Member Functions

static time_t _getTime (const struct uuid &uu)
static UT_sint32 _getType (const struct uuid &uu)
static UT_UUIDVariant _getVariant (const struct uuid &uu)

Private Attributes

uuid m_uuid
bool m_bIsValid

Static Private Attributes

static bool s_bInitDone = false
static unsigned char s_node [6] = {0,0,0,0,0,0}
static UT_UUID s_Null

Friends

class UT_UUIDGenerator
void UT_UUIDGenerator__test (UT_UUIDGenerator *)

Detailed Description

Class for generating and managing UUIDs

On platforms which provide means of generating random data that is superior to calling UT_rand() a platform specific derrived class should implement virtual _getRandomBytes().

If a derived class is created, it will need to be accompanied by corresponding derived UT_UUIDGenerator class (described below) and the call in xap_*App constructor to _setUUIDGenerator() will need to be passed an instance of the platfrom-specific class.


Constructor & Destructor Documentation

virtual UT_UUID::~UT_UUID (  )  [inline, virtual]
UT_UUID::UT_UUID (  )  [protected]

This constructor is used if the object is only used to generate new UUIDs or if the uuid is to be set subsequently by setUUID(); it creates a NULL uuid

References m_uuid.

UT_UUID::UT_UUID ( const std::string &  s  )  [protected]

The following two constructors instantiate the class from existing UUIDs for further processing

References _parse(), m_bIsValid, m_uuid, and makeUUID().

UT_UUID::UT_UUID ( const char *  s  )  [protected]

References _parse(), m_bIsValid, m_uuid, and makeUUID().

UT_UUID::UT_UUID ( const struct uuid u  )  [protected]

References isNull(), m_bIsValid, and m_uuid.

UT_UUID::UT_UUID ( const UT_UUID u  )  [protected]

copy constructor

References m_bIsValid, and m_uuid.


Member Function Documentation

bool UT_UUID::_getClock ( UT_uint32 iHigh,
UT_uint32 iLow,
UT_uint16 iSeq 
) const [private]
virtual bool UT_UUID::_getRandomBytes ( void *  buf,
int  nbytes 
) const [protected, virtual]

Referenced by _getClock(), and _makeUUID().

time_t UT_UUID::_getTime ( const struct uuid uu  )  [static, private]
UT_sint32 UT_UUID::_getType ( const struct uuid uu  )  [static, private]

References uuid::time_high_and_version.

Referenced by getType().

UT_UUIDVariant UT_UUID::_getVariant ( const struct uuid uu  )  [static, private]

References uuid::clock_seq.

Referenced by getVariant().

bool UT_UUID::_parse ( const char *  in,
struct uuid uuid 
) const [private]

parse UUID string into the internal uuid struct

References uuid::clock_seq, uuid::node, uuid::time_high_and_version, uuid::time_low, uuid::time_mid, and UT_return_val_if_fail.

Referenced by setUUID(), and UT_UUID().

std::string UT_UUID::_toString ( const struct uuid uu  )  const [private]

Referenced by makeUUID(), and toString().

void UT_UUID::clear ( void   ) 

Reset internal state to NULL uuid

References m_bIsValid, and m_uuid.

static const UT_UUID& UT_UUID::getNull (  )  [inline, static]
time_t UT_UUID::getTime (  )  const

retrive the time at which the UUID was created

References _getTime(), m_bIsValid, m_uuid, and UT_return_val_if_fail.

Referenced by AD_VersionData::AD_VersionData(), XAP_Dialog_History::getHeaderValue(), and AD_VersionData::getTime().

UT_sint32 UT_UUID::getType ( void   )  const

get the type of the UUID; internal and external variant

References _getType(), m_bIsValid, m_uuid, and UT_return_val_if_fail.

UT_UUIDVariant UT_UUID::getVariant (  )  const

get the variant of the UUID

References _getVariant(), m_bIsValid, m_uuid, UT_return_val_if_fail, and UT_UUID_VARIANT_ERROR.

UT_uint32 UT_UUID::hash32 (  )  const

References m_uuid.

Referenced by UT_UUIDGenerator::getNewUUID32().

UT_uint64 UT_UUID::hash64 (  )  const

References m_uuid.

Referenced by UT_UUIDGenerator::getNewUUID64().

bool UT_UUID::isNull (  )  const

References isValid(), m_uuid, and UT_return_val_if_fail.

Referenced by setUUID(), TFTEST_MAIN(), and UT_UUID().

bool UT_UUID::isOfSameAge ( const UT_UUID u  )  const
bool UT_UUID::isOlder ( const UT_UUID u  )  const
bool UT_UUID::isYounger ( const UT_UUID u  )  const

Operators for temporal comparisons.

References m_uuid, uuid::time_high_and_version, uuid::time_low, and uuid::time_mid.

bool UT_UUID::makeUUID ( std::string &  s  ) 

generate new UUID into provided string

References _makeUUID(), and _toString().

bool UT_UUID::operator!= ( const UT_UUID u  )  const
bool UT_UUID::operator< ( const UT_UUID u  )  const
UT_UUID & UT_UUID::operator= ( const UT_UUID u  ) 

Assignment operator.

References m_bIsValid, and m_uuid.

bool UT_UUID::operator== ( const UT_UUID u  )  const

comparison operators working over the UUID space (not temporal !!!)

References uuid::clock_seq, m_uuid, uuid::node, uuid::time_high_and_version, uuid::time_low, and uuid::time_mid.

bool UT_UUID::operator> ( const UT_UUID u  )  const
bool UT_UUID::resetTime (  ) 
bool UT_UUID::setUUID ( const struct uuid u  ) 

References isNull(), m_bIsValid, and m_uuid.

bool UT_UUID::setUUID ( const std::string &  s  ) 

Set internal state to the given value represented by string

References _parse(), m_bIsValid, and m_uuid.

Referenced by AD_Document::setDocUUID(), AD_Document::setMyUUID(), and AD_Document::setOrigUUID().

bool UT_UUID::setUUID ( const char *  s  ) 

References _parse(), m_bIsValid, and m_uuid.

bool UT_UUID::toBinary ( struct uuid u  )  const

References m_bIsValid, and m_uuid.

Referenced by PX_ChangeRecord::setDocument().

bool UT_UUID::toStringFromBinary ( char *  s,
UT_uint32  len,
const struct uuid u 
) [static]

Friends And Related Function Documentation

friend class UT_UUIDGenerator [friend]
void UT_UUIDGenerator__test ( UT_UUIDGenerator self  )  [friend]

Member Data Documentation

bool UT_UUID::s_bInitDone = false [static, private]

Referenced by _makeUUID().

unsigned char UT_UUID::s_node = {0,0,0,0,0,0} [static, private]

Referenced by _makeUUID().

UT_UUID UT_UUID::s_Null [static, private]

The documentation for this class was generated from the following files: