]> vaikene.ee Git - evaf/blob - src/apps/PswGen/CLI/cli.h
Merge branch 'master' of ssh://vaikene.net/var/gitpub/evaf
[evaf] / src / apps / PswGen / CLI / cli.h
1 /**
2 * @file PswGen/CLI/cli.h
3 * @brief Command line interface for the PswGen application
4 * @author Enar Vaikene
5 *
6 * Copyright (c) 2011 Enar Vaikene
7 *
8 * This file is part of the eVaf C++ cross-platform application development framework.
9 *
10 * This file can be used under the terms of the GNU General Public License
11 * version 3.0 as published by the Free Software Foundation and appearing in
12 * the file LICENSE included in the packaging of this file. Please review the
13 * the following information to ensure the GNU General Public License version
14 * 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
15 *
16 * Alternatively, this file may be used in accordance with the Commercial License
17 * Agreement provided with the Software.
18 */
19
20 #ifndef __PSWGEN_CLI_CLI_H
21 # define __PSWGEN_CLI_CLI_H
22
23 #include <Plugins/iPlugin>
24
25 #include <QObject>
26 #include <QString>
27
28 class QEvent;
29
30 namespace eVaf {
31 namespace PswGen {
32 struct iGenerator;
33 struct iStorage;
34
35 /**
36 * Command line interface for the PswGen application.
37 *
38 * This module adds command line interface to the PswGen application.
39 */
40 namespace CLI {
41
42 /**
43 * Command line interface for the PswGen application.
44 */
45 class Module : public Plugins::iPlugin
46 {
47 Q_OBJECT
48 Q_INTERFACES(eVaf::Plugins::iPlugin)
49
50 public:
51
52 Module();
53
54 virtual ~Module();
55
56 virtual bool init(QString const & args);
57
58 virtual void done();
59
60 virtual bool isReady() const { return mReady; }
61
62 virtual bool event(QEvent *);
63
64
65 private: // Members
66
67 static int const DefaultPasswordLength;
68
69 /// Flag indicating that the module is ready
70 bool mReady;
71
72 /// The iGenerator interface
73 eVaf::PswGen::iGenerator * mGenerator;
74
75 /// The iStorage interface (can be null)
76 eVaf::PswGen::iStorage * mStorage;
77
78 /// Ready event
79 uint mEvReady;
80
81
82 private: // Methods
83
84 QString readPassword();
85
86 void generatePassword();
87
88 };
89
90 } // namespace eVaf::PswGen::CLI
91 } // namespace eVaf::PswGen
92 } // namespace eVaf
93
94 #endif // cli.h