KTextTemplate::CachingLoaderDecorator
#include <KTextTemplate/CachingLoaderDecorator>
Public Member Functions | |
CachingLoaderDecorator (QSharedPointer< AbstractTemplateLoader > loader) | |
~CachingLoaderDecorator () override | |
bool | canLoadTemplate (const QString &name) const override |
void | clear () |
std::pair< QString, QString > | getMediaUri (const QString &fileName) const override |
bool | isEmpty () const |
Template | loadByName (const QString &name, const KTextTemplate::Engine *engine) const override |
int | size () const |
Public Member Functions inherited from KTextTemplate::AbstractTemplateLoader | |
virtual | ~AbstractTemplateLoader () |
Detailed Description
Implements a loader decorator which caches compiled Template objects.
The CachingLoaderDecorator can be used with any implementation of KTextTemplate::AbstractTemplateLoader.
The effect is that templates do not need to be loaded from the filesystem and compiled into Template objects on each access, but may be returned from the cache instead.
This can be significant if loading Templates in a loop, or loading the same Template very often in an application.
If the loading of Templates is a bottleneck in an application, it may make sense to use the caching decorator.
Definition at line 59 of file cachingloaderdecorator.h.
Constructor & Destructor Documentation
◆ CachingLoaderDecorator()
CachingLoaderDecorator::CachingLoaderDecorator | ( | QSharedPointer< AbstractTemplateLoader > | loader | ) |
Constructor.
Definition at line 35 of file cachingloaderdecorator.cpp.
◆ ~CachingLoaderDecorator()
|
override |
Destructor.
Definition at line 40 of file cachingloaderdecorator.cpp.
Member Function Documentation
◆ canLoadTemplate()
|
overridevirtual |
Return true if a Template identified by name
exists and can be loaded.
Implements KTextTemplate::AbstractTemplateLoader.
Definition at line 45 of file cachingloaderdecorator.cpp.
◆ clear()
void CachingLoaderDecorator::clear | ( | ) |
Clears the Templates objects cached in the decorator.
Definition at line 51 of file cachingloaderdecorator.cpp.
◆ getMediaUri()
|
overridevirtual |
Return a complete URI for media identified by fileName.
Implements KTextTemplate::AbstractTemplateLoader.
Definition at line 69 of file cachingloaderdecorator.cpp.
◆ isEmpty()
bool CachingLoaderDecorator::isEmpty | ( | ) | const |
Returns whether the cache is empty.
Definition at line 63 of file cachingloaderdecorator.cpp.
◆ loadByName()
|
overridevirtual |
Load a Template called name
.
Return an invalid Template if no content by that name exists.
Implements KTextTemplate::AbstractTemplateLoader.
Definition at line 75 of file cachingloaderdecorator.cpp.
◆ size()
int CachingLoaderDecorator::size | ( | ) | const |
Returns the number of Template objects cached in the decorator.
Definition at line 57 of file cachingloaderdecorator.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:39:46 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.