/** * @file PswGen/Generator/generator.h * @brief Implementation of the iGenerator interface * @author Enar Vaikene * * Copyright (c) 2011 Enar Vaikene * * This file is part of the eVaf C++ cross-platform application development framework. * * This file can be used under the terms of the GNU General Public License * version 3.0 as published by the Free Software Foundation and appearing in * the file LICENSE included in the packaging of this file. Please review the * the following information to ensure the GNU General Public License version * 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html. * * Alternatively, this file may be used in accordance with the Commercial License * Agreement provided with the Software. */ #ifndef __PSWGEN_GENERATOR_GENERATOR_H # define __PSWGEN_GENERATOR_GENERATOR_H #include "igenerator.h" #include #include namespace eVaf { namespace PswGen { /// Module that generates strong passwords using cryptographic methods namespace Generator { /// Internal implementation of the Generator module namespace Internal { /** * iGenerator interface implementation. * * Implements the iGenerator interface using MD5 cryptographic hashes. */ class GeneratorImpl : public iGenerator { Q_OBJECT public: GeneratorImpl(); virtual ~GeneratorImpl(); bool init(); void done(); virtual QString generatePassword(char const * const name, char const * const masterPassword, int length = iGenerator::DEFAULT_LENGTH, uint flags = 0); virtual int maxLength() const { return 24; } }; } // namespace eVaf::PswGen::Generator::Internal /** * Module implementing the iGenerator interface. */ class Generator : public Plugins::iPlugin { Q_OBJECT public: Generator(); virtual ~Generator(); virtual bool init(const QString & args); virtual void done(); virtual bool isReady() const { return mReady; } private: // Members /// Flag indicating that the module is ready bool mReady; /// iGenerator interface instance Internal::GeneratorImpl * mGenerator; }; } // namespace eVaf::PswGen::Generator } // namespace eVaf::PswGen } // namespace eVaf #endif // generator.h