From f3bdc3b410fe277c35886b75a4c90e93d0d8d29c Mon Sep 17 00:00:00 2001 From: Markus Gans Date: Wed, 19 Dec 2018 22:04:02 +0100 Subject: [PATCH] Use of smart pointers --- ChangeLog | 3 ++ examples/calculator.cpp | 7 +-- examples/choice.cpp | 38 ++++++++-------- examples/dialog.cpp | 4 +- examples/listbox.cpp | 8 ++-- examples/listview.cpp | 2 +- examples/transparent.cpp | 2 +- examples/treeview.cpp | 4 +- examples/ui.cpp | 53 +++++++++++------------ src/fapplication.cpp | 4 -- src/fdialog.cpp | 6 +-- src/ffiledialog.cpp | 45 ++++++------------- src/flabel.cpp | 6 +-- src/fmenu.cpp | 26 +++++------ src/fmenubar.cpp | 8 ++-- src/fmenuitem.cpp | 14 +++--- src/fmessagebox.cpp | 74 ++++++++------------------------ src/fobject.cpp | 10 ++--- src/include/final/fapplication.h | 20 ++++----- src/include/final/fobject.h | 18 ++++---- 20 files changed, 147 insertions(+), 205 deletions(-) diff --git a/ChangeLog b/ChangeLog index 22cc301d..d3d6e0ae 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2018-12-19 Markus Gans + * Use of smart pointers + 2018-12-17 Markus Gans * Improve FButton mouse click animation * Minor data type corrections diff --git a/examples/calculator.cpp b/examples/calculator.cpp index d579714e..15377f98 100644 --- a/examples/calculator.cpp +++ b/examples/calculator.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -236,7 +237,7 @@ class Calc : public finalcut::FDialog }; std::stack bracket_stack{}; - std::map calculator_buttons{}; + std::map > calculator_buttons{}; std::map key_map{}; }; #pragma pack(pop) @@ -252,9 +253,9 @@ Calc::Calc (FWidget* parent) setGeometry (19, 6, 37, 18); addAccelerator('q'); // Press 'q' to quit - for (int key = 0; key < Calc::NUM_OF_BUTTONS; key++) + for (std::size_t key = 0; key < Calc::NUM_OF_BUTTONS; key++) { - auto btn = new Button(this); + auto btn = std::make_shared