~ubuntu-branches/ubuntu/trusty/grantlee/trusty

« back to all changes in this revision

Viewing changes to templates/lib/engine_p.h

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2010-12-07 08:09:15 UTC
  • Revision ID: james.westby@ubuntu.com-20101207080915-ee6wcs8nv625su4b
Tags: 0.1.7-0ubuntu2
* Backport upstream commits 128272d4f65d7f02372cb606c148817c2f15a78d and
  5a71ed118f6fae67a4a26ab867ab7575e5a3e34c to moderate test requirements so
  it will build on armel
* Include missing grantlee_i18ntags.so and grantlee_mutabletags.so in
  libgrantlee-core0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
  This file is part of the Grantlee template system.
 
3
 
 
4
  Copyright (c) 2009,2010 Stephen Kelly <steveire@gmail.com>
 
5
 
 
6
  This library is free software; you can redistribute it and/or
 
7
  modify it under the terms of the GNU Lesser General Public
 
8
  License as published by the Free Software Foundation; either version
 
9
  2.1 of the Licence, or (at your option) any later version.
 
10
 
 
11
  This library is distributed in the hope that it will be useful,
 
12
  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
14
  Lesser General Public License for more details.
 
15
 
 
16
  You should have received a copy of the GNU Lesser General Public
 
17
  License along with this library.  If not, see <http://www.gnu.org/licenses/>.
 
18
 
 
19
*/
 
20
 
 
21
#ifndef GRANTLEE_ENGINE_P_H
 
22
#define GRANTLEE_ENGINE_P_H
 
23
 
 
24
#include "engine.h"
 
25
#include "filter.h"
 
26
#include "pluginpointer_p.h"
 
27
#include "taglibraryinterface.h"
 
28
 
 
29
class QPluginLoader;
 
30
 
 
31
namespace Grantlee
 
32
{
 
33
 
 
34
class ScriptableTagLibrary;
 
35
 
 
36
class ScriptableLibraryContainer : public TagLibraryInterface
 
37
{
 
38
public:
 
39
  ScriptableLibraryContainer( QHash<QString, AbstractNodeFactory*> factories, QHash<QString, Filter *> filters )
 
40
      : m_nodeFactories( factories ), m_filters( filters ) {
 
41
  }
 
42
 
 
43
  void setNodeFactories( const QHash<QString, AbstractNodeFactory*> factories )
 
44
  {
 
45
    m_nodeFactories = factories;
 
46
  }
 
47
 
 
48
  void setFilters( const QHash<QString, Filter*> filters )
 
49
  {
 
50
    m_filters = filters;
 
51
  }
 
52
 
 
53
  // Warning: should only be called by Engine::loadDefaultLibraries
 
54
  void clear()
 
55
  {
 
56
    qDeleteAll( m_nodeFactories );
 
57
    qDeleteAll( m_filters );
 
58
    m_nodeFactories.clear();
 
59
    m_filters.clear();
 
60
  }
 
61
 
 
62
  QHash<QString, AbstractNodeFactory*> nodeFactories( const QString &name = QString() ) {
 
63
    Q_UNUSED( name );
 
64
    return m_nodeFactories;
 
65
  }
 
66
 
 
67
  QHash<QString, Filter*> filters( const QString &name = QString() ) {
 
68
    Q_UNUSED( name );
 
69
    return m_filters;
 
70
  }
 
71
 
 
72
private:
 
73
  QHash<QString, AbstractNodeFactory*> m_nodeFactories;
 
74
  QHash<QString, Filter*> m_filters;
 
75
 
 
76
};
 
77
 
 
78
class EnginePrivate
 
79
{
 
80
  EnginePrivate( Engine *engine );
 
81
 
 
82
  TagLibraryInterface* loadLibrary( const QString &name, uint minorVersion );
 
83
  QString getScriptLibraryName( const QString &name, uint minorVersion ) const;
 
84
  ScriptableLibraryContainer* loadScriptableLibrary( const QString &name, uint minorVersion );
 
85
  PluginPointer<TagLibraryInterface> loadCppLibrary( const QString& name, uint minorVersion );
 
86
 
 
87
  Q_DECLARE_PUBLIC( Engine )
 
88
  Engine * const q_ptr;
 
89
 
 
90
  QHash<QString, PluginPointer<TagLibraryInterface> > m_libraries;
 
91
  QHash<QString, ScriptableLibraryContainer*> m_scriptableLibraries;
 
92
 
 
93
  QList<AbstractTemplateLoader::Ptr> m_loaders;
 
94
  QStringList m_pluginDirs;
 
95
  QStringList m_defaultLibraries;
 
96
  ScriptableTagLibrary *m_scriptableTagLibrary;
 
97
};
 
98
 
 
99
}
 
100
 
 
101
#endif
 
102