MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / toHexString

Method toHexString

JUCE/modules/juce_core/text/juce_String.cpp:1934–1960  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1932String String::createHex (uint64 n) { return hexToString (n); }
1933
1934String String::toHexString (const void* const d, const int size, const int groupSize)
1935{
1936 if (size <= 0)
1937 return {};
1938
1939 int numChars = (size * 2) + 2;
1940 if (groupSize > 0)
1941 numChars += size / groupSize;
1942
1943 String s (PreallocationBytes ((size_t) numChars * sizeof (CharPointerType::CharType)));
1944
1945 auto* data = static_cast<const unsigned char*> (d);
1946 auto dest = s.text;
1947
1948 for (int i = 0; i < size; ++i)
1949 {
1950 const unsigned char nextByte = *data++;
1951 dest.write ((juce_wchar) hexDigits [nextByte >> 4]);
1952 dest.write ((juce_wchar) hexDigits [nextByte & 0xf]);
1953
1954 if (groupSize > 0 && (i % groupSize) == (groupSize - 1) && i < (size - 1))
1955 dest.write ((juce_wchar) ' ');
1956 }
1957
1958 dest.writeNull();
1959 return s;
1960}
1961
1962int String::getHexValue32() const noexcept { return CharacterFunctions::HexParser<int> ::parse (text); }
1963int64 String::getHexValue64() const noexcept { return CharacterFunctions::HexParser<int64>::parse (text); }

Callers 9

getEncodedIDStringMethod · 0.45
updateMD5ResultFunction · 0.45
updateSHA256ResultFunction · 0.45
updateWhirlpoolResultFunction · 0.45
createGUIDFunction · 0.45
createIDMethod · 0.45
createBlocksFromDataMethod · 0.45
reassembleMethod · 0.45

Calls 3

PreallocationBytesClass · 0.85
writeMethod · 0.45
writeNullMethod · 0.45

Tested by

no test coverage detected