akabeiparser.h 1.37 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12
/*
 * This file is part of the Chakra project
 * Classes that manage the akabei-style command line

   Copyright (C) 2011 Lisa Vitolo <shainer@chakra-project.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.
*/

13 14
#ifndef AKABEIPARSER_H
#define AKABEIPARSER_H
15 16 17 18

#include <QStringList>
#include <QHash>

19 20
#include <akabeioptions.h>
#include <parser.h>
21 22 23 24

class AkabeiParser : public CommandLineParser
{
public:
25
    AkabeiParser(const QStringList &, const AkabeiAboutData &);
26

27
    void addOperation(AkabeiOperation &);
28
    void addOption(APM::OptionName name, QString const& cmdShort, QString const& cmdLong, QString const& desc, QString const& argname = QString());
29
    void connectOptionWithEverything(APM::OptionName name);
30

31
    void parse();
32

33 34 35 36
    APM::OperationType type();
    QList<APM::OperationName> operations();
    QHash<APM::OptionName, QStringList> options();
    QStringList args();
37

38
private:
39
    QList<APM::OptionName> generalOptions;
40

41 42
    QHash<QString, AkabeiOperation> m_acceptedOperations;
    QHash<QString, AkabeiOption> m_acceptedOptions;
43

44 45 46
    AkabeiOperation m_operation;
    QHash<APM::OptionName, AkabeiOption> m_options;
    QStringList m_args;
47

48 49 50
    void doParse();
};

51
#endif