summaryrefslogtreecommitdiffstats
path: root/languages/fortran/compiler/pgioptions/pgioptionsfactory.cpp
blob: 5fad6630ca3a0aed908e48ea216da583a4b3a0d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/***************************************************************************
 *   Copyright (C) 2001 by Bernd Gehrmann                                  *
 *   bernd@kdevelop.org                                                    *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#include <kdebug.h>
#include <kinstance.h>
#include "pgioptionsplugin.h"
#include "pgioptionsfactory.h"


extern "C" {

    void *init_libkdevpgioptions()
    {
        return new PgiOptionsFactory;
    }
    
}


PgiOptionsFactory::PgiOptionsFactory(QObject *parent, const char *name)
    : KLibFactory(parent, name)
{
    instance();
}


PgiOptionsFactory::~PgiOptionsFactory()
{
    delete s_instance;
    s_instance = 0;
}


QObject *PgiOptionsFactory::createObject(QObject *parent, const char *name,
                                         const char * /*classname*/, const QStringList &args)
{
    if (args.count() > 0 && qstrcmp(args[0].latin1(), "pghpf") == 0) {
        kdDebug(9021) << "Building PgiOptions for PGHPF" << endl;
        return new PgiOptionsPlugin(PgiOptionsPlugin::PGHPF, parent, name);
    } else if (args.count() > 0 && qstrcmp(args[0].latin1(), "pgf77") == 0) {
        kdDebug(9021) << "Building PgiOptions for PGF77" << endl;
        return new PgiOptionsPlugin(PgiOptionsPlugin::PGF77, parent, name);
    } else {
        kdDebug(9021) << "Wrong args for kdevpgioptions library" << endl;
        if (args.count() > 0)
            kdDebug(9021) << args[0] << endl;
        return 0;
    }
}


KInstance *PgiOptionsFactory::s_instance = 0;
KInstance *PgiOptionsFactory::instance()
{
    if (!s_instance)
        s_instance = new KInstance("kdevpgioptions");

    return s_instance;
}

#include "pgioptionsfactory.moc"