| 362 | } |
| 363 | |
| 364 | const 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 | |
| 383 | QByteArray IndexedString::byteArray() const |
| 384 | { |