MCPcopy Create free account
hub / github.com/KDE/kdevelop / IndexedString

Method IndexedString

kdevplatform/serialization/indexedstring.cpp:217–234  ·  view source on GitHub ↗

@param str must be a utf8 encoded string, does not need to be 0-terminated. @param length must be its length in bytes.

Source from the content-addressed store, hash-verified

215///@param str must be a utf8 encoded string, does not need to be 0-terminated.
216///@param length must be its length in bytes.
217IndexedString::IndexedString(const char* str, unsigned short length, uint hash)
218{
219 if (!length) {
220 m_index = 0;
221 } else if (length == 1) {
222 m_index = charToIndex(str[0]);
223 } else {
224 const auto request = IndexedStringRepositoryItemRequest(str, hash ? hash : hashString(str, length), length);
225 bool refcount = shouldDoDUChainReferenceCounting(this);
226 m_index = LockedItemRepository::write<IndexedString>([request, refcount](IndexedStringRepository& repo) {
227 auto index = repo.index(request);
228 if (refcount) {
229 ReferenceCountChanger::increase(index)(repo);
230 }
231 return index;
232 });
233 }
234}
235
236IndexedString::IndexedString(char c)
237 : m_index(charToIndex(c))

Callers

nothing calls this directly

Calls 7

charToIndexFunction · 0.85
urlToStringFunction · 0.85
refFunction · 0.85
indexMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected