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

Method GetObjectId

Source/cmGlobalXCodeGenerator.cxx:3579–3603  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3577}
3578
3579std::string cmGlobalXCodeGenerator::GetObjectId(cmXCodeObject::PBXType ptype,
3580 cm::string_view key)
3581{
3582 std::string objectId;
3583 if (!key.empty()) {
3584 cmCryptoHash hash(cmCryptoHash::AlgoSHA256);
3585 hash.Initialize();
3586 hash.Append(&ptype, sizeof(ptype));
3587 hash.Append(key);
3588 objectId = cmSystemTools::UpperCase(hash.FinalizeHex().substr(0, 24));
3589 } else {
3590 char cUuid[40] = { 0 };
3591 CFUUIDRef uuid = CFUUIDCreate(kCFAllocatorDefault);
3592 CFStringRef s = CFUUIDCreateString(kCFAllocatorDefault, uuid);
3593 CFStringGetCString(s, cUuid, sizeof(cUuid), kCFStringEncodingUTF8);
3594 objectId = cUuid;
3595 CFRelease(s);
3596 CFRelease(uuid);
3597 cmSystemTools::ReplaceString(objectId, "-", "");
3598 if (objectId.size() > 24) {
3599 objectId = objectId.substr(0, 24);
3600 }
3601 }
3602 return objectId;
3603}
3604
3605std::string cmGlobalXCodeGenerator::GetOrCreateId(std::string const& name,
3606 std::string const& id)

Callers 2

CreateObjectMethod · 0.95

Calls 6

FinalizeHexMethod · 0.80
emptyMethod · 0.45
InitializeMethod · 0.45
AppendMethod · 0.45
substrMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected