Grantlee 0.1.9
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_core_export.h"
00027 
00028 namespace Grantlee
00029 {
00030 
00031 class CachingLoaderDecoratorPrivate;
00032 
00034 
00064 class GRANTLEE_CORE_EXPORT CachingLoaderDecorator : public AbstractTemplateLoader
00065 {
00066 public:
00067 #ifndef Q_QDOC
00068   typedef QSharedPointer<CachingLoaderDecorator> Ptr;
00069 #endif
00070 
00074   CachingLoaderDecorator( Grantlee::AbstractTemplateLoader::Ptr loader );
00075 
00079   virtual ~CachingLoaderDecorator();
00080 
00081   /* reimp */ bool canLoadTemplate( const QString& name ) const;
00082 
00083   /* reimp */ QPair< QString, QString > getMediaUri( const QString& fileName ) const;
00084 
00085   /* reimp */ Template loadByName( const QString& name, const Grantlee::Engine* engine ) const;
00086 
00090   void clear();
00091 
00095   int size() const;
00096 
00100   bool isEmpty() const;
00101 
00102 private:
00103   Q_DECLARE_PRIVATE( CachingLoaderDecorator )
00104   CachingLoaderDecoratorPrivate * const d_ptr;
00105 };
00106 
00107 }
00108 
00109 
00110 #endif