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 ***************************************************************************/
21 * @file KwBibleManager.cpp
22 * @brief A bible manager (analagous to a SWORD manager).
23 * @author James Hogan <james@albanarts.com>
26 #include "KwBibleManager.h"
27 #include "KwBibleModule.h"
31 #include <markupfiltmgr.h>
38 KwBibleManager
* KwBibleManager::s_self
= 0;
44 /// Get the singleton object.
45 KwBibleManager
* KwBibleManager::self()
49 s_self
= new KwBibleManager
;
55 * Constructors + destructor
58 /// Default constructor.
59 KwBibleManager::KwBibleManager()
60 : m_manager(new sword::SWMgr(new sword::MarkupFilterMgr(sword::FMT_HTMLHREF
)))
63 sword::ModMap::iterator modIterator
;
65 for (modIterator
= m_manager
->Modules
.begin(); modIterator
!= m_manager
->Modules
.end(); ++modIterator
)
67 sword::SWBuf modName
= (*modIterator
).first
;
68 sword::SWModule
* module
= (*modIterator
).second
;
69 m_modules
[QLatin1String(modName
)] = new KwBibleModule(module
);
74 KwBibleManager::~KwBibleManager()
76 foreach (KwBibleModule
* module
, m_modules
)
87 /// Get a module by name.
88 KwBibleModule
* KwBibleManager::module(const QString
& name
) const
90 QMap
<QString
, KwBibleModule
*>::const_iterator it
= m_modules
.constFind(name
);
91 if (it
!= m_modules
.constEnd())
101 /// Get the list of modules.
102 QList
<KwBibleModule
*> KwBibleManager::modules() const
104 return m_modules
.values();