|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0"" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Factory class to create LogOutput. |
|
15 * |
|
16 */ |
|
17 #ifndef LOGOUTPUTFACTORY_H |
|
18 #define LOGOUTPUTFACTORY_H |
|
19 |
|
20 class LogOutput; |
|
21 class QVariant; |
|
22 class QString; |
|
23 |
|
24 #include <QHash> |
|
25 #include <loggerglobal.h> |
|
26 |
|
27 class LOGGER_EXPORT LogOutputFactory |
|
28 { |
|
29 public: |
|
30 typedef LogOutput* (*CREATE_ENTRY)(); |
|
31 static LogOutput *createLogOutput(const QString &name); |
|
32 static LogOutput *createLogOutput(const QString &name,const QHash<QString,QVariant> &properties); |
|
33 static void addCreateLogOutputEntry(const QString &name,CREATE_ENTRY entry); |
|
34 }; |
|
35 |
|
36 class LogOutputCreateEntryRegister |
|
37 { |
|
38 public: |
|
39 LogOutputCreateEntryRegister(const QString &name,LogOutputFactory::CREATE_ENTRY entry) { |
|
40 LogOutputFactory::addCreateLogOutputEntry(name,entry); |
|
41 } |
|
42 }; |
|
43 |
|
44 #define REGISTER_OUTPUT_LOG(name,Class) \ |
|
45 static LogOutput *create##Class() { \ |
|
46 LogOutput *output = new Class(); \ |
|
47 output->setName(name); \ |
|
48 return output; \ |
|
49 } \ |
|
50 LogOutputCreateEntryRegister the##Class##EntryRegister(name,create##Class); |
|
51 |
|
52 #endif //LOGOUTPUTFACTORY_H |