MCPcopy Create free account
hub / github.com/Geode-solutions/OpenGeode / string

Method string

src/geode/basic/uuid.cpp:302–322  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

300 }
301
302 std::string uuid::string() const
303 {
304 static constexpr char hex[] = "0123456789abcdef";
305
306 // Positions for each byte in 36-char string (accounting for hyphens)
307 static constexpr int pos[16] = { 0, 2, 4, 6, 9, 11, 14, 16, 19, 21, 24,
308 26, 28, 30, 32, 34 };
309
310 std::array< char, 36 > buf{};
311 buf[8] = buf[13] = buf[18] = buf[23] = '-';
312
313 for( int i = 0; i < 16; ++i )
314 {
315 unsigned b = bytes_[i];
316
317 buf[pos[i]] = hex[b >> 4];
318 buf[pos[i] + 1] = hex[b & 0x0F];
319 }
320
321 return { buf.data(), buf.size() };
322 }
323} // namespace geode
324
325namespace std

Calls 2

dataMethod · 0.45
sizeMethod · 0.45

Tested by 15

find_uuid_in_listFunction · 0.36
test_boundary_rangesFunction · 0.36
test_incidence_rangesFunction · 0.36
test_item_rangesFunction · 0.36
test_corner_item_rangesFunction · 0.36
test_line_item_rangesFunction · 0.36
test_surface_item_rangesFunction · 0.36
test_block_item_rangesFunction · 0.36