[gnote] Move semantics for filesystemsyncserver



commit 37a24192645674cca8bea817ee02596d4f52776a
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Sun Jun 19 18:25:25 2022 +0300

    Move semantics for filesystemsyncserver

 .../filesystemsyncservice/filesystemsyncserviceaddin.cpp     |  4 ++--
 src/plugins/gvfssyncservice/gvfssyncserviceaddin.cpp         |  4 ++--
 src/plugins/webdavsyncservice/webdavsyncserviceaddin.cpp     | 12 ++++++------
 src/synchronization/filesystemsyncserver.cpp                 | 10 +++++-----
 src/synchronization/filesystemsyncserver.hpp                 |  6 +++---
 5 files changed, 18 insertions(+), 18 deletions(-)
---
diff --git a/src/plugins/filesystemsyncservice/filesystemsyncserviceaddin.cpp 
b/src/plugins/filesystemsyncservice/filesystemsyncserviceaddin.cpp
index e26cefd9..a3aad9d3 100644
--- a/src/plugins/filesystemsyncservice/filesystemsyncserviceaddin.cpp
+++ b/src/plugins/filesystemsyncservice/filesystemsyncserviceaddin.cpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2012-2013,2017-2021 Aurimas Cernius
+ * Copyright (C) 2012-2013,2017-2022 Aurimas Cernius
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -72,7 +72,7 @@ gnote::sync::SyncServer *FileSystemSyncServiceAddin::create_sync_server()
     }
 
     auto path = Gio::File::create_for_path(m_path);
-    server = gnote::sync::FileSystemSyncServer::create(path, ignote().preferences());
+    server = gnote::sync::FileSystemSyncServer::create(std::move(path), ignote().preferences());
   }
   else {
     throw std::logic_error("FileSystemSyncServiceAddin.create_sync_server() called without being 
configured");
diff --git a/src/plugins/gvfssyncservice/gvfssyncserviceaddin.cpp 
b/src/plugins/gvfssyncservice/gvfssyncserviceaddin.cpp
index 3440366d..d6b6a28f 100644
--- a/src/plugins/gvfssyncservice/gvfssyncserviceaddin.cpp
+++ b/src/plugins/gvfssyncservice/gvfssyncserviceaddin.cpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2019-2021 Aurimas Cernius
+ * Copyright (C) 2019-2022 Aurimas Cernius
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -77,7 +77,7 @@ gnote::sync::SyncServer *GvfsSyncServiceAddin::create_sync_server()
     if(!path->query_exists())
       sharp::directory_create(path);
 
-    server = gnote::sync::FileSystemSyncServer::create(path, ignote().preferences());
+    server = gnote::sync::FileSystemSyncServer::create(std::move(path), ignote().preferences());
   }
   else {
     throw std::logic_error("GvfsSyncServiceAddin.create_sync_server() called without being configured");
diff --git a/src/plugins/webdavsyncservice/webdavsyncserviceaddin.cpp 
b/src/plugins/webdavsyncservice/webdavsyncserviceaddin.cpp
index 52ead9c1..ef88f8f3 100644
--- a/src/plugins/webdavsyncservice/webdavsyncserviceaddin.cpp
+++ b/src/plugins/webdavsyncservice/webdavsyncserviceaddin.cpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2012-2013,2017,2019-2021 Aurimas Cernius
+ * Copyright (C) 2012-2013,2017,2019-2022 Aurimas Cernius
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -51,9 +51,9 @@ class WebDavSyncServer
   : public gnote::sync::FileSystemSyncServer
 {
 public:
-  static WebDavSyncServer *create(const Glib::RefPtr<Gio::File> & path, Preferences & prefs)
+  static WebDavSyncServer *create(Glib::RefPtr<Gio::File> && path, Preferences & prefs)
     {
-      return new WebDavSyncServer(path, prefs.sync_client_id());
+      return new WebDavSyncServer(std::move(path), prefs.sync_client_id());
     }
 protected:
   void mkdir_p(const Glib::RefPtr<Gio::File> & path) override
@@ -68,8 +68,8 @@ protected:
       }
     }
 private:
-  WebDavSyncServer(const Glib::RefPtr<Gio::File> & local_sync_path, const Glib::ustring & client_id)
-    : gnote::sync::FileSystemSyncServer(local_sync_path, client_id)
+  WebDavSyncServer(Glib::RefPtr<Gio::File> && local_sync_path, const Glib::ustring & client_id)
+    : gnote::sync::FileSystemSyncServer(std::move(local_sync_path), client_id)
   {}
 };
 
@@ -164,7 +164,7 @@ gnote::sync::SyncServer *WebDavSyncServiceAddin::create_sync_server()
     if(!path->query_exists())
       throw sharp::Exception(Glib::ustring::format(_("Synchronization destination %1 doesn't exist!"), 
sync_uri));
 
-    server = WebDavSyncServer::create(path, ignote().preferences());
+    server = WebDavSyncServer::create(std::move(path), ignote().preferences());
   }
   else {
     throw std::logic_error("GvfsSyncServiceAddin.create_sync_server() called without being configured");
diff --git a/src/synchronization/filesystemsyncserver.cpp b/src/synchronization/filesystemsyncserver.cpp
index 9b96a325..4cf69834 100644
--- a/src/synchronization/filesystemsyncserver.cpp
+++ b/src/synchronization/filesystemsyncserver.cpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2012-2013,2017-2021 Aurimas Cernius
+ * Copyright (C) 2012-2013,2017-2022 Aurimas Cernius
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -54,14 +54,14 @@ int str_to_int(const Glib::ustring & s)
 namespace gnote {
 namespace sync {
 
-SyncServer *FileSystemSyncServer::create(const Glib::RefPtr<Gio::File> & path, Preferences & prefs)
+SyncServer *FileSystemSyncServer::create(Glib::RefPtr<Gio::File> && path, Preferences & prefs)
 {
-  return new FileSystemSyncServer(path, prefs.sync_client_id());
+  return new FileSystemSyncServer(std::move(path), prefs.sync_client_id());
 }
 
 
-FileSystemSyncServer::FileSystemSyncServer(const Glib::RefPtr<Gio::File> & localSyncPath, const 
Glib::ustring & client_id)
-  : m_server_path(localSyncPath)
+FileSystemSyncServer::FileSystemSyncServer(Glib::RefPtr<Gio::File> && localSyncPath, const Glib::ustring & 
client_id)
+  : m_server_path(std::move(localSyncPath))
   , m_cache_path(Glib::build_filename(Glib::get_tmp_dir(), Glib::get_user_name(), "gnote"))
   , m_sync_lock(client_id)
 {
diff --git a/src/synchronization/filesystemsyncserver.hpp b/src/synchronization/filesystemsyncserver.hpp
index 47300afc..0c0c97ae 100644
--- a/src/synchronization/filesystemsyncserver.hpp
+++ b/src/synchronization/filesystemsyncserver.hpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2012-2013,2017-2021 Aurimas Cernius
+ * Copyright (C) 2012-2013,2017-2022 Aurimas Cernius
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -34,8 +34,8 @@ class FileSystemSyncServer
   : public SyncServer
 {
 public:
-  static SyncServer *create(const Glib::RefPtr<Gio::File> & path, Preferences & prefs);
-  FileSystemSyncServer(const Glib::RefPtr<Gio::File> & path, const Glib::ustring & client_id);
+  static SyncServer *create(Glib::RefPtr<Gio::File> && path, Preferences & prefs);
+  FileSystemSyncServer(Glib::RefPtr<Gio::File> && path, const Glib::ustring & client_id);
   virtual bool begin_sync_transaction() override;
   virtual bool commit_sync_transaction() override;
   virtual bool cancel_sync_transaction() override;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]