[gnote] typedef function types



commit c7528745616072e334c9894b9e5472795ff96a17
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Thu Dec 31 15:42:44 2020 +0200

    typedef function types

 src/sharp/propertyeditor.cpp |  4 ++--
 src/sharp/propertyeditor.hpp | 18 ++++++++++++------
 2 files changed, 14 insertions(+), 8 deletions(-)
---
diff --git a/src/sharp/propertyeditor.cpp b/src/sharp/propertyeditor.cpp
index 136f924d..1f0df973 100644
--- a/src/sharp/propertyeditor.cpp
+++ b/src/sharp/propertyeditor.cpp
@@ -51,7 +51,7 @@ namespace sharp {
   }
 
 
-  PropertyEditor::PropertyEditor(std::function<Glib::ustring()> getter, std::function<void(const 
Glib::ustring&)> setter, Gtk::Entry &entry)
+  PropertyEditor::PropertyEditor(GetterT getter, SetterT setter, Gtk::Entry &entry)
     : PropertyEditorBase(entry)
     , m_getter(getter)
     , m_setter(setter)
@@ -74,7 +74,7 @@ namespace sharp {
   }
 
 
-  PropertyEditorBool::PropertyEditorBool(std::function<bool()> getter, std::function<void(bool)> setter, 
Gtk::ToggleButton &button)
+  PropertyEditorBool::PropertyEditorBool(GetterT getter, SetterT setter, Gtk::ToggleButton &button)
     : PropertyEditorBase(button)
     , m_getter(getter)
     , m_setter(setter)
diff --git a/src/sharp/propertyeditor.hpp b/src/sharp/propertyeditor.hpp
index e36ae193..0a0f1713 100644
--- a/src/sharp/propertyeditor.hpp
+++ b/src/sharp/propertyeditor.hpp
@@ -57,21 +57,27 @@ namespace sharp {
       : public PropertyEditorBase
   {
   public:
-    PropertyEditor(std::function<Glib::ustring()> getter, std::function<void(const Glib::ustring&)> setter, 
Gtk::Entry &entry);
+    typedef std::function<Glib::ustring()> GetterT;
+    typedef std::function<void(const Glib::ustring&)> SetterT;
+
+    PropertyEditor(GetterT getter, SetterT setter, Gtk::Entry &entry);
 
     virtual void setup() override;
 
   private:
     void on_changed();
-    std::function<Glib::ustring()> m_getter;
-    std::function<void(const Glib::ustring&)> m_setter;
+    GetterT m_getter;
+    SetterT m_setter;
   };
 
   class PropertyEditorBool
     : public PropertyEditorBase
   {
   public:
-    PropertyEditorBool(std::function<bool()> getter, std::function<void(bool)> setter, Gtk::ToggleButton 
&button);
+    typedef std::function<bool()> GetterT;
+    typedef std::function<void(bool)> SetterT;
+
+    PropertyEditorBool(GetterT getter, SetterT setter, Gtk::ToggleButton &button);
     void add_guard(Gtk::Widget* w)
       {
         m_guarded.push_back(w);
@@ -83,8 +89,8 @@ namespace sharp {
     void guard(bool v);
     void on_changed();
     std::vector<Gtk::Widget*> m_guarded;
-    std::function<bool()> m_getter;
-    std::function<void(bool)> m_setter;
+    GetterT m_getter;
+    SetterT m_setter;
   };
 
 }


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