src/basics.cpp

changeset 1440
265b2e95a8e8
parent 1419
f7c53002a990
equal deleted inserted replaced
1436:241d3e452b32 1440:265b2e95a8e8
267 267
268 bool operator!=(const CircularSection& one, const CircularSection& other) 268 bool operator!=(const CircularSection& one, const CircularSection& other)
269 { 269 {
270 return not (one == other); 270 return not (one == other);
271 } 271 }
272
273 QString Uuid::toString() const
274 {
275 const std::uint32_t octet_1 = (a & 0xffffffff00000000) >> 32;
276 const std::uint16_t octet_2 = (a & 0x00000000ffff0000) >> 16;
277 const std::uint16_t octet_3 = (a & 0x000000000000ffff);
278 const std::uint16_t octet_4 = (b & 0xffff000000000000) >> 48;
279 const std::uint64_t octet_5 = (b & 0xffffffffffff0000);
280 char buffer[32 + 4 + 1];
281 std::sprintf(buffer, "%08x-%04x-%04x-%04x-%012lx", octet_1, octet_2, octet_3, octet_4, octet_5);
282 return buffer;
283 }
284
285 Uuid& Uuid::operator++()
286 {
287 if (b == std::numeric_limits<quint64>::max())
288 {
289 b = 0;
290 a += 1;
291 }
292 else
293 {
294 b += 1;
295 }
296 return *this;
297 }

mercurial