[gnote] Move semantics for add_app_menu_item



commit 40f47a53829adda3cbe7022aac89deabcfc47644
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Sun Feb 20 18:22:22 2022 +0200

    Move semantics for add_app_menu_item

 src/actionmanager.cpp  |  7 +++----
 src/actionmanager.hpp  | 11 +++++------
 src/iactionmanager.hpp |  5 ++---
 3 files changed, 10 insertions(+), 13 deletions(-)
---
diff --git a/src/actionmanager.cpp b/src/actionmanager.cpp
index 6c184e0d..54819a3f 100644
--- a/src/actionmanager.cpp
+++ b/src/actionmanager.cpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2011-2019 Aurimas Cernius
+ * Copyright (C) 2011-2019,2022 Aurimas Cernius
  * Copyright (C) 2009 Hubert Figuiere
  *
  * This program is free software: you can redistribute it and/or modify
@@ -117,10 +117,9 @@ namespace gnote {
     return action;
   }
 
-  void ActionManager::add_app_menu_item(int section, int order, const Glib::ustring & label,
-                                        const Glib::ustring & action_def)
+  void ActionManager::add_app_menu_item(int section, int order, Glib::ustring && label, Glib::ustring && 
action_def)
   {
-    m_app_menu_items.insert(std::make_pair(section, AppMenuItem(order, label, action_def)));
+    m_app_menu_items.insert(std::make_pair(section, AppMenuItem(order, std::move(label), 
std::move(action_def))));
   }
 
   void ActionManager::make_app_menu_items()
diff --git a/src/actionmanager.hpp b/src/actionmanager.hpp
index c90ba2aa..4f6a2912 100644
--- a/src/actionmanager.hpp
+++ b/src/actionmanager.hpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2012-2013,2015-2019 Aurimas Cernius
+ * Copyright (C) 2012-2013,2015-2019,2022 Aurimas Cernius
  * Copyright (C) 2009 Hubert Figuiere
  *
  * This program is free software: you can redistribute it and/or modify
@@ -44,8 +44,7 @@ public:
       return m_app_actions;
     }
   virtual Glib::RefPtr<Gio::SimpleAction> add_app_action(const Glib::ustring & name) override;
-  virtual void add_app_menu_item(int section, int order, const Glib::ustring & label,
-                                 const Glib::ustring & action_def) override;
+  virtual void add_app_menu_item(int section, int order, Glib::ustring && label, Glib::ustring && 
action_def) override;
   virtual void register_main_window_action(const Glib::ustring & action, const Glib::VariantType *state_type,
     bool modifying = true) override;
   virtual std::map<Glib::ustring, const Glib::VariantType*> get_main_window_actions() const override;
@@ -69,10 +68,10 @@ private:
     Glib::ustring label;
     Glib::ustring action_def;
 
-    AppMenuItem(int ord, const Glib::ustring & lbl, const Glib::ustring & act_def)
+    AppMenuItem(int ord, Glib::ustring && lbl, Glib::ustring && act_def)
       : order(ord)
-      , label(lbl)
-      , action_def(act_def)
+      , label(std::move(lbl))
+      , action_def(std::move(act_def))
       {}
 
     struct ptr_comparator
diff --git a/src/iactionmanager.hpp b/src/iactionmanager.hpp
index 2fe181e8..f93f618f 100644
--- a/src/iactionmanager.hpp
+++ b/src/iactionmanager.hpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2013,2015-2017,2019,2021 Aurimas Cernius
+ * Copyright (C) 2013,2015-2017,2019,2021-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
@@ -35,8 +35,7 @@ public:
 
   virtual Glib::RefPtr<Gio::SimpleAction> get_app_action(const Glib::ustring & name) const = 0;
   virtual Glib::RefPtr<Gio::SimpleAction> add_app_action(const Glib::ustring & name) = 0;
-  virtual void add_app_menu_item(int section, int order, const Glib::ustring & label,
-                                 const Glib::ustring & action_def) = 0;
+  virtual void add_app_menu_item(int section, int order, Glib::ustring && label, Glib::ustring && 
action_def) = 0;
   virtual void register_main_window_action(const Glib::ustring & action, const Glib::VariantType *state_type,
     bool modifying = true) = 0;
   virtual std::map<Glib::ustring, const Glib::VariantType*> get_main_window_actions() const = 0;


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