]> git.sesse.net Git - kdenlive/blob - src/trackpanelfunctionfactory.cpp
Reindent all source files
[kdenlive] / src / trackpanelfunctionfactory.cpp
1 /***************************************************************************
2                           trackpanelfunctionfactory  -  description
3                              -------------------
4     begin                : Sun Dec 28 2003
5     copyright            : (C) 2003 by Jason Wood
6     email                : jasonwood@blueyonder.co.uk
7  ***************************************************************************/
8
9 /***************************************************************************
10  *                                                                         *
11  *   This program is free software; you can redistribute it and/or modify  *
12  *   it under the terms of the GNU General Public License as published by  *
13  *   the Free Software Foundation; either version 2 of the License, or     *
14  *   (at your option) any later version.                                   *
15  *                                                                         *
16  ***************************************************************************/
17 #include "trackpanelfunctionfactory.h"
18
19 #include "trackpanelfunction.h"
20
21 #include <KDebug>
22
23 TrackPanelFunctionFactory::TrackPanelFunctionFactory() {
24 }
25
26
27 TrackPanelFunctionFactory::~TrackPanelFunctionFactory() {
28     clearFactory();
29 }
30
31 void TrackPanelFunctionFactory::clearFactory() {
32     QMap < QString, TrackPanelFunction * >::iterator itt =
33         m_functionMap.begin();
34
35     while (itt != m_functionMap.end()) {
36         delete(itt.value());
37         itt.value() = 0;
38         ++itt;
39     }
40     m_functionMap.clear();
41 }
42
43 void TrackPanelFunctionFactory::registerFunction(const QString & name,
44         TrackPanelFunction * function) {
45     if (!m_functionMap.contains(name)) {
46         m_functionMap[name] = function;
47     } else {
48         kError() << "Factory already contains a function called " << name;
49     }
50 }
51
52 TrackPanelFunction *TrackPanelFunctionFactory::
53 function(const QString & name) {
54     if (m_functionMap.contains(name)) {
55         return m_functionMap[name];
56     } else {
57         kError() << "No function called " << name << " found in factory";
58     }
59
60     return 0;
61 }
62
63 #include "trackpanelfunctionfactory.moc"
64