20#ifndef LIBREPCB_CORE_UUID_H
21#define LIBREPCB_CORE_UUID_H
26#include "../qtcompat.h"
30#include <optional.hpp>
59 Q_DECLARE_TR_FUNCTIONS(
Uuid)
120 static bool isValid(
const QString& str)
noexcept;
157 explicit
Uuid(const QString& str) noexcept :
mUuid(str) {}
168 stream << uuid.toStr();
173 stream << QString(
"Uuid(%1)").arg(uuid.toStr());
184inline ::librepcb::QtCompat::Hash
qHash(
185 const optional<librepcb::Uuid>& key,
uint Hash
Return type of Qt's qHash() function.
Definition: qtcompat.h:58
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition: uuid.h:58
Uuid & operator=(const Uuid &rhs) noexcept
Operator overloadings.
Definition: uuid.h:98
static tl::optional< Uuid > tryFromString(const QString &str) noexcept
Try creating a Uuid from a string, returning empty optional if invalid.
Definition: uuid.cpp:119
QString mUuid
Guaranteed to always contain a valid UUID.
Definition: uuid.h:160
QString toStr() const noexcept
Get the UUID as a string (without braces)
Definition: uuid.h:88
Uuid(const Uuid &other) noexcept
Copy constructor.
Definition: uuid.h:74
bool operator>(const Uuid &rhs) const noexcept
Definition: uuid.h:105
bool operator==(const Uuid &rhs) const noexcept
Definition: uuid.h:102
bool operator!=(const Uuid &rhs) const noexcept
Definition: uuid.h:103
Uuid()=delete
Default constructor (disabled to avoid creating invalid UUIDs)
~Uuid() noexcept=default
Destructor.
bool operator>=(const Uuid &rhs) const noexcept
Definition: uuid.h:107
bool operator<(const Uuid &rhs) const noexcept
Definition: uuid.h:104
static Uuid createRandom() noexcept
Create a new random UUID.
Definition: uuid.cpp:99
static bool isValid(const QString &str) noexcept
Check if a string is a valid UUID.
Definition: uuid.cpp:40
bool operator<=(const Uuid &rhs) const noexcept
Definition: uuid.h:106
static Uuid fromString(const QString &str)
Create Uuid from a string.
Definition: uuid.cpp:110
Definition: occmodel.cpp:77
QtCompat::Hash qHash(const AttributeKey &key, QtCompat::Hash seed=0) noexcept
Definition: attributekey.h:119
QDataStream & operator<<(QDataStream &stream, const AttributeKey &obj)
Definition: attributekey.h:109
inline ::librepcb::QtCompat::Hash qHash(const optional< librepcb::Uuid > &key, ::librepcb::QtCompat::Hash seed=0) noexcept
Definition: uuid.h:184