summaryrefslogtreecommitdiffstats
path: root/SQLiteStudio3/sqlitestudiocli/commands/clicommandfactory.h
blob: 43294633c469737e80bca0e82d951807ac98fa16 (plain) (blame)
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
#ifndef CLICOMMANDFACTORY_H
#define CLICOMMANDFACTORY_H

#include <QString>
#include <QHash>

class CliCommand;

class CliCommandFactory
{
    public:
        static void init();
        static CliCommand* getCommand(const QString& cmdName);
        static QHash<QString,CliCommand*> getAllCommands();
        static QStringList getCommandNames();

    private:
        typedef CliCommand* (*CliCommandCreatorFunc)();

        static void registerCommand(CliCommandCreatorFunc func);

        static QHash<QString,CliCommandCreatorFunc> mapping;
};

#endif // CLICOMMANDFACTORY_H