]> vaikene.ee Git - evaf/blob - src/apps/PswGen/Generator/module.h
Warning fixes and copyright update.
[evaf] / src / apps / PswGen / Generator / module.h
1 /**
2 * @file PswGen/Generator/module.h
3 * @brief Implementation of the iGenerator interface
4 * @author Enar Vaikene
5 *
6 * Copyright (c) 2011-2019 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_GENERATOR_MODULE_H
21 # define __PSWGEN_GENERATOR_MODULE_H
22
23 #include "igenerator.h"
24 #include "version.h"
25
26 #include <Plugins/iPlugin>
27
28 #include <QObject>
29 #include <QString>
30
31 namespace eVaf {
32 namespace PswGen {
33
34 /// Module that generates strong passwords using cryptographic methods
35 namespace Generator {
36
37 /// Internal implementation of the Generator module
38 namespace Internal {
39 class GeneratorImpl;
40 } // namespace eVaf::PswGen::Generator::Internal
41
42 /**
43 * Module implementing the iGenerator interface.
44 */
45 class Module : public Plugins::iPlugin
46 {
47 Q_OBJECT
48 Q_INTERFACES(eVaf::Plugins::iPlugin)
49 Q_PLUGIN_METADATA(IID VER_MODULE_NAME_STR)
50
51 public:
52
53 Module();
54
55 virtual ~Module();
56
57 virtual bool init(QString const & args);
58
59 virtual void done();
60
61 virtual bool isReady() const { return true; }
62
63
64 private: // Members
65
66 /// iGenerator interface instance
67 Internal::GeneratorImpl * mGenerator;
68
69 };
70
71
72 namespace Internal {
73
74 /**
75 * iGenerator interface implementation.
76 *
77 * Implements the iGenerator interface using MD5 cryptographic hashes.
78 */
79
80 class GeneratorImpl : public QObject, public iGenerator
81 {
82 Q_OBJECT
83 Q_INTERFACES(eVaf::PswGen::iGenerator)
84
85 public:
86
87 GeneratorImpl();
88
89 virtual ~GeneratorImpl();
90
91 virtual QString generatePassword(QString const & name, QString const & masterPassword, int length, uint flags = 0) const;
92
93 virtual int maxLength() const { return 24; }
94
95 };
96
97 } // namespace eVaf::PswGen::Generator::Internal
98
99
100 } // namespace eVaf::PswGen::Generator
101 } // namespace eVaf::PswGen
102 } // namespace eVaf
103
104 #endif // module.h