LibreOffice Module sd (master) 1
Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
sd::IconCache Class Referencefinal

This simple class stores frequently used icons so that the classes that use the icons do not have to store them in every one of their instances. More...

#include <IconCache.hxx>

Inheritance diagram for sd::IconCache:
[legend]
Collaboration diagram for sd::IconCache:
[legend]

Classes

class  Implementation
 

Public Member Functions

Image GetIcon (const OUString &rResourceId)
 Return the icon with the given resource id. More...
 
- Public Member Functions inherited from sd::SdGlobalResource
virtual ~SdGlobalResource () COVERITY_NOEXCEPT_FALSE
 

Static Public Member Functions

static IconCacheInstance ()
 The lifetime of the returned reference is limited to that of the sd module. More...
 

Private Member Functions

 IconCache ()
 The constructor creates the one instance of the cache and registers it at the SdGlobalResourceContainer to limit is lifetime to that of the sd module. More...
 
virtual ~IconCache () override
 This destructor is called by SdGlobalResourceContainer. More...
 

Private Attributes

::std::unique_ptr< ImplementationmpImpl
 

Detailed Description

This simple class stores frequently used icons so that the classes that use the icons do not have to store them in every one of their instances.

Icons are addressed over their resource id and are loaded on demand.

This cache acts like a singleton with a lifetime equal to that of the sd module.

Definition at line 37 of file IconCache.hxx.

Constructor & Destructor Documentation

◆ IconCache()

sd::IconCache::IconCache ( )
private

The constructor creates the one instance of the cache and registers it at the SdGlobalResourceContainer to limit is lifetime to that of the sd module.

Definition at line 94 of file IconCache.cxx.

Referenced by Instance().

◆ ~IconCache()

sd::IconCache::~IconCache ( )
overrideprivatevirtual

This destructor is called by SdGlobalResourceContainer.

Definition at line 99 of file IconCache.cxx.

Member Function Documentation

◆ GetIcon()

Image sd::IconCache::GetIcon ( const OUString &  rResourceId)

Return the icon with the given resource id.

Returns
The returned Image may be empty when there is no icon for the given id or an error occurred. Should not happen under normal circumstances.

Definition at line 92 of file IconCache.cxx.

References mpImpl.

◆ Instance()

IconCache & sd::IconCache::Instance ( )
static

The lifetime of the returned reference is limited to that of the sd module.

Definition at line 68 of file IconCache.cxx.

References sd::SdGlobalResourceContainer::AddResource(), DBG_ASSERT, IconCache(), sd::SdGlobalResourceContainer::Instance(), and sd::IconCache::Implementation::s_pIconCache.

Member Data Documentation

◆ mpImpl

::std::unique_ptr<Implementation> sd::IconCache::mpImpl
private

Definition at line 55 of file IconCache.hxx.

Referenced by GetIcon().


The documentation for this class was generated from the following files: