src/uuid.cpp

Mon, 23 Sep 2019 14:06:36 +0300

author
Teemu Piippo <teemu@hecknology.net>
date
Mon, 23 Sep 2019 14:06:36 +0300
changeset 4
68988ebc2a68
parent 2
2bdc3ac5e77c
permissions
-rw-r--r--

added regular expressions for the parser

2
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
1 #include "uuid.h"
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
2 #include <QIODevice>
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
3
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
4 void uuidToString(const Uuid &uuid, QTextStream &stream)
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
5 {
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
6 stream << "0x";
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
7 stream << QString::number(uuid.a, 16);
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
8 stream << QString::number(uuid.b, 16);
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
9 }
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
10
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
11 void incrementUuid(Uuid &uuid)
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
12 {
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
13 if (uuid.b == std::numeric_limits<decltype(uuid.b)>::max())
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
14 {
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
15 uuid.a += 1;
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
16 uuid.b = 0;
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
17 }
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
18 else
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
19 {
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
20 uuid.b += 1;
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
21 }
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
22 }

mercurial