]> vaikene.ee Git - evaf/blobdiff - src/apps/PswGen/Generator/igenerator.h
Modified the PswGen application to follow the tutorial.
[evaf] / src / apps / PswGen / Generator / igenerator.h
index d5122f21b9068b39465ab52343140fe8244f9f10..a702167a3778f8044feca015ce728dd7c911335b 100644 (file)
@@ -23,6 +23,7 @@
 #include "lib.h"
 
 #include <QObject>
+#include <QString>
 
 namespace eVaf {
 namespace PswGen {
@@ -39,7 +40,7 @@ class PSWGEN_GENERATOR_EXPORT iGenerator : public QObject
 public:
 
     /// Interface constructor
-    iGenerator() {}
+    iGenerator() : QObject() {}
 
     /// Empty virtual destructor
     virtual ~iGenerator() {}
@@ -51,18 +52,11 @@ public:
         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
      *
@@ -75,7 +69,7 @@ public:
      *
      * 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