Class uuid

Synopsis

#include "breeze/uuid/uuid.hpp"

class uuid
    :   private equality_comparison< uuid >

Description

A universally unique identifier.

Inheritance

Ancestors: equality_comparison< uuid >

Classes

lessImplements a strict weak ordering relation between uuid objects. Useful for ordered associative containers.

Methods

uuid overloadConstructs a nil uuid, i.e
uuid overloadConstructs a uuid having the given variant and version.
is_equalReturns: Whether *this is equal to other
nilA named alternative to the default constructor.
variantReturns: The variant of the uuid.
versionReturns: The version of the uuid.

Source

Lines 28-103 in breeze/uuid/uuid.hpp.

class uuid
    :   private equality_comparison< uuid >
{
public:
    //!     A type to represent the variant of the uuid.
    // -----------------------------------------------------------------------
    enum variant_type { ncs, rfc_4122, microsoft, future } ;

    //!     A type to represent the version of the uuid (meaningful only
    //!     when the variant is <code>rfc_4122</code>).
    // -----------------------------------------------------------------------
    enum version_type { time_based = 1, dce_security = 2, name_based_md5 = 3,
                        pseudo_random = 4, name_based_sha1 = 5 } ;

    //!     Constructs a nil uuid, i.e. a uuid that has all 128 bits set
    //!     to zero.
    // -----------------------------------------------------------------------
                        uuid() noexcept ;

    //!     Constructs a uuid having the given variant and version.
    // -----------------------------------------------------------------------
                        uuid( variant_type, version_type ) ;

    //!     \pre
    //!         \c *this is not a nil uuid.
    //!
    //!     \return
    //!         The variant of the uuid.
    // -----------------------------------------------------------------------
    variant_type        variant() const ;

    //!     \pre
    //!         \c *this is not a nil uuid.
    //!
    //!     \return
    //!         The version of the uuid.
    // -----------------------------------------------------------------------
    version_type        version() const ;

    //!     A named alternative to the default constructor.
    //!
    //!     \return
    //!         uuid()
    // -----------------------------------------------------------------------
    static uuid         nil() noexcept ;

    //!     \return
    //!         Whether \c *this is equal to \c other. Used by a base
    //!         class to provide <code>operator ==()</code> and <code>
    //!         operator !=()</code>.
    // -----------------------------------------------------------------------
    bool                is_equal( uuid const & other ) const noexcept ;

    //      less:
    //      =====
    //
    //!     \brief
    //!         Implements a strict weak ordering relation between uuid
    //!         objects. Useful for ordered associative containers.
    // -----------------------------------------------------------------------
    class               less
    {
    public:
        bool                operator()( uuid const & u1,
                                        uuid const & u2 ) const noexcept ;
    } ;

private:
    uint8_t             m_octets[ 16 ] ;

    //!     Outputs \c uu to the provided \c std::ostream, in the format
    //!     prescribed by RFC 4122 (in particular, the letters 'a' to
    //!     'f' are output as lowercase).
    // -----------------------------------------------------------------------
    friend std::ostream & operator <<( std::ostream &, uuid const & uu ) ;
} ;