#ifndef __PSWGEN_GENERATOR_IGENERATOR_H
# define __PSWGEN_GENERATOR_IGENERATOR_H
-#include "lib.h"
-
#include <QObject>
+#include <QString>
namespace eVaf {
namespace PswGen {
*
* This interface is used to generate strong passwords.
*/
-class PSWGEN_GENERATOR_EXPORT iGenerator : public QObject
+struct iGenerator
{
- Q_OBJECT
-
-public:
-
- /// Interface constructor
- iGenerator() {}
-
- /// Empty virtual destructor
- virtual ~iGenerator() {}
/**
* Flags for the password generator.
ALPHANUMERIC = 0x01 ///< Generated password contains only alphanumeric characters
};
- /**
- * Default length of the generated password
- */
- enum {
- DEFAULT_LENGTH = 16
- };
-
/**
* Generates a strong password
* @param name Name of the password
* @param masterPassword Master password
- * @param length Length of the password
+ * @param length Length of the password (if zero, then uses the max length)
* @param flags Flags for the generator
* @return Generated password
*
*
* Optional flags can be used to fine-tune the generator.
*/
- virtual QString generatePassword(char const * const name, char const * const masterPassword, int length = DEFAULT_LENGTH, uint flags = 0) = 0;
+ virtual QString generatePassword(QString const & name, QString const & masterPassword, int length, uint flags = 0) const = 0;
/**
* Returns the maximum length of generated passwords
} // namespace eVaf::PswGen
} // namespace eVaf
+Q_DECLARE_INTERFACE(eVaf::PswGen::iGenerator, "eVaf.PswGen.iGenerator/1.0")
+
#endif // igenerator.h