]> vaikene.ee Git - evaf/blobdiff - src/apps/PswGen/Storage/istorage.h
Warning fixes and copyright update.
[evaf] / src / apps / PswGen / Storage / istorage.h
index 8af8ba53dc0bd25d2e74fc5265eeef90a7d03153..add6f7a342d7a496835b0dfb69f062b6a3391da7 100644 (file)
@@ -3,7 +3,7 @@
  * @brief Interface for password storage 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.
  *
@@ -39,20 +39,37 @@ class Data : public QSharedData
 {
 public:
 
-    Data()
+    Data(QString const & name)
         : QSharedData()
         , mModified(false)
+        , mName(name)
+        , mSuffix()
         , mLength(0)
         , mFlags(0)
     {}
 
-    Data(int l, uint f = 0)
+    Data(QString const & name, QString const & suffix, int l, uint f = 0)
         : QSharedData()
         , mModified(false)
+        , mName(name)
+        , mSuffix(suffix)
         , mLength(l)
         , mFlags(f)
     {}
 
+    /// Name of the password
+    inline QString const & name() const { return mName; }
+
+    /// Optional suffix added to the name
+    inline QString const & suffix() const { return mSuffix; }
+    void setSuffix(QString const & suffix)
+    {
+        if (suffix != mSuffix) {
+            mSuffix = suffix;
+            mModified = true;
+        }
+    }
+
     /// Length of the generated password
     inline int length() const { return mLength; }
     inline void setLength(int value)
@@ -83,6 +100,8 @@ public:
 private:
 
     bool mModified;
+    QString mName;
+    QString mSuffix;
     int mLength;
     uint mFlags;
 
@@ -98,6 +117,11 @@ private:
 struct iStorage
 {
 
+    /**
+     * Empty virtual destructor
+     */
+    ~iStorage() {}
+
     /**
      * Saves the data record
      * @param name Name of the password