[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [ksecrets] src/runtime/ksecrets_store: Do not use a base class for the time stamps
From:       Valentin Rusu <kde () rusu ! info>
Date:       2015-08-12 11:26:25
Message-ID: E1ZPUAr-0007H7-KX () scm ! kde ! org
[Download RAW message or body]

Git commit 035d5c9731fb77901d1d1c97189ddfb9c0f7998d by Valentin Rusu.
Committed on 11/08/2015 at 14:07.
Pushed by vrusu into branch 'master'.

Do not use a base class for the time stamps

reviewed by: dvratil

M  +7    -32   src/runtime/ksecrets_store/ksecrets_backend.h

http://commits.kde.org/ksecrets/035d5c9731fb77901d1d1c97189ddfb9c0f7998d

diff --git a/src/runtime/ksecrets_store/ksecrets_backend.h b/src/runtime/ksecrets_store/ksecrets_backend.h
index 59ee479..c7068e1 100644
--- a/src/runtime/ksecrets_store/ksecrets_backend.h
+++ b/src/runtime/ksecrets_store/ksecrets_backend.h
@@ -76,36 +76,6 @@ class KSECRETS_BACKEND_EXPORT KSecretsBackend {
 public:
     using AttributesMap = std::map<std::string, std::string>;
 
-    /**
-     * This base class is not directly used by client applications.
-     *
-     * This class provides basic timestamp operations
-     */
-    class TimeStamped {
-        std::time_t createTime() const noexcept;
-        std::time_t modifiedTime() const noexcept;
-
-    protected:
-        TimeStamped()
-            : createdTime_(std::time(nullptr))
-            , modifiedTime_(std::time(nullptr))
-        {
-        }
-        virtual ~TimeStamped() = default;
-        TimeStamped(const TimeStamped&) = default;
-        TimeStamped& operator=(const TimeStamped&) = default;
-
-        template <class FUNC> void modify(FUNC func)
-        {
-            func();
-            modifiedTime = std::time(nullptr);
-        };
-
-    private:
-        std::time_t createdTime_;
-        std::time_t modifiedTime_;
-    };
-
     struct ItemValue {
         std::string contentType;
         std::vector<char> contents;
@@ -119,7 +89,7 @@ public:
      *
      * @see Collection
      */
-    class Item : public TimeStamped {
+    class Item {
         Item(const Item&) = default;
         Item& operator=(const Item&) = default;
 
@@ -132,6 +102,8 @@ public:
         ItemValue value() const noexcept;
         bool setValue(ItemValue&&) noexcept;
 
+        std::time_t createdTime() const noexcept;
+        std::time_t modifiedTime() const noexcept;
     protected:
         Item();
         friend class KSecretsBackend;
@@ -163,13 +135,16 @@ public:
      * the items having attribute value containing that partially specified
      *value.
      */
-    class Collection : public TimeStamped {
+    class Collection {
         Collection(const Collection&) = default;
         Collection& operator=(const Collection&) = default;
 
         std::string label() const noexcept;
         bool setLabel(std::string&&) noexcept;
 
+        std::time_t createdTime() const noexcept;
+        std::time_t modifiedTime() const noexcept;
+
         using ItemList = std::vector<ItemPtr>;
         ItemList searchItems(AttributesMap&&) noexcept;
         ItemList searchItems(std::string&&) noexcept;

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic