MCPcopy Create free account
hub / github.com/Kitware/CMake / StringToBinary

Method StringToBinary

Source/cmUuid.cxx:70–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68}
69
70bool cmUuid::StringToBinary(cm::string_view input,
71 std::vector<unsigned char>& output) const
72{
73 output.clear();
74 output.reserve(16);
75
76 if (input.length() != 36) {
77 return false;
78 }
79 size_t index = 0;
80 for (size_t i = 0; i < kUuidGroups.size(); ++i) {
81 if (i != 0 && input[index++] != '-') {
82 return false;
83 }
84 size_t digits = kUuidGroups[i] * 2;
85 if (!this->StringToBinaryImpl(input.substr(index, digits), output)) {
86 return false;
87 }
88
89 index += digits;
90 }
91
92 return true;
93}
94
95std::string cmUuid::BinaryToString(unsigned char const* input) const
96{

Callers 2

cmCMakeString.cxxFile · 0.80
GetGUIDMethod · 0.80

Calls 6

StringToBinaryImplMethod · 0.95
reserveMethod · 0.80
lengthMethod · 0.80
clearMethod · 0.45
sizeMethod · 0.45
substrMethod · 0.45

Tested by

no test coverage detected