1 /***************************************************************************
2 * This file is part of KWorship. *
3 * Copyright 2008 James Hogan <james@albanarts.com> *
5 * KWorship is free software: you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation, either version 2 of the License, or *
8 * (at your option) any later version. *
10 * KWorship is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with KWorship. If not, write to the Free Software Foundation, *
17 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
18 ***************************************************************************/
20 #ifndef _KwBibleManager_h_
21 #define _KwBibleManager_h_
24 * @file KwBibleManager.h
25 * @brief A bible manager (analagous to a SWORD manager).
26 * @author James Hogan <james@albanarts.com>
29 #include "KwBibleExport.h"
34 #include <QStringList>
41 #define KW_BIBLE_MANAGER(X, KEY) \
44 * Static private variables \
46 static bool s_registered; \
48 static void registerManager() \
52 s_registered = KwBibleManager::factory()->addType< X >(KEY); \
56 #define KW_REGISTER_BIBLE_MANAGER(X) \
57 bool X::s_registered = false;
59 /// A bible manager (analagous to a SWORD manager).
60 class KWBIBLE_EXPORT KwBibleManager
: public QObject
70 /// Factory of managers identified by strings.
71 typedef ::Factory
<QString
, KwBibleManager
, META_TUPLE(())> Factory
;
73 /// Get a factory object.
74 static Factory
* factory();
76 /// Get a singleton for a manager.
77 static KwBibleManager
* singleton(const QString
& key
);
80 * Constructors + destructor
83 /// Default constructor.
84 KwBibleManager(QObject
* parent
= 0, const QStringList
& params
= QStringList());
87 virtual ~KwBibleManager();
93 /// Get the name of the manager.
94 virtual QString
name() const = 0;
96 /** Get whether the manager is remote.
97 * This means the modules should not be accessed unless they are requested
98 * explicitly by the user.
100 virtual bool isRemote() const = 0;
102 /// Get a module by name.
103 virtual KwBibleModule
* module(const QString
& name
) = 0;
105 /// Get the list of module names.
106 virtual QStringList
moduleNames() = 0;
108 /// Get the list of module names in a specific language.
109 virtual QStringList
moduleNamesInLanguage(const QString
& lang
) = 0;
111 /// Get a list of module languages.
112 virtual QStringList
languages() = 0;
115 #endif // _KwBibleManager_h_