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

Method c_str

kdevplatform/serialization/indexedstring.cpp:364–381  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

362}
363
364const char* IndexedString::c_str() const
365{
366 if (!m_index) {
367 return nullptr;
368 } else if (isSingleCharIndex(m_index)) {
369#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
370 const uint offset = 0;
371#else
372 const uint offset = 3;
373#endif
374 return reinterpret_cast<const char*>(&m_index) + offset;
375 } else {
376 const uint index = m_index;
377 return LockedItemRepository::read<IndexedString>([index](const IndexedStringRepository& repo) {
378 return c_strFromItem(repo.itemFromIndex(index));
379 });
380 }
381}
382
383QByteArray IndexedString::byteArray() const
384{

Callers 1

testMethod · 0.45

Calls 3

isSingleCharIndexFunction · 0.85
c_strFromItemFunction · 0.85
itemFromIndexMethod · 0.45

Tested by 1

testMethod · 0.36