#include <ut_uuid.h>
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_UUID & | operator= (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_UUID & | getNull () |
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 *) |
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.
| virtual UT_UUID::~UT_UUID | ( | ) | [inline, virtual] |
| UT_UUID::UT_UUID | ( | ) | [protected] |
| 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.
References _getRandomBytes(), MAX_ADJUSTMENT, and UT_gettimeofday().
Referenced by _makeUUID(), and resetTime().
| 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] |
References uuid::time_high_and_version, uuid::time_low, and uuid::time_mid.
Referenced by getTime().
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::_makeUUID | ( | struct uuid & | u | ) | [private] |
References _getClock(), _getRandomBytes(), uuid::clock_seq, gchar, XAP_App::getApp(), XAP_App::getPrefsValueBool(), uuid::node, s_bInitDone, s_node, uuid::time_high_and_version, uuid::time_low, uuid::time_mid, UT_getEthernetAddress(), and XAP_PREF_KEY_NoMACinUUID.
Referenced by makeUUID().
| 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.
| 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] |
Referenced by AD_Document::getHistoryNthUID().
| 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 |
References m_uuid, uuid::time_high_and_version, uuid::time_low, and uuid::time_mid.
| bool UT_UUID::isOlder | ( | const UT_UUID & | u | ) | const |
References m_uuid, uuid::time_high_and_version, uuid::time_low, and uuid::time_mid.
| bool UT_UUID::isValid | ( | ) | const [inline] |
| 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::makeUUID | ( | ) |
generate new UUID and set the internal value to it
References _makeUUID(), m_bIsValid, and m_uuid.
Referenced by UT_Win32UUIDGenerator::createUUID(), UT_UUIDGenerator::createUUID(), UT_UUIDGenerator::getNewUUID32(), UT_UUIDGenerator::getNewUUID64(), AD_VersionData::newUID(), AD_Document::setDocUUID(), AD_Document::setMyUUID(), AD_Document::setOrigUUID(), and UT_UUID().
| bool UT_UUID::operator!= | ( | const UT_UUID & | u | ) | const |
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 |
References uuid::clock_seq, m_uuid, uuid::node, uuid::time_high_and_version, uuid::time_low, and uuid::time_mid.
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 |
References uuid::clock_seq, m_uuid, uuid::node, uuid::time_high_and_version, uuid::time_low, and uuid::time_mid.
| bool UT_UUID::resetTime | ( | ) |
References _getClock(), uuid::clock_seq, m_uuid, uuid::time_high_and_version, uuid::time_low, and uuid::time_mid.
Referenced by AD_Document::getNewUUID().
| 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().
| UT_Option< std::string > UT_UUID::toString | ( | ) | const |
convert internal state to string
References _toString(), m_bIsValid, m_uuid, and UT_return_val_if_fail.
Referenced by s_AbiWord_1_Listener::_handleHistory(), AD_Document::AD_Document(), PD_XMLIDCreator::createUniqueXMLID(), AD_Document::getDocUUIDString(), PX_ChangeRecord::isFromThisDoc(), AD_Document::isOrigUUID(), AD_Document::setMyUUID(), AD_Document::setOrigUUID(), TelepathyAccountHandler::startSession(), and AbiCollabSessionManager::startSession().
References uuid::clock_seq, uuid::node, uuid::time_high_and_version, uuid::time_low, and uuid::time_mid.
Referenced by PX_ChangeRecord::getDocUUID(), and PX_ChangeRecord::isFromThisDoc().
friend class UT_UUIDGenerator [friend] |
| void UT_UUIDGenerator__test | ( | UT_UUIDGenerator * | self | ) | [friend] |
bool UT_UUID::m_bIsValid [private] |
Referenced by clear(), getTime(), getType(), getVariant(), makeUUID(), operator=(), setUUID(), toBinary(), toString(), and UT_UUID().
uuid UT_UUID::m_uuid [private] |
Referenced by clear(), getTime(), getType(), getVariant(), hash32(), hash64(), isNull(), isOfSameAge(), isOlder(), isYounger(), makeUUID(), operator!=(), operator<(), operator=(), operator==(), operator>(), resetTime(), setUUID(), toBinary(), toString(), and UT_UUID().
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] |
1.7.1