The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
More...
#include <uuid.h>
|
| Uuid (const QString &str) noexcept |
| Constructor which creates a Uuid object from a string. More...
|
|
|
QString | mUuid |
| Guaranteed to always contain a valid UUID. More...
|
|
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
This class implements an RFC4122 compliant UUID of type "DCE" in Version 4 (random UUID). Other types and/or versions of UUIDs are considered as invalid. The characters in a UUID are always lowercase.
A valid UUID looks like this: "d79d354b-62bd-4866-996a-78941c575e78"
- Note
- This class guarantees that only Uuid objects representing a valid UUID can be created (in opposite to QUuid which allows "Null UUIDs")! If you need a nullable UUID, use tl::optional<librepcb::Uuid> instead.
- See also
- https://de.wikipedia.org/wiki/Universally_Unique_Identifier
-
https://tools.ietf.org/html/rfc4122
◆ Uuid() [1/3]
Default constructor (disabled to avoid creating invalid UUIDs)
◆ Uuid() [2/3]
Copy constructor.
- Parameters
-
◆ ~Uuid()
◆ Uuid() [3/3]
Uuid |
( |
const QString & |
str | ) |
|
|
inlineexplicitprivatenoexcept |
Constructor which creates a Uuid object from a string.
- Parameters
-
str | The uuid as a string (lowercase and without braces) |
◆ toStr()
Get the UUID as a string (without braces)
- Returns
- The UUID as a string
◆ operator=()
Operator overloadings.
- Parameters
-
rhs | The other object to compare |
- Returns
- Result of comparing the UUIDs as strings
◆ operator==()
bool operator== |
( |
const Uuid & |
rhs | ) |
const |
|
inlinenoexcept |
◆ operator!=()
bool operator!= |
( |
const Uuid & |
rhs | ) |
const |
|
inlinenoexcept |
◆ operator<()
bool operator< |
( |
const Uuid & |
rhs | ) |
const |
|
inlinenoexcept |
◆ operator>()
bool operator> |
( |
const Uuid & |
rhs | ) |
const |
|
inlinenoexcept |
◆ operator<=()
bool operator<= |
( |
const Uuid & |
rhs | ) |
const |
|
inlinenoexcept |
◆ operator>=()
bool operator>= |
( |
const Uuid & |
rhs | ) |
const |
|
inlinenoexcept |
◆ isValid()
bool isValid |
( |
const QString & |
str | ) |
|
|
staticnoexcept |
Check if a string is a valid UUID.
- Parameters
-
- Return values
-
true | If str is a valid UUID |
false | If str is not a valid UUID |
◆ createRandom()
Create a new random UUID.
- Returns
- The new UUID
◆ fromString()
Uuid fromString |
( |
const QString & |
str | ) |
|
|
static |
Create Uuid from a string.
- Parameters
-
- Returns
- The created Uuid object
- Exceptions
-
Exception | if the string does not contain a valid UUID |
◆ tryFromString()
tl::optional< Uuid > tryFromString |
( |
const QString & |
str | ) |
|
|
staticnoexcept |
Try creating a Uuid from a string, returning empty optional if invalid.
- Parameters
-
- Return values
-
Uuid | The created Uuid object if str was valid |
tl::nullopt | If str was not a valid UUID |
◆ mUuid
Guaranteed to always contain a valid UUID.
The documentation for this class was generated from the following files:
- /__w/1/s/libs/librepcb/core/types/uuid.h
- /__w/1/s/libs/librepcb/core/types/uuid.cpp