#include <bdlb_guidutil.h>
This struct
provides a namespace for functions that create Universally Unique Identifiers per RFC 4122 (http://www.ietf.org/rfc/rfc4122.txt).
◆ dnsNamespace()
static Guid bdlb::GuidUtil::dnsNamespace |
( |
| ) |
|
|
static |
Return the pre-defined namespace ID for the DNS namespace from Appendix C of RFC 4122, for use with the generateFromName
method when the name string is a fully-qualified domain name.
◆ generate() [1/3]
static Guid bdlb::GuidUtil::generate |
( |
| ) |
|
|
static |
Generate and return a single GUID meeting the RFC 4122 version 4 specification, consisting of 122 randomly generated bits, two "variant" bits set to 10
, and four "version" bits set to 0100
.
◆ generate() [2/3]
void bdlb::GuidUtil::generate |
( |
Guid * |
result, |
|
|
bsl::size_t |
numGuids = 1 |
|
) |
| |
|
inlinestatic |
Generate a sequence of GUIDs meeting the RFC 4122 version 4 specification, and load the resulting GUIDs into the array referred to by the specified result
. Optionally specify numGuids
, indicating the number of GUIDs to load into the result
array. If numGuids
is not supplied, a default of 1 is used. An RFC 4122 version 4 GUID consists of 122 randomly generated bits, two "variant" bits set to 10
, and four "version" bits set to 0100
. The behavior is undefined unless result
refers to a contiguous sequence of at least numGuids
Guid
objects.
◆ generate() [3/3]
static void bdlb::GuidUtil::generate |
( |
unsigned char * |
result, |
|
|
bsl::size_t |
numGuids = 1 |
|
) |
| |
|
static |
- Deprecated:
- Use generate(Guid *, size_t) instead.
Generate a sequence of GUIDs meeting the RFC 4122 version 4 specification, and load the bytes of the resulting GUIDs into the array referred to by the specified result
. Optionally specify numGuids
, indicating the number of GUIDs to load into the result
array. If numGuids
is not supplied, a default of 1 is used. An RFC 4122 version 4 GUID consists of 122 randomly generated bits, two "variant" bits set to 10
, and four "version" bits set to 0100
. The behavior is undefined unless result
refers to a contiguous sequence of at least 16 * numGuids
bytes.
◆ generateFromName()
Generate and return a single GUID meeting the RFC 4122 version 5 specification from the specified namespaceId
and name
. namespaceId
may (but need not) be one of the pre-defined namespace IDs. Note that this method is a pure function of its arguments.
◆ generateNonSecure() [1/2]
static Guid bdlb::GuidUtil::generateNonSecure |
( |
| ) |
|
|
static |
Generate and return a single GUID meeting the RFC 4122 version 4 specification, consisting of 122 randomly generated bits, two "variant" bits set to 10
, and four "version" bits set to 0100
. Note that this function generates high quality, albeit not cryptographically secure, random numbers for GUIDs.
◆ generateNonSecure() [2/2]
static void bdlb::GuidUtil::generateNonSecure |
( |
Guid * |
result, |
|
|
bsl::size_t |
numGuids = 1 |
|
) |
| |
|
static |
Generate a sequence of GUIDs meeting the RFC 4122 version 4 specification, and load the resulting GUIDs into the array referred to by the specified result
. Optionally specify numGuids
, indicating the number of GUIDs to load into the result
array. If numGuids
is not supplied, a default of 1 is used. An RFC 4122 version 4 GUID consists of 122 randomly generated bits, two "variant" bits set to 10
, and four "version" bits set to 0100
. The behavior is undefined unless result
refers to a contiguous sequence of at least numGuids
Guid
objects. Note that this function generates high quality, albeit not cryptographically secure, random numbers for GUIDs.
◆ getLeastSignificantBits()
◆ getMostSignificantBits()
◆ getVersion()
int bdlb::GuidUtil::getVersion |
( |
const bdlb::Guid & |
guid | ) |
|
|
inlinestatic |
Return the version of the specified guid
object. The behavior is undefined unless the contents of the guid
object are compliant with RFC 4122.
◆ guidFromString() [1/2]
Parse the specified guidString
(in {GUID String Format}) and return the converted GUID, or a default-constructed Guid
if the string is improperly formatted.
◆ guidFromString() [2/2]
Parse the specified guidString
(in {GUID String Format}) and load its value into the specified result
. Return 0 if result
successfully loaded, and a non-zero value otherwise.
◆ guidToString() [1/3]
static void bdlb::GuidUtil::guidToString |
( |
bsl::string * |
result, |
|
|
const Guid & |
guid |
|
) |
| |
|
static |
◆ guidToString() [2/3]
Convert the specified guid
into a string suitable for guidFromString
, and return the string.
◆ guidToString() [3/3]
static void bdlb::GuidUtil::guidToString |
( |
std::string * |
result, |
|
|
const Guid & |
guid |
|
) |
| |
|
static |
Serialize the specified guid
into the specified result
. The result
string will be in a format suitable for guidFromString
.
◆ oidNamespace()
static Guid bdlb::GuidUtil::oidNamespace |
( |
| ) |
|
|
static |
Return the pre-defined namespace ID for the OID namespace from Appendix C of RFC 4122, for use with the generateFromName
method when the name string is an ISO Object ID (OID).
◆ urlNamespace()
static Guid bdlb::GuidUtil::urlNamespace |
( |
| ) |
|
|
static |
Return the pre-defined namespace ID for the URL namespace from Appendix C of RFC 4122, for use with the generateFromName
method when the name string is a URL.
◆ x500Namespace()
static Guid bdlb::GuidUtil::x500Namespace |
( |
| ) |
|
|
static |
Return the pre-defined namespace ID for the X500 namespace from Appendix C of RFC 4122, for use with the generateFromName
method when the name string is an X.500 Distinguished Name.
The documentation for this struct was generated from the following file: