Use static method instead of a constructor for random Uuids.

This commit is contained in:
Felix Geyer 2010-08-14 12:44:55 +02:00
parent d8b21c8b04
commit a3211872e0
3 changed files with 8 additions and 10 deletions

View File

@ -19,6 +19,7 @@
TimeInfo::TimeInfo()
{
m_expires = false;
}
QDateTime TimeInfo::lastModificationTime() const

View File

@ -25,15 +25,6 @@ Uuid::Uuid() : m_data(length, 0)
{
}
Uuid::Uuid(bool generate) : m_data(length, 0)
{
if (generate) {
while (isNull()) {
// TODO
}
}
}
Uuid::Uuid(const QByteArray& data)
{
Q_ASSERT(data.size() == 16);
@ -41,6 +32,12 @@ Uuid::Uuid(const QByteArray& data)
m_data = data;
}
Uuid Uuid::random() {
QByteArray randomAray;
// TODO fill with random data
return Uuid(randomAray);
}
QString Uuid::toBase64() const
{
return m_data.toBase64();

View File

@ -25,8 +25,8 @@ class Uuid
{
public:
Uuid();
explicit Uuid(bool generate);
explicit Uuid(const QByteArray& data);
static Uuid random();
QString toBase64() const;
QByteArray toByteArray() const;
bool isNull() const;