Grantlee  5.1.0
templates/lib/cachingloaderdecorator.h
00001 /*
00002   This file is part of the Grantlee template system.
00003 
00004   Copyright (c) 2010 Stephen Kelly <steveire@gmail.com>
00005 
00006   This library is free software; you can redistribute it and/or
00007   modify it under the terms of the GNU Lesser General Public
00008   License as published by the Free Software Foundation; either version
00009   2.1 of the Licence, or (at your option) any later version.
00010 
00011   This library is distributed in the hope that it will be useful,
00012   but WITHOUT ANY WARRANTY; without even the implied warranty of
00013   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014   Lesser General Public License for more details.
00015 
00016   You should have received a copy of the GNU Lesser General Public
00017   License along with this library.  If not, see <http://www.gnu.org/licenses/>.
00018 
00019 */
00020 
00021 #ifndef GRANTLEE_CACHINGLOADERDECORATOR_H
00022 #define GRANTLEE_CACHINGLOADERDECORATOR_H
00023 
00024 #include "templateloader.h"
00025 
00026 #include "grantlee_templates_export.h"
00027 
00028 namespace Grantlee
00029 {
00030 
00031 class CachingLoaderDecoratorPrivate;
00032 
00034 
00070 class GRANTLEE_TEMPLATES_EXPORT CachingLoaderDecorator
00071     : public AbstractTemplateLoader
00072 {
00073 public:
00077   CachingLoaderDecorator(QSharedPointer<AbstractTemplateLoader> loader);
00078 
00082   ~CachingLoaderDecorator() override;
00083 
00084   bool canLoadTemplate(const QString &name) const override;
00085 
00086   QPair<QString, QString> getMediaUri(const QString &fileName) const override;
00087 
00088   Template loadByName(const QString &name,
00089                       const Grantlee::Engine *engine) const override;
00090 
00094   void clear();
00095 
00099   int size() const;
00100 
00104   bool isEmpty() const;
00105 
00106 private:
00107   Q_DECLARE_PRIVATE(CachingLoaderDecorator)
00108   CachingLoaderDecoratorPrivate *const d_ptr;
00109 };
00110 }
00111 
00112 #endif