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

Class QualifiedIdentifierItemRequest

kdevplatform/language/duchain/identifier.cpp:276–332  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

274using ConstantQualifiedIdentifierPrivate = QualifiedIdentifierPrivate<false>;
275
276struct QualifiedIdentifierItemRequest
277{
278 QualifiedIdentifierItemRequest(const DynamicQualifiedIdentifierPrivate& identifier)
279 : m_identifier(identifier)
280 {
281 identifier.hash(); //Make sure the hash is valid by calling this
282 }
283
284 enum {
285 AverageSize = sizeof(QualifiedIdentifierPrivate<false> ) + 8
286 };
287
288 //Should return the hash-value associated with this request(For example the hash of a string)
289 uint hash() const
290 {
291 return m_identifier.hash();
292 }
293
294 //Should return the size of an item created with createItem
295 uint itemSize() const
296 {
297 return m_identifier.itemSize();
298 }
299
300 /**
301 * Should create an item where the information of the requested item is permanently stored. The pointer
302 * @param item equals an allocated range with the size of itemSize().
303 */
304 void createItem(ConstantQualifiedIdentifierPrivate* item) const
305 {
306 Q_ASSERT(shouldDoDUChainReferenceCounting(item));
307 Q_ASSERT(shouldDoDUChainReferenceCounting(reinterpret_cast<char*>(item) + (itemSize() - 1)));
308 new (item) ConstantQualifiedIdentifierPrivate(m_identifier);
309 }
310
311 static bool persistent(const ConstantQualifiedIdentifierPrivate* item)
312 {
313 return ( bool )item->m_refCount;
314 }
315
316 static void destroy(ConstantQualifiedIdentifierPrivate* item, AbstractItemRepository&)
317 {
318 Q_ASSERT(shouldDoDUChainReferenceCounting(item));
319 item->~ConstantQualifiedIdentifierPrivate();
320 }
321
322 //Should return whether the here requested item equals the given item
323 bool equals(const ConstantQualifiedIdentifierPrivate* item) const
324 {
325 return item->m_explicitlyGlobal == m_identifier.m_explicitlyGlobal
326 && item->m_isExpression == m_identifier.m_isExpression
327 && item->m_hash == m_identifier.m_hash
328 && m_identifier.listsEqual(*item);
329 }
330
331 const DynamicQualifiedIdentifierPrivate& m_identifier;
332};
333

Callers 2

inRepositoryMethod · 0.85
makeConstantMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected