6#include "QskGraphicProviderMap.h"
7#include "QskGraphicProvider.h"
13static inline QString qskKey(
const QString& providerId )
15 return providerId.toLower();
18class QskGraphicProviderMap::PrivateData
21 QHash< QString, QPointer< QskGraphicProvider > > hashTab;
24QskGraphicProviderMap::QskGraphicProviderMap()
25 : m_data( new PrivateData() )
29QskGraphicProviderMap::~QskGraphicProviderMap()
31 qDeleteAll( m_data->hashTab );
34void QskGraphicProviderMap::clear()
36 qDeleteAll( m_data->hashTab );
37 m_data->hashTab.clear();
40void QskGraphicProviderMap::insert(
43 if ( provider ==
nullptr )
49 m_data->hashTab.insert( qskKey( providerId ),
50 QPointer< QskGraphicProvider >( provider ) );
53void QskGraphicProviderMap::remove(
const QString& providerId )
55 delete take( providerId );
62 const auto it = m_data->hashTab.constFind( qskKey( providerId ) );
63 if ( it != m_data->hashTab.constEnd() )
65 provider = it.value();
66 m_data->hashTab.erase( it );
74 const auto it = m_data->hashTab.constFind( qskKey( providerId ) );
75 if ( it == m_data->hashTab.constEnd() )
78 if ( it.value().isNull() )
81 m_data->hashTab.erase( it );
87int QskGraphicProviderMap::size()
const
92 return m_data->hashTab.count();