]> vaikene.ee Git - evaf/blobdiff - src/apps/PswGen/Generator/igenerator.h
Warning fixes and copyright update.
[evaf] / src / apps / PswGen / Generator / igenerator.h
index d5122f21b9068b39465ab52343140fe8244f9f10..f33104913ac6cd7ba3c2e3f008bed3b2b4b289f6 100644 (file)
@@ -3,7 +3,7 @@
  * @brief Interface for password generator modules
  * @author Enar Vaikene
  *
- * Copyright (c) 2011 Enar Vaikene
+ * Copyright (c) 2011-2019 Enar Vaikene
  *
  * This file is part of the eVaf C++ cross-platform application development framework.
  *
@@ -20,9 +20,8 @@
 #ifndef __PSWGEN_GENERATOR_IGENERATOR_H
 #  define __PSWGEN_GENERATOR_IGENERATOR_H
 
-#include "lib.h"
-
 #include <QObject>
+#include <QString>
 
 namespace eVaf {
 namespace PswGen {
@@ -32,17 +31,8 @@ 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.
@@ -52,17 +42,15 @@ public:
     };
 
     /**
-     * Default length of the generated password
+     * Empty virtual destructor
      */
-    enum {
-        DEFAULT_LENGTH          = 16
-    };
+    virtual ~iGenerator() {}
 
     /**
      * 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 +63,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
@@ -91,4 +79,6 @@ public:
 } // namespace eVaf::PswGen
 } // namespace eVaf
 
+Q_DECLARE_INTERFACE(eVaf::PswGen::iGenerator, "eVaf.PswGen.iGenerator/1.0")
+
 #endif // igenerator.h