Use of default destructors

This commit is contained in:
Markus Gans 2020-11-24 21:06:39 +01:00
parent 25f2abe175
commit 7868a0dee9
101 changed files with 533 additions and 967 deletions

View File

@ -44,8 +44,7 @@ class SegmentView final : public finalcut::FDialog
explicit SegmentView (finalcut::FWidget* = nullptr); explicit SegmentView (finalcut::FWidget* = nullptr);
private: private:
// Typedef struct sevenSegment
typedef struct
{ {
unsigned char a : 1; unsigned char a : 1;
unsigned char b : 1; unsigned char b : 1;
@ -55,7 +54,7 @@ class SegmentView final : public finalcut::FDialog
unsigned char f : 1; unsigned char f : 1;
unsigned char g : 1; unsigned char g : 1;
unsigned char : 1; // padding bit unsigned char : 1; // padding bit
} sevenSegment; };
// Methods // Methods
void hexEncoding(); void hexEncoding();

View File

@ -38,8 +38,8 @@ using finalcut::FSize;
class Background final : public finalcut::FDialog class Background final : public finalcut::FDialog
{ {
public: public:
// Typedef // Using-declaration
typedef std::tuple<uChar, uChar, uChar> RGB; using RGB = std::tuple<uChar, uChar, uChar>;
// Constructor // Constructor
explicit Background (finalcut::FWidget* = nullptr); explicit Background (finalcut::FWidget* = nullptr);
@ -48,7 +48,7 @@ class Background final : public finalcut::FDialog
Background (const Background&) = delete; Background (const Background&) = delete;
// Destructor // Destructor
~Background(); ~Background() noexcept override;
// Disable copy assignment operator (=) // Disable copy assignment operator (=)
Background& operator = (const Background&) = delete; Background& operator = (const Background&) = delete;
@ -169,8 +169,7 @@ Background::Background (finalcut::FWidget* parent)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
Background::~Background() // destructor Background::~Background() noexcept = default; // destructor
{ }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void Background::cb_changed() void Background::cb_changed()

View File

@ -118,7 +118,7 @@ class Calc final : public finalcut::FDialog
explicit Calc (finalcut::FWidget* parent = nullptr); explicit Calc (finalcut::FWidget* parent = nullptr);
// Destructor // Destructor
~Calc() override; ~Calc() override = default;
private: private:
// Typedef and Enumeration // Typedef and Enumeration
@ -305,10 +305,6 @@ Calc::Calc (FWidget* parent)
calculator_buttons[Equals]->addAccelerator(fc::Fkey_enter); calculator_buttons[Equals]->addAccelerator(fc::Fkey_enter);
} }
//----------------------------------------------------------------------
Calc::~Calc()
{ }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void Calc::onKeyPress (finalcut::FKeyEvent* ev) void Calc::onKeyPress (finalcut::FKeyEvent* ev)
{ {

View File

@ -51,7 +51,7 @@ class CheckList final : public finalcut::FDialog
CheckList (const CheckList&) = delete; CheckList (const CheckList&) = delete;
// Destructor // Destructor
~CheckList() override; ~CheckList() override = default;
// Disable copy assignment operator (=) // Disable copy assignment operator (=)
CheckList& operator = (const CheckList&) = delete; CheckList& operator = (const CheckList&) = delete;
@ -115,10 +115,6 @@ CheckList::CheckList (finalcut::FWidget* parent)
); );
} }
//----------------------------------------------------------------------
CheckList::~CheckList() // destructor
{ }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void CheckList::populate() void CheckList::populate()
{ {

View File

@ -27,8 +27,8 @@
using finalcut::FPoint; using finalcut::FPoint;
using finalcut::FSize; using finalcut::FSize;
// Typedef // Using-declaration
typedef std::shared_ptr<finalcut::FRadioButton> FRadioButtonPtr; using FRadioButtonPtr = std::shared_ptr<finalcut::FRadioButton>;
// Function prototypes // Function prototypes
void cb_quit (finalcut::FDialog&); void cb_quit (finalcut::FDialog&);

View File

@ -87,7 +87,7 @@ class Listbox final : public FDialog
Listbox (const Listbox&) = delete; Listbox (const Listbox&) = delete;
// Destructor // Destructor
~Listbox() override; ~Listbox() override = default;
// Disable copy assignment operator (=) // Disable copy assignment operator (=)
Listbox& operator = (const Listbox&) = delete; Listbox& operator = (const Listbox&) = delete;
@ -164,10 +164,6 @@ Listbox::Listbox (FWidget* parent)
); );
} }
//----------------------------------------------------------------------
Listbox::~Listbox() // destructor
{ }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void Listbox::onClose (FCloseEvent* ev) void Listbox::onClose (FCloseEvent* ev)
{ {

View File

@ -47,7 +47,7 @@ class Listview final : public finalcut::FDialog
Listview (const Listview&) = delete; Listview (const Listview&) = delete;
// Destructor // Destructor
~Listview() override; ~Listview() override = default;
// Disable copy assignment operator (=) // Disable copy assignment operator (=)
Listview& operator = (const Listview&) = delete; Listview& operator = (const Listview&) = delete;
@ -124,10 +124,6 @@ Listview::Listview (finalcut::FWidget* parent)
); );
} }
//----------------------------------------------------------------------
Listview::~Listview() // destructor
{ }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void Listview::populate() void Listview::populate()
{ {

View File

@ -38,7 +38,7 @@ class Mandelbrot final : public finalcut::FDialog
explicit Mandelbrot (finalcut::FWidget* = nullptr); explicit Mandelbrot (finalcut::FWidget* = nullptr);
// Destructor // Destructor
~Mandelbrot() override; ~Mandelbrot() override = default;
// Event handlers // Event handlers
void onKeyPress (finalcut::FKeyEvent*) override; void onKeyPress (finalcut::FKeyEvent*) override;
@ -58,10 +58,6 @@ Mandelbrot::Mandelbrot (finalcut::FWidget* parent)
FDialog::setText ("Mandelbrot set"); FDialog::setText ("Mandelbrot set");
} }
//----------------------------------------------------------------------
Mandelbrot::~Mandelbrot()
{ }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void Mandelbrot::draw() void Mandelbrot::draw()
{ {

View File

@ -41,7 +41,7 @@ class Menu final : public finalcut::FDialog
Menu (const Menu&) = delete; Menu (const Menu&) = delete;
// Destructor // Destructor
~Menu() override; ~Menu() override = default;
// Disable copy assignment operator (=) // Disable copy assignment operator (=)
Menu& operator = (const Menu&) = delete; Menu& operator = (const Menu&) = delete;
@ -157,10 +157,6 @@ Menu::Menu (finalcut::FWidget* parent)
Info.setGeometry(FPoint{2, 1}, FSize{36, 5}); Info.setGeometry(FPoint{2, 1}, FSize{36, 5});
} }
//----------------------------------------------------------------------
Menu::~Menu()
{ }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void Menu::configureFileMenuItems() void Menu::configureFileMenuItems()
{ {

View File

@ -43,7 +43,7 @@ class ColorChooser final : public finalcut::FWidget
ColorChooser (const ColorChooser&) = delete; ColorChooser (const ColorChooser&) = delete;
// Destructor // Destructor
~ColorChooser() override; ~ColorChooser() override = default;
// Disable copy assignment operator (=) // Disable copy assignment operator (=)
ColorChooser& operator = (const ColorChooser&) = delete; ColorChooser& operator = (const ColorChooser&) = delete;
@ -85,10 +85,6 @@ ColorChooser::ColorChooser (finalcut::FWidget* parent)
headline << "Color"; headline << "Color";
} }
//----------------------------------------------------------------------
ColorChooser::~ColorChooser()
{ }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline FColor ColorChooser::getForeground() const inline FColor ColorChooser::getForeground() const
{ {
@ -186,7 +182,7 @@ class Brushes final : public finalcut::FWidget
Brushes (const Brushes&) = delete; Brushes (const Brushes&) = delete;
// Destructor // Destructor
~Brushes() override; ~Brushes() override = default;
// Disable copy assignment operator (=) // Disable copy assignment operator (=)
Brushes& operator = (const Brushes&) = delete; Brushes& operator = (const Brushes&) = delete;
@ -231,10 +227,6 @@ Brushes::Brushes (finalcut::FWidget* parent)
headline << "Brush"; headline << "Brush";
} }
//----------------------------------------------------------------------
Brushes::~Brushes()
{ }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void Brushes::setSize (const FSize& size, bool adjust) void Brushes::setSize (const FSize& size, bool adjust)
{ {
@ -328,7 +320,7 @@ class MouseDraw final : public finalcut::FDialog
MouseDraw (const MouseDraw&) = delete; MouseDraw (const MouseDraw&) = delete;
// Destructor // Destructor
~MouseDraw() override; ~MouseDraw() override = default;
// Disable copy assignment operator (=) // Disable copy assignment operator (=)
MouseDraw& operator = (const MouseDraw&) = delete; MouseDraw& operator = (const MouseDraw&) = delete;
@ -377,10 +369,6 @@ MouseDraw::MouseDraw (finalcut::FWidget* parent)
brush.setPos (FPoint{1, 12}); brush.setPos (FPoint{1, 12});
} }
//----------------------------------------------------------------------
MouseDraw::~MouseDraw()
{ }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void MouseDraw::setGeometry ( const FPoint& p, const FSize& s, bool adjust) void MouseDraw::setGeometry ( const FPoint& p, const FSize& s, bool adjust)
{ {

View File

@ -53,7 +53,7 @@ class RotoZoomer final : public finalcut::FDialog
explicit RotoZoomer (finalcut::FWidget* = nullptr, bool = false, int = 314); explicit RotoZoomer (finalcut::FWidget* = nullptr, bool = false, int = 314);
// Destructor // Destructor
~RotoZoomer() override; ~RotoZoomer() override = default;
// Accessors // Accessors
finalcut::FString getReport() const; finalcut::FString getReport() const;
@ -123,10 +123,6 @@ RotoZoomer::RotoZoomer (finalcut::FWidget* parent, bool b, int l)
} }
} }
//----------------------------------------------------------------------
RotoZoomer::~RotoZoomer()
{ }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void RotoZoomer::draw() void RotoZoomer::draw()
{ {

View File

@ -41,7 +41,7 @@ class Scrollview final : public finalcut::FScrollView
Scrollview (const Scrollview&) = delete; Scrollview (const Scrollview&) = delete;
// Destructor // Destructor
~Scrollview() override; ~Scrollview() override = default;
// Disable copy assignment operator (=) // Disable copy assignment operator (=)
Scrollview& operator = (const Scrollview&) = delete; Scrollview& operator = (const Scrollview&) = delete;
@ -110,10 +110,6 @@ Scrollview::Scrollview (finalcut::FWidget* parent)
); );
} }
//----------------------------------------------------------------------
Scrollview::~Scrollview()
{ }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void Scrollview::setScrollSize (const FSize& size) void Scrollview::setScrollSize (const FSize& size)
{ {
@ -197,7 +193,7 @@ class Scrollviewdemo final : public finalcut::FDialog
explicit Scrollviewdemo (finalcut::FWidget* = nullptr); explicit Scrollviewdemo (finalcut::FWidget* = nullptr);
// Destructor // Destructor
~Scrollviewdemo() override; ~Scrollviewdemo() override = default;
// Event handler // Event handler
void onClose (finalcut::FCloseEvent*) override; void onClose (finalcut::FCloseEvent*) override;
@ -240,10 +236,6 @@ Scrollviewdemo::Scrollviewdemo (finalcut::FWidget* parent)
label << L"Use scrollbars to change the viewport position"; label << L"Use scrollbars to change the viewport position";
} }
//----------------------------------------------------------------------
Scrollviewdemo::~Scrollviewdemo()
{ }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void Scrollviewdemo::cb_quit() void Scrollviewdemo::cb_quit()
{ {

View File

@ -44,7 +44,7 @@ class AttribDlg final : public finalcut::FDialog
AttribDlg (const AttribDlg&) = delete; AttribDlg (const AttribDlg&) = delete;
// Destructor // Destructor
~AttribDlg() override; ~AttribDlg() override = default;
// Disable copy assignment operator (=) // Disable copy assignment operator (=)
AttribDlg& operator = (const AttribDlg&) = delete; AttribDlg& operator = (const AttribDlg&) = delete;
@ -100,10 +100,6 @@ AttribDlg::AttribDlg (finalcut::FWidget* parent)
); );
} }
//----------------------------------------------------------------------
AttribDlg::~AttribDlg()
{ }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FColor AttribDlg::getBGColor() const FColor AttribDlg::getBGColor() const
{ {
@ -226,8 +222,7 @@ class AttribDemo final : public finalcut::FWidget
explicit AttribDemo (FWidget* = nullptr); explicit AttribDemo (FWidget* = nullptr);
// Destructor // Destructor
~AttribDemo() override ~AttribDemo() override = default;
{ }
// Event handler // Event handler
void onWheel (finalcut::FWheelEvent* ev) override void onWheel (finalcut::FWheelEvent* ev) override

View File

@ -36,23 +36,23 @@ using finalcut::FStyle;
class Transparent final : public finalcut::FDialog class Transparent final : public finalcut::FDialog
{ {
public: public:
// Typedef and Enumeration // Enumeration
typedef enum ttype enum class Type
{ {
transparent = 0, transparent = 0,
shadow = 1, shadow = 1,
inherit_background = 2 inherit_background = 2
} trans_type; };
// Constructor // Constructor
explicit Transparent ( finalcut::FWidget* = nullptr explicit Transparent ( finalcut::FWidget* = nullptr
, trans_type = transparent ); , Type = Type::transparent );
// Disable copy constructor // Disable copy constructor
Transparent (const Transparent&) = delete; Transparent (const Transparent&) = delete;
// Destructor // Destructor
~Transparent() override; ~Transparent() override = default;
// Disable copy assignment operator (=) // Disable copy assignment operator (=)
Transparent& operator = (const Transparent&) = delete; Transparent& operator = (const Transparent&) = delete;
@ -65,12 +65,12 @@ class Transparent final : public finalcut::FDialog
void onKeyPress (finalcut::FKeyEvent* ev) override; void onKeyPress (finalcut::FKeyEvent* ev) override;
// Data members // Data members
trans_type type; Type type;
}; };
//---------------------------------------------------------------------- //----------------------------------------------------------------------
Transparent::Transparent ( finalcut::FWidget* parent Transparent::Transparent ( finalcut::FWidget* parent
, Transparent::trans_type tt ) , Transparent::Type tt )
: finalcut::FDialog{parent} : finalcut::FDialog{parent}
, type{tt} , type{tt}
{ {
@ -80,10 +80,6 @@ Transparent::Transparent ( finalcut::FWidget* parent
FWidget::setStatusbarMessage("Press Q to quit"); FWidget::setStatusbarMessage("Press Q to quit");
} }
//----------------------------------------------------------------------
Transparent::~Transparent()
{ }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void Transparent::draw() void Transparent::draw()
{ {
@ -92,13 +88,13 @@ void Transparent::draw()
if ( finalcut::FTerm::isMonochron() ) if ( finalcut::FTerm::isMonochron() )
setReverse(true); setReverse(true);
if ( type == shadow ) if ( type == Type::shadow )
{ {
const auto& wc = getColorTheme(); const auto& wc = getColorTheme();
print() << FColorPair {wc->shadow_bg, wc->shadow_fg} print() << FColorPair {wc->shadow_bg, wc->shadow_fg}
<< FStyle {fc::ColorOverlay}; << FStyle {fc::ColorOverlay};
} }
else if ( type == inherit_background ) else if ( type == Type::inherit_background )
{ {
if ( finalcut::FTerm::getMaxColor() > 8 ) if ( finalcut::FTerm::getMaxColor() > 8 )
print() << FColorPair {fc::Blue, fc::Black}; print() << FColorPair {fc::Blue, fc::Black};
@ -152,7 +148,7 @@ class MainWindow final : public finalcut::FDialog
MainWindow (const MainWindow&) = delete; MainWindow (const MainWindow&) = delete;
// Destructor // Destructor
~MainWindow() override; ~MainWindow() override = default;
// Disable copy assignment operator (=) // Disable copy assignment operator (=)
MainWindow& operator = (const MainWindow&) = delete; MainWindow& operator = (const MainWindow&) = delete;
@ -202,12 +198,12 @@ MainWindow::MainWindow (finalcut::FWidget* parent)
transpwin->setGeometry (FPoint{6, 3}, FSize{29, 12}); transpwin->setGeometry (FPoint{6, 3}, FSize{29, 12});
transpwin->unsetTransparentShadow(); transpwin->unsetTransparentShadow();
shadowwin = new Transparent(this, Transparent::shadow); shadowwin = new Transparent(this, Transparent::Type::shadow);
shadowwin->setText("shadow"); shadowwin->setText("shadow");
shadowwin->setGeometry (FPoint{46, 11}, FSize{29, 12}); shadowwin->setGeometry (FPoint{46, 11}, FSize{29, 12});
shadowwin->unsetTransparentShadow(); shadowwin->unsetTransparentShadow();
ibg = new Transparent(this, Transparent::inherit_background); ibg = new Transparent(this, Transparent::Type::inherit_background);
ibg->setText("inherit background"); ibg->setText("inherit background");
ibg->setGeometry (FPoint{42, 3}, FSize{29, 7}); ibg->setGeometry (FPoint{42, 3}, FSize{29, 7});
ibg->unsetTransparentShadow(); ibg->unsetTransparentShadow();
@ -219,10 +215,6 @@ MainWindow::MainWindow (finalcut::FWidget* parent)
activateDialog(); activateDialog();
} }
//----------------------------------------------------------------------
MainWindow::~MainWindow()
{ }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void MainWindow::draw() void MainWindow::draw()
{ {

View File

@ -151,7 +151,7 @@ class Treeview final : public finalcut::FDialog
Treeview (const Treeview&) = delete; Treeview (const Treeview&) = delete;
// Destructor // Destructor
~Treeview() override; ~Treeview() override = default;
// Disable copy assignment operator (=) // Disable copy assignment operator (=)
Treeview& operator = (const Treeview&) = delete; Treeview& operator = (const Treeview&) = delete;
@ -161,6 +161,12 @@ class Treeview final : public finalcut::FDialog
struct TreeItem; // forward declaration struct TreeItem; // forward declaration
// Methods // Methods
auto initAfrica() -> std::initializer_list<TreeItem>;
auto initAsia() -> std::initializer_list<TreeItem>;
auto initEurope() -> std::initializer_list<TreeItem>;
auto initNorthAmerica() -> std::initializer_list<TreeItem>;
auto initSouthAmerica() -> std::initializer_list<TreeItem>;
auto initOceania() -> std::initializer_list<TreeItem>;
void adjustSize() override; void adjustSize() override;
// Event handler // Event handler
@ -170,12 +176,12 @@ class Treeview final : public finalcut::FDialog
bool initialized{false}; bool initialized{false};
finalcut::FListView listview{this}; finalcut::FListView listview{this};
finalcut::FButton quit{this}; finalcut::FButton quit{this};
static TreeItem africa[]; std::vector<TreeItem> africa{initAfrica()};
static TreeItem asia[]; std::vector<TreeItem> asia{initAsia()};
static TreeItem europe[]; std::vector<TreeItem> europe{initEurope()};
static TreeItem north_america[]; std::vector<TreeItem> north_america{initNorthAmerica()};
static TreeItem south_america[]; std::vector<TreeItem> south_america{initSouthAmerica()};
static TreeItem oceania[]; std::vector<TreeItem> oceania{initOceania()};
}; };
@ -195,133 +201,9 @@ struct Treeview::TreeItem
const char* name; const char* name;
const char* population; const char* population;
const char* density; const char* density;
TreeItem* child_element; std::vector<TreeItem> child_element;
}; };
//----------------------------------------------------------------------
// class Treeview - array data
//----------------------------------------------------------------------
Treeview::TreeItem Treeview::africa[] =
{
{ "Algeria", "40,400,000", "15.9", nullptr },
{ "Angola", "25,789,024", "20.69", nullptr },
{ "Botswana", "2,250,260", "3.7", nullptr },
{ "Cameroon", "22,534,532", "39.7", nullptr },
{ "Chad", "13,670,084", "8.6", nullptr },
{ "Egypt", "94,666,000", "87", nullptr },
{ "Ethiopia", "102,374,044", "92.7", nullptr },
{ "Ivory Coast", "23,740,424", "63.9", nullptr },
{ "Libya", "6,541,948", "3.55", nullptr },
{ "Madagascar", "24,430,325", "35.2", nullptr },
{ "Mali", "14,517,176", "11.7", nullptr },
{ "Mauritania", "4,301,018", "3.4", nullptr },
{ "Mozambique", "24,692,144", "28.7", nullptr },
{ "Namibia", "2,113,077", "2.54", nullptr },
{ "Niger", "20,672,987", "12.1", nullptr },
{ "Nigeria", "185,989,640", "197.2", nullptr },
{ "Somalia", "14,317,996", "19.31", nullptr },
{ "South Africa", "54,956,900", "42.4", nullptr },
{ "South Sudan", "12,340,000", "13.33", nullptr },
{ "Sudan", "39,578,828", "21.3", nullptr },
{ "Tanzania", "51,820,00", "47.5", nullptr },
{ "Zambia", "16,212,000", "17.2", nullptr },
{ nullptr, nullptr, nullptr, nullptr }
};
Treeview::TreeItem Treeview::asia[] =
{
{ "Afghanistan", "34,656,032", "49.88", nullptr },
{ "China", "1,403,500,365", "145.0", nullptr },
{ "India", "1,324,171,354", "393.9", nullptr },
{ "Indonesia", "261,115,456", "124.66", nullptr },
{ "Iran", "80,829,192", "48.0", nullptr },
{ "Iraq", "37,202,572", "82.7", nullptr },
{ "Japan", "126,740,000", "336.0", nullptr },
{ "Kazakhstan", "17,987,736", "6.49", nullptr },
{ "Mongolia", "3,081,677", "1.97", nullptr },
{ "Myanmar", "51,486,253", "76.0", nullptr },
{ "Pakistan", "207,774,520", "244.4", nullptr },
{ "Russia", "144,463,451", "8.4", nullptr },
{ "Saudi Arabia", "33,000,000", "15.0", nullptr },
{ "Thailand", "68,863,514", "132.1", nullptr },
{ "Turkey", "79,814,871", "102.0", nullptr },
{ "Turkmenistan", "5,662,544", "10.5", nullptr },
{ "Uzbekistan", "32,979,000", "70.5", nullptr },
{ "Vietnam", "94,569,072", "276.03", nullptr },
{ "Yemen", "27,584,213", "44.7", nullptr },
{ nullptr, nullptr, nullptr, nullptr }
};
Treeview::TreeItem Treeview::europe[] =
{
{ "Austria", "8,794,267", "104.0", nullptr },
{ "Belarus", "9,498,700", "45.8", nullptr },
{ "Bulgaria", "7,101,859", "64.9", nullptr },
{ "Czech Republic", "10,610,947", "134.0", nullptr },
{ "Finland", "5,506,312", "16.0", nullptr },
{ "France", "66,991,000", "103.0", nullptr },
{ "Germany", "82,175,700", "227.0", nullptr },
{ "Greece", "11,183,716", "82.0", nullptr },
{ "Hungary", "9,797,561", "105.3", nullptr },
{ "Iceland", "332,529", "3.2", nullptr },
{ "Italy", "60,589,445", "201.3", nullptr },
{ "Norway", "5,267,146", "15.8", nullptr },
{ "Poland", "38,634,007", "123.0", nullptr },
{ "Portugal", "10,309,573", "115.0", nullptr },
{ "Romania", "19,638,000", "84.4", nullptr },
{ "Serbia", "7,058,322", "91.1", nullptr },
{ "Spain", "46,468,102", "92.0", nullptr },
{ "Sweden", "10,065,389", "22.0", nullptr },
{ "United Kingdom", "65,648,000", "270.7", nullptr },
{ nullptr, nullptr, nullptr, nullptr }
};
Treeview::TreeItem Treeview::north_america[] =
{
{ "Canada", "35,151,728", "3.92", nullptr },
{ "Cuba", "11,239,224", "102.3", nullptr },
{ "Greenland", "56,483", "0.028", nullptr },
{ "Guatemala", "16,582,469", "129.0", nullptr },
{ "Honduras", "9,112,867", "64.0", nullptr },
{ "Mexico", "119,530,753", "61.0", nullptr },
{ "Nicaragua", "6,167,237", "51.0", nullptr },
{ "USA", "325,365,189", "35.0", nullptr },
{ nullptr, nullptr, nullptr, nullptr }
};
Treeview::TreeItem Treeview::south_america[] =
{
{ "Argentina", "43,847,430", "14.4", nullptr },
{ "Bolivia", "11,410,651", "10.4", nullptr },
{ "Brazil", "208,064,000", "24.35", nullptr },
{ "Chile", "18,006,407", "24.0", nullptr },
{ "Colombia", "49,364,592", "40.74", nullptr },
{ "Ecuador", "16,385,068", "58.95", nullptr },
{ "Guyana", "773,303", "3.502", nullptr },
{ "Paraguay", "6,725,308", "17.2", nullptr },
{ "Peru", "31,826,018", "23.0", nullptr },
{ "Venezuela", "31,568,179", "33.75", nullptr },
{ nullptr, nullptr, nullptr, nullptr }
};
Treeview::TreeItem Treeview::oceania[] =
{
{ "Australia", "24,675,900", "3.2", nullptr },
{ "Papua New Guinea", "7,059,653", "15.0", nullptr },
{ "Papua", "3,486,432", "11.0", nullptr },
{ "New Zealand", "4,823,090", "17.5", nullptr },
{ "West Papua", "877,437", "6.3", nullptr },
{ "Solomon Islands", "599,419", "18.1", nullptr },
{ "New Caledonia", "268,767", "14.5", nullptr },
{ "Fiji", "898,76", "46.4", nullptr },
{ "Hawaii", "1,428,557", "82.6", nullptr },
{ "Vanuatu", "270,402", "19.7", nullptr },
{ "French Polynesia", "280,208", "76.0", nullptr },
{ "Samoa", "192,342", "68.0", nullptr },
{ "Kiribati", "110,136", "152.0", nullptr },
{ nullptr, nullptr, nullptr, nullptr }
};
// constructors and destructor // constructors and destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -351,30 +233,28 @@ Treeview::Treeview (finalcut::FWidget* parent)
listview.setTreeView(); listview.setTreeView();
// Populate FListView with a list of items // Populate FListView with a list of items
static TreeItem continent_list[] = const std::vector<TreeItem> continent_list
{ {
{ "Africa", "944,000,000", "31.2", africa }, { "Africa", "944,000,000", "31.2", africa },
{ "Asia", "4,010,000,000", "90.3", asia }, { "Asia", "4,010,000,000", "90.3", asia },
{ "Europe", "733,000,000", "69.9", europe }, { "Europe", "733,000,000", "69.9", europe },
{ "North America", "523,000,000", "21", north_america }, { "North America", "523,000,000", "21", north_america },
{ "South America", "381,000,000", "21.4", south_america }, { "South America", "381,000,000", "21.4", south_america },
{ "Antarctica", "1000", "0", nullptr }, { "Antarctica", "1000", "0", {} },
{ "Australia/Oceania", "34,000,000", "4", oceania } { "Australia/Oceania", "34,000,000", "4", oceania }
}; };
for (const auto& continent : continent_list) for (const auto& continent : continent_list)
{ {
const TreeItem* country_list = continent.child_element;
finalcut::FStringList continent_line ( continent.begin() finalcut::FStringList continent_line ( continent.begin()
, continent.end() ); , continent.end() );
auto iter = listview.insert (continent_line); auto iter = listview.insert (continent_line);
while ( country_list && country_list->name ) for (const auto& country : continent.child_element)
{ {
finalcut::FStringList country_line ( country_list->begin() finalcut::FStringList country_line ( country.begin()
, country_list->end() ); , country.end() );
listview.insert (country_line, iter); listview.insert (country_line, iter);
country_list++;
} }
} }
@ -395,8 +275,149 @@ Treeview::Treeview (finalcut::FWidget* parent)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
Treeview::~Treeview() // destructor auto Treeview::initAfrica() -> std::initializer_list<Treeview::TreeItem>
{ } {
static const auto list = std::initializer_list<Treeview::TreeItem>
{
{ "Algeria", "40,400,000", "15.9", {} },
{ "Angola", "25,789,024", "20.69", {} },
{ "Botswana", "2,250,260", "3.7", {} },
{ "Cameroon", "22,534,532", "39.7", {} },
{ "Chad", "13,670,084", "8.6", {} },
{ "Egypt", "94,666,000", "87", {} },
{ "Ethiopia", "102,374,044", "92.7", {} },
{ "Ivory Coast", "23,740,424", "63.9", {} },
{ "Libya", "6,541,948", "3.55", {} },
{ "Madagascar", "24,430,325", "35.2", {} },
{ "Mali", "14,517,176", "11.7", {} },
{ "Mauritania", "4,301,018", "3.4", {} },
{ "Mozambique", "24,692,144", "28.7", {} },
{ "Namibia", "2,113,077", "2.54", {} },
{ "Niger", "20,672,987", "12.1", {} },
{ "Nigeria", "185,989,640", "197.2", {} },
{ "Somalia", "14,317,996", "19.31", {} },
{ "South Africa", "54,956,900", "42.4", {} },
{ "South Sudan", "12,340,000", "13.33", {} },
{ "Sudan", "39,578,828", "21.3", {} },
{ "Tanzania", "51,820,00", "47.5", {} },
{ "Zambia", "16,212,000", "17.2", {} }
};
return list;
}
//----------------------------------------------------------------------
auto Treeview::initAsia() -> std::initializer_list<Treeview::TreeItem>
{
static const auto list = std::initializer_list<Treeview::TreeItem>
{
{ "Afghanistan", "34,656,032", "49.88", {} },
{ "China", "1,403,500,365", "145.0", {} },
{ "India", "1,324,171,354", "393.9", {} },
{ "Indonesia", "261,115,456", "124.66", {} },
{ "Iran", "80,829,192", "48.0", {} },
{ "Iraq", "37,202,572", "82.7", {} },
{ "Japan", "126,740,000", "336.0", {} },
{ "Kazakhstan", "17,987,736", "6.49", {} },
{ "Mongolia", "3,081,677", "1.97", {} },
{ "Myanmar", "51,486,253", "76.0", {} },
{ "Pakistan", "207,774,520", "244.4", {} },
{ "Russia", "144,463,451", "8.4", {} },
{ "Saudi Arabia", "33,000,000", "15.0", {} },
{ "Thailand", "68,863,514", "132.1", {} },
{ "Turkey", "79,814,871", "102.0", {} },
{ "Turkmenistan", "5,662,544", "10.5", {} },
{ "Uzbekistan", "32,979,000", "70.5", {} },
{ "Vietnam", "94,569,072", "276.03", {} },
{ "Yemen", "27,584,213", "44.7", {} }
};
return list;
}
//----------------------------------------------------------------------
auto Treeview::initEurope() -> std::initializer_list<Treeview::TreeItem>
{
static const auto list = std::initializer_list<Treeview::TreeItem>
{
{ "Austria", "8,794,267", "104.0", {} },
{ "Belarus", "9,498,700", "45.8", {} },
{ "Bulgaria", "7,101,859", "64.9", {} },
{ "Czech Republic", "10,610,947", "134.0", {} },
{ "Finland", "5,506,312", "16.0", {} },
{ "France", "66,991,000", "103.0", {} },
{ "Germany", "82,175,700", "227.0", {} },
{ "Greece", "11,183,716", "82.0", {} },
{ "Hungary", "9,797,561", "105.3", {} },
{ "Iceland", "332,529", "3.2", {} },
{ "Italy", "60,589,445", "201.3", {} },
{ "Norway", "5,267,146", "15.8", {} },
{ "Poland", "38,634,007", "123.0", {} },
{ "Portugal", "10,309,573", "115.0", {} },
{ "Romania", "19,638,000", "84.4", {} },
{ "Serbia", "7,058,322", "91.1", {} },
{ "Spain", "46,468,102", "92.0", {} },
{ "Sweden", "10,065,389", "22.0", {} },
{ "United Kingdom", "65,648,000", "270.7", {} }
};
return list;
}
//----------------------------------------------------------------------
auto Treeview::initNorthAmerica() -> std::initializer_list<Treeview::TreeItem>
{
static const auto list = std::initializer_list<Treeview::TreeItem>
{
{ "Canada", "35,151,728", "3.92", {} },
{ "Cuba", "11,239,224", "102.3", {} },
{ "Greenland", "56,483", "0.028", {} },
{ "Guatemala", "16,582,469", "129.0", {} },
{ "Honduras", "9,112,867", "64.0", {} },
{ "Mexico", "119,530,753", "61.0", {} },
{ "Nicaragua", "6,167,237", "51.0", {} },
{ "USA", "325,365,189", "35.0", {} }
};
return list;
}
//----------------------------------------------------------------------
auto Treeview::initSouthAmerica() -> std::initializer_list<Treeview::TreeItem>
{
static const auto list = std::initializer_list<Treeview::TreeItem>
{
{ "Argentina", "43,847,430", "14.4", {} },
{ "Bolivia", "11,410,651", "10.4", {} },
{ "Brazil", "208,064,000", "24.35", {} },
{ "Chile", "18,006,407", "24.0", {} },
{ "Colombia", "49,364,592", "40.74", {} },
{ "Ecuador", "16,385,068", "58.95", {} },
{ "Guyana", "773,303", "3.502", {} },
{ "Paraguay", "6,725,308", "17.2", {} },
{ "Peru", "31,826,018", "23.0", {} },
{ "Venezuela", "31,568,179", "33.75", {} }
};
return list;
}
//----------------------------------------------------------------------
auto Treeview::initOceania() -> std::initializer_list<Treeview::TreeItem>
{
static const auto list = std::initializer_list<Treeview::TreeItem>
{
{ "Australia", "24,675,900", "3.2", {} },
{ "Papua New Guinea", "7,059,653", "15.0", {} },
{ "Papua", "3,486,432", "11.0", {} },
{ "New Zealand", "4,823,090", "17.5", {} },
{ "West Papua", "877,437", "6.3", {} },
{ "Solomon Islands", "599,419", "18.1", {} },
{ "New Caledonia", "268,767", "14.5", {} },
{ "Fiji", "898,76", "46.4", {} },
{ "Hawaii", "1,428,557", "82.6", {} },
{ "Vanuatu", "270,402", "19.7", {} },
{ "French Polynesia", "280,208", "76.0", {} },
{ "Samoa", "192,342", "68.0", {} },
{ "Kiribati", "110,136", "152.0", {} }
};
return list;
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void Treeview::adjustSize() void Treeview::adjustSize()

View File

@ -196,7 +196,7 @@ class TextWindow final : public finalcut::FDialog
TextWindow (const TextWindow&) = delete; TextWindow (const TextWindow&) = delete;
// Destructor // Destructor
~TextWindow() override; ~TextWindow() override = default;
// Disable copy assignment operator (=) // Disable copy assignment operator (=)
TextWindow& operator = (const TextWindow&) = delete; TextWindow& operator = (const TextWindow&) = delete;
@ -230,10 +230,6 @@ TextWindow::TextWindow (finalcut::FWidget* parent)
scrolltext.deleteRange(3, 4); scrolltext.deleteRange(3, 4);
} }
//----------------------------------------------------------------------
TextWindow::~TextWindow() // destructor
{ }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void TextWindow::append (const finalcut::FString& str) void TextWindow::append (const finalcut::FString& str)
{ {
@ -262,7 +258,7 @@ class MyDialog final : public finalcut::FDialog
MyDialog (const MyDialog&) = delete; MyDialog (const MyDialog&) = delete;
// Destructor // Destructor
~MyDialog() override; ~MyDialog() override = default;
// Disable copy assignment operator (=) // Disable copy assignment operator (=)
MyDialog& operator = (const MyDialog&) = delete; MyDialog& operator = (const MyDialog&) = delete;
@ -375,10 +371,6 @@ MyDialog::MyDialog (finalcut::FWidget* parent)
init(); init();
} }
//----------------------------------------------------------------------
MyDialog::~MyDialog() // destructor
{ }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void MyDialog::init() void MyDialog::init()
{ {

View File

@ -41,7 +41,7 @@ class Watch final : public finalcut::FDialog
Watch (const Watch&) = delete; Watch (const Watch&) = delete;
// Destructor // Destructor
~Watch() override; ~Watch() override = default;
// Disable copy assignment operator (=) // Disable copy assignment operator (=)
Watch& operator = (const Watch&) = delete; Watch& operator = (const Watch&) = delete;
@ -118,10 +118,6 @@ Watch::Watch (FWidget* parent)
); );
} }
//----------------------------------------------------------------------
Watch::~Watch()
{ }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void Watch::printTime() void Watch::printTime()
{ {

View File

@ -44,7 +44,7 @@ class SmallWindow final : public finalcut::FDialog
SmallWindow (const SmallWindow&) = delete; SmallWindow (const SmallWindow&) = delete;
// Destructor // Destructor
~SmallWindow() override; ~SmallWindow() override = default;
// Disable copy assignment operator (=) // Disable copy assignment operator (=)
SmallWindow& operator = (const SmallWindow&) = delete; SmallWindow& operator = (const SmallWindow&) = delete;
@ -107,10 +107,6 @@ SmallWindow::SmallWindow (finalcut::FWidget* parent)
bottom_label.setGeometry (FPoint{13, 3}, FSize{6, 3}); bottom_label.setGeometry (FPoint{13, 3}, FSize{6, 3});
} }
//----------------------------------------------------------------------
SmallWindow::~SmallWindow()
{ }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void SmallWindow::adjustSize() void SmallWindow::adjustSize()
{ {
@ -177,15 +173,22 @@ class Window final : public finalcut::FDialog
Window& operator = (const Window&) = delete; Window& operator = (const Window&) = delete;
private: private:
struct win_data struct WinData
{ {
// Constructor // Constructor
win_data() = default; WinData() = default;
// Disable copy constructor
win_data (const win_data&) = delete;
// Disable copy assignment operator (=) // copy constructor
win_data& operator = (const win_data&) = delete; WinData (const WinData&) = default;
// move constructor
WinData (WinData&&) noexcept = default;
// copy assignment operator (=)
WinData& operator = (const WinData&) = default;
// move assignment operator (=)
WinData& operator = (WinData&&) noexcept = default;
// Data members // Data members
bool is_open{false}; bool is_open{false};
@ -216,10 +219,10 @@ class Window final : public finalcut::FDialog
void cb_closeWindows(); void cb_closeWindows();
void cb_next(); void cb_next();
void cb_previous(); void cb_previous();
void cb_destroyWindow (win_data*) const; void cb_destroyWindow (WinData&) const;
// Data members // Data members
std::vector<win_data*> windows{}; std::vector<WinData> windows{};
finalcut::FString drop_down_symbol{fc::BlackDownPointingTriangle}; finalcut::FString drop_down_symbol{fc::BlackDownPointingTriangle};
finalcut::FMenuBar Menubar{this}; finalcut::FMenuBar Menubar{this};
finalcut::FMenu File{"&File", &Menubar}; finalcut::FMenu File{"&File", &Menubar};
@ -262,9 +265,9 @@ Window::Window (finalcut::FWidget* parent)
// Generate data vector for the windows // Generate data vector for the windows
for (uInt n{1}; n < 7; n++) for (uInt n{1}; n < 7; n++)
{ {
auto win_dat = new win_data; WinData win_dat;
win_dat->title.sprintf("Window %1u", n); win_dat.title.sprintf("Window %1u", n);
windows.push_back(win_dat); windows.emplace_back(std::move(win_dat));
} }
} }
@ -275,13 +278,12 @@ Window::~Window()
while ( iter != windows.end() ) while ( iter != windows.end() )
{ {
auto win_dat = *iter; auto& win_dat = *iter;
// Remove all callbacks before Window::cb_destroyWindow() will be called // Remove all callbacks before Window::cb_destroyWindow() will be called
if ( win_dat->is_open && win_dat->dgl ) if ( win_dat.is_open && win_dat.dgl )
win_dat->dgl->delCallback(); win_dat.dgl->delCallback();
delete win_dat;
iter = windows.erase(iter); iter = windows.erase(iter);
} }
} }
@ -366,12 +368,12 @@ void Window::adjustSize()
while ( iter != windows.end() ) while ( iter != windows.end() )
{ {
if ( (*iter)->is_open ) if ( (*iter).is_open )
{ {
const auto n = int(std::distance(first, iter)); const auto n = int(std::distance(first, iter));
const int x = dx + 5 + (n % 3) * 25 + int(n / 3) * 3; const int x = dx + 5 + (n % 3) * 25 + int(n / 3) * 3;
const int y = dy + 11 + int(n / 3) * 3; const int y = dy + 11 + int(n / 3) * 3;
(*iter)->dgl->setPos (FPoint{x, y}); (*iter).dgl->setPos (FPoint{x, y});
} }
++iter; ++iter;
@ -459,13 +461,13 @@ void Window::cb_createWindows()
while ( iter != windows.end() ) while ( iter != windows.end() )
{ {
if ( ! (*iter)->is_open ) if ( ! (*iter).is_open )
{ {
auto win_dat = *iter; auto& win_dat = *iter;
auto win = new SmallWindow(this); auto win = new SmallWindow(this);
win_dat->dgl = win; win_dat.dgl = win;
win_dat->is_open = true; win_dat.is_open = true;
win->setText(win_dat->title); win->setText(win_dat.title);
const auto n = int(std::distance(first, iter)); const auto n = int(std::distance(first, iter));
const int x = dx + 5 + (n % 3) * 25 + int(n / 3) * 3; const int x = dx + 5 + (n % 3) * 25 + int(n / 3) * 3;
const int y = dy + 11 + int(n / 3) * 3; const int y = dy + 11 + int(n / 3) * 3;
@ -478,7 +480,7 @@ void Window::cb_createWindows()
( (
"destroy", "destroy",
this, &Window::cb_destroyWindow, this, &Window::cb_destroyWindow,
win_dat std::ref(win_dat)
); );
} }
@ -551,13 +553,10 @@ void Window::cb_previous()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void Window::cb_destroyWindow (win_data* win_dat) const void Window::cb_destroyWindow (WinData& win_dat) const
{ {
if ( win_dat ) win_dat.is_open = false;
{ win_dat.dgl = nullptr;
win_dat->is_open = false;
win_dat->dgl = nullptr;
}
} }

View File

@ -374,7 +374,7 @@ void FButtonGroup::drawLabel()
else else
FWidget::setPrintPos (FPoint{0, 1}); FWidget::setPrintPos (FPoint{0, 1});
drawText (label_text, hotkeypos); drawText (std::move(label_text), hotkeypos);
setViewportPrint(); setViewportPrint();
} }
@ -397,7 +397,7 @@ void FButtonGroup::init()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FButtonGroup::drawText ( const FString& label_text void FButtonGroup::drawText ( FString&& label_text
, std::size_t hotkeypos ) , std::size_t hotkeypos )
{ {
const auto& wc = getColorTheme(); const auto& wc = getColorTheme();

View File

@ -46,9 +46,7 @@ FCheckBox::FCheckBox (const FString& txt, FWidget* parent)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FCheckBox::~FCheckBox() // destructor FCheckBox::~FCheckBox() noexcept = default; // destructor
{ }
// private methods of FCheckBox // private methods of FCheckBox
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -47,8 +47,7 @@ FCheckMenuItem::FCheckMenuItem (const FString& txt, FWidget* parent)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FCheckMenuItem::~FCheckMenuItem() // destructor FCheckMenuItem::~FCheckMenuItem() noexcept = default; // destructor
{ }
// private methods of FCheckMenuItem // private methods of FCheckMenuItem

View File

@ -177,9 +177,7 @@ FComboBox::FComboBox (FWidget* parent)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FComboBox::~FComboBox() // destructor FComboBox::~FComboBox() noexcept = default; // destructor
{ }
// public methods of FComboBox // public methods of FComboBox
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -46,8 +46,7 @@ FDialogListMenu::FDialogListMenu (const FString& txt, FWidget* parent)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FDialogListMenu::~FDialogListMenu() FDialogListMenu::~FDialogListMenu() noexcept = default; // destructor
{ }
// private methods of FMenu // private methods of FMenu

View File

@ -56,10 +56,6 @@ FKeyEvent::FKeyEvent (fc::events ev_type, FKey key_num) // constructor
, k{key_num} , k{key_num}
{ } { }
//----------------------------------------------------------------------
FKeyEvent::~FKeyEvent() // destructor
{ }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FKey FKeyEvent::key() const FKey FKeyEvent::key() const
{ return k; } { return k; }
@ -98,10 +94,6 @@ FMouseEvent::FMouseEvent ( fc::events ev_type // constructor
: FMouseEvent{ev_type, pos, FPoint{}, button} : FMouseEvent{ev_type, pos, FPoint{}, button}
{ } { }
//----------------------------------------------------------------------
FMouseEvent::~FMouseEvent() // destructor
{ }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
const FPoint& FMouseEvent::getPos() const const FPoint& FMouseEvent::getPos() const
{ return p; } { return p; }
@ -152,10 +144,6 @@ FWheelEvent::FWheelEvent ( fc::events ev_type // constructor
: FWheelEvent{ev_type, pos, FPoint{}, wheel} : FWheelEvent{ev_type, pos, FPoint{}, wheel}
{ } { }
//----------------------------------------------------------------------
FWheelEvent::~FWheelEvent() // destructor
{ }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
const FPoint& FWheelEvent::getPos() const const FPoint& FWheelEvent::getPos() const
{ return p; } { return p; }
@ -193,10 +181,6 @@ FFocusEvent::FFocusEvent (fc::events ev_type) // constructor
: FEvent{ev_type} : FEvent{ev_type}
{ } { }
//----------------------------------------------------------------------
FFocusEvent::~FFocusEvent() // destructor
{ }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FFocusEvent::gotFocus() const bool FFocusEvent::gotFocus() const
{ {
@ -239,10 +223,6 @@ FAccelEvent::FAccelEvent (fc::events ev_type, FWidget* focused) // constructor
, focus_widget{focused} , focus_widget{focused}
{ } { }
//----------------------------------------------------------------------
FAccelEvent::~FAccelEvent() // destructor
{ }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FWidget* FAccelEvent::focusedWidget() const FWidget* FAccelEvent::focusedWidget() const
{ return focus_widget; } { return focus_widget; }
@ -268,10 +248,6 @@ FResizeEvent::FResizeEvent (fc::events ev_type) // constructor
: FEvent{ev_type} : FEvent{ev_type}
{ } { }
//----------------------------------------------------------------------
FResizeEvent::~FResizeEvent() // destructor
{ }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FResizeEvent::isAccepted() const bool FResizeEvent::isAccepted() const
{ return accpt; } { return accpt; }
@ -293,10 +269,6 @@ FShowEvent::FShowEvent (fc::events ev_type) // constructor
: FEvent{ev_type} : FEvent{ev_type}
{ } { }
//----------------------------------------------------------------------
FShowEvent::~FShowEvent() // destructor
{ }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// class FHideEvent // class FHideEvent
@ -306,10 +278,6 @@ FHideEvent::FHideEvent (fc::events ev_type) // constructor
: FEvent{ev_type} : FEvent{ev_type}
{ } { }
//----------------------------------------------------------------------
FHideEvent::~FHideEvent() // destructor
{ }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// class FCloseEvent // class FCloseEvent
@ -319,10 +287,6 @@ FCloseEvent::FCloseEvent (fc::events ev_type) // constructor
: FEvent{ev_type} : FEvent{ev_type}
{ } { }
//----------------------------------------------------------------------
FCloseEvent::~FCloseEvent() // destructor
{ }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FCloseEvent::isAccepted() const bool FCloseEvent::isAccepted() const
{ return accpt; } { return accpt; }
@ -345,10 +309,6 @@ FTimerEvent::FTimerEvent (fc::events ev_type, int timer_id) // constructor
, id{timer_id} , id{timer_id}
{ } { }
//----------------------------------------------------------------------
FTimerEvent::~FTimerEvent() // destructor
{ }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
int FTimerEvent::getTimerId() const int FTimerEvent::getTimerId() const
{ return id; } { return id; }
@ -363,10 +323,6 @@ FUserEvent::FUserEvent (fc::events ev_type, int user_event_id) // constructor
, uid{user_event_id} , uid{user_event_id}
{ } { }
//----------------------------------------------------------------------
FUserEvent::~FUserEvent() // destructor
{ }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
int FUserEvent::getUserId() const int FUserEvent::getUserId() const
{ return uid; } { return uid; }

View File

@ -81,9 +81,6 @@ FKeyboard::FKeyboard()
term_detection = FTerm::getFTermDetection(); term_detection = FTerm::getFTermDetection();
} }
//----------------------------------------------------------------------
FKeyboard::~FKeyboard() // destructor
{ }
// public methods of FKeyboard // public methods of FKeyboard
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -39,10 +39,6 @@ namespace finalcut
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// constructor and destructor // constructor and destructor
//----------------------------------------------------------------------
FListBoxItem::FListBoxItem()
{ }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FListBoxItem::FListBoxItem (const FListBoxItem& item) FListBoxItem::FListBoxItem (const FListBoxItem& item)
: text{item.text} : text{item.text}
@ -52,8 +48,8 @@ FListBoxItem::FListBoxItem (const FListBoxItem& item)
{ } { }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FListBoxItem::~FListBoxItem() // destructor FListBoxItem::~FListBoxItem() noexcept = default; // destructor
{ }
// public methods of FListBoxItem // public methods of FListBoxItem
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -477,52 +477,12 @@ void FListViewItem::resetVisibleLineCounter()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// constructor and destructor // constructor and destructor
//----------------------------------------------------------------------
FListViewIterator::FListViewIterator()
{ }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FListViewIterator::FListViewIterator (iterator iter) FListViewIterator::FListViewIterator (iterator iter)
: node{iter} : node{iter}
{ } { }
//----------------------------------------------------------------------
FListViewIterator::~FListViewIterator() // destructor
{ }
//----------------------------------------------------------------------
FListViewIterator::FListViewIterator (const FListViewIterator& i)
: iter_path{i.iter_path} // copy constructor
, node{i.node}
, position{i.position}
{ }
//----------------------------------------------------------------------
FListViewIterator::FListViewIterator (FListViewIterator&& i) noexcept
: iter_path{std::move(i.iter_path)} // move constructor
, node{std::move(i.node)}
, position{std::move(i.position)}
{ }
// FListViewIterator operators // FListViewIterator operators
//----------------------------------------------------------------------
FListViewIterator& FListViewIterator::operator = (const FListViewIterator& i)
{
iter_path = i.iter_path;
node = i.node;
position = i.position;
return *this;
}
//----------------------------------------------------------------------
FListViewIterator& FListViewIterator::operator = (FListViewIterator&& i) noexcept
{
iter_path = std::move(i.iter_path);
node = std::move(i.node);
position = std::move(i.position);
return *this;
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FListViewIterator& FListViewIterator::operator ++ () // prefix FListViewIterator& FListViewIterator::operator ++ () // prefix
{ {
@ -554,25 +514,19 @@ FListViewIterator FListViewIterator::operator -- (int) // postfix
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FListViewIterator& FListViewIterator::operator += (volatile int n) FListViewIterator& FListViewIterator::operator += (int n)
{
while ( n > 0 )
{ {
for (int i = n; i > 0 ; i--)
nextElement(node); nextElement(node);
n--;
}
return *this; return *this;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FListViewIterator& FListViewIterator::operator -= (volatile int n) FListViewIterator& FListViewIterator::operator -= (int n)
{
while ( n > 0 )
{ {
for (int i = n; i > 0 ; i--)
prevElement(node); prevElement(node);
n--;
}
return *this; return *this;
} }

View File

@ -92,10 +92,7 @@ FMessageBox::FMessageBox ( const FString& caption
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FMessageBox::~FMessageBox() // destructor FMessageBox::~FMessageBox() noexcept = default; // destructor
{
deallocation();
}
// public methods of FMessageBox // public methods of FMessageBox
@ -108,10 +105,6 @@ FMessageBox& FMessageBox::operator = (const FMessageBox& mbox)
} }
else else
{ {
for (std::size_t n{0}; n < num_buttons && n < MAX_BUTTONS; n++)
if ( button[n] )
delete button[n];
if ( mbox.getParentWidget() ) if ( mbox.getParentWidget() )
mbox.getParentWidget()->addChild (this); mbox.getParentWidget()->addChild (this);
@ -238,7 +231,7 @@ inline void FMessageBox::allocation()
{ {
try try
{ {
button[0] = new FButton (this); button[0].reset(new FButton (this));
button[0]->setText(button_text[button_digit[0]]); button[0]->setText(button_text[button_digit[0]]);
button[0]->setPos(FPoint{3, int(getHeight()) - 4}, false); button[0]->setPos(FPoint{3, int(getHeight()) - 4}, false);
button[0]->setWidth(1, false); button[0]->setWidth(1, false);
@ -247,7 +240,7 @@ inline void FMessageBox::allocation()
if ( button_digit[1] > FMessageBox::Reject ) if ( button_digit[1] > FMessageBox::Reject )
{ {
button[1] = new FButton(this); button[1].reset(new FButton(this));
button[1]->setText(button_text[button_digit[1]]); button[1]->setText(button_text[button_digit[1]]);
button[1]->setPos(FPoint{17, int(getHeight()) - 4}, false); button[1]->setPos(FPoint{17, int(getHeight()) - 4}, false);
button[1]->setWidth(0, false); button[1]->setWidth(0, false);
@ -256,7 +249,7 @@ inline void FMessageBox::allocation()
if ( button_digit[2] > FMessageBox::Reject ) if ( button_digit[2] > FMessageBox::Reject )
{ {
button[2] = new FButton(this); button[2].reset(new FButton(this));
button[2]->setText(button_text[button_digit[2]]); button[2]->setText(button_text[button_digit[2]]);
button[2]->setPos(FPoint{32, int(getHeight()) - 4}, false); button[2]->setPos(FPoint{32, int(getHeight()) - 4}, false);
button[2]->setWidth(0, false); button[2]->setWidth(0, false);
@ -270,14 +263,6 @@ inline void FMessageBox::allocation()
} }
} }
//----------------------------------------------------------------------
inline void FMessageBox::deallocation()
{
for (std::size_t n{0}; n < num_buttons && n < MAX_BUTTONS; n++)
if ( button[n] )
delete button[n];
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FMessageBox::initCallbacks() inline void FMessageBox::initCallbacks()
{ {
@ -391,7 +376,7 @@ void FMessageBox::draw()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FMessageBox::resizeButtons() const void FMessageBox::resizeButtons() const
{ {
std::array<std::size_t, 3> len{}; std::array<std::size_t, MAX_BUTTONS> len{};
std::size_t max_size{}; std::size_t max_size{};
for (std::size_t n{0}; n < num_buttons && n < MAX_BUTTONS; n++) for (std::size_t n{0}; n < num_buttons && n < MAX_BUTTONS; n++)

View File

@ -313,10 +313,6 @@ FMouseGPM::FMouseGPM()
gpm_ev.x = -1; gpm_ev.x = -1;
} }
//----------------------------------------------------------------------
FMouseGPM::~FMouseGPM() // destructor
{ }
// public methods of FMouseX11 // public methods of FMouseX11
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -1217,27 +1213,25 @@ void FMouseUrxvt::setButtonState (const int btn, const struct timeval* time)
FMouseControl::FMouseControl() FMouseControl::FMouseControl()
{ {
#ifdef F_HAVE_LIBGPM #ifdef F_HAVE_LIBGPM
mouse_protocol[FMouse::gpm] = FMouse::createMouseObject<FMouseGPM>(); if ( FTerm::isLinuxTerm() )
mouse_protocol[FMouse::gpm].reset(FMouse::createMouseObject<FMouseGPM>());
#endif #endif
mouse_protocol[FMouse::x11] = FMouse::createMouseObject<FMouseX11>(); mouse_protocol[FMouse::x11].reset(FMouse::createMouseObject<FMouseX11>());
mouse_protocol[FMouse::sgr] = FMouse::createMouseObject<FMouseSGR>(); mouse_protocol[FMouse::sgr].reset(FMouse::createMouseObject<FMouseSGR>());
mouse_protocol[FMouse::urxvt] = FMouse::createMouseObject<FMouseUrxvt>(); mouse_protocol[FMouse::urxvt].reset(FMouse::createMouseObject<FMouseUrxvt>());
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FMouseControl::~FMouseControl() // destructor FMouseControl::~FMouseControl() = default; // destructor
{
for (auto&& m : mouse_protocol)
delete m.second;
}
// public methods of FMouseControl // public methods of FMouseControl
//---------------------------------------------------------------------- //----------------------------------------------------------------------
const FPoint& FMouseControl::getPos() const FPoint& FMouseControl::getPos()
{ {
const auto& mouse_object = getMouseWithEvent(); auto mtype = getMouseWithEvent();
const auto& mouse_object = mouse_protocol[mtype].get();
if ( mouse_object ) if ( mouse_object )
return mouse_object->getPos(); return mouse_object->getPos();
@ -1248,17 +1242,23 @@ const FPoint& FMouseControl::getPos()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FMouseControl::clearEvent() void FMouseControl::clearEvent()
{ {
FMouse* mouse_object; FMouse::mouse_type mtype;
while ( (mouse_object = getMouseWithEvent()) != nullptr ) do
mouse_object->clearEvent(); {
mtype = getMouseWithEvent();
if ( mouse_protocol[mtype] )
mouse_protocol[mtype]->clearEvent();
}
while ( mtype != FMouse::none );
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
#ifdef F_HAVE_LIBGPM #ifdef F_HAVE_LIBGPM
void FMouseControl::setStdinNo (int file_descriptor) void FMouseControl::setStdinNo (int file_descriptor)
{ {
auto mouse = mouse_protocol[FMouse::gpm]; auto mouse = mouse_protocol[FMouse::gpm].get();
auto gpm_mouse = static_cast<FMouseGPM*>(mouse); auto gpm_mouse = static_cast<FMouseGPM*>(mouse);
if ( gpm_mouse ) if ( gpm_mouse )
@ -1304,7 +1304,8 @@ void FMouseControl::useXtermMouse (bool enable)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FMouseControl::hasData() bool FMouseControl::hasData()
{ {
const auto& mouse_object = getMouseWithData(); auto mtype = getMouseWithData();
const auto& mouse_object = mouse_protocol[mtype].get();
if ( mouse_object ) // with data if ( mouse_object ) // with data
return true; return true;
@ -1315,9 +1316,9 @@ bool FMouseControl::hasData()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FMouseControl::hasEvent() bool FMouseControl::hasEvent()
{ {
const auto& mouse_object = getMouseWithEvent(); auto mtype = getMouseWithEvent();
if ( mouse_object ) // with event if ( mouse_protocol[mtype] ) // with event
return true; return true;
return false; return false;
@ -1326,10 +1327,10 @@ bool FMouseControl::hasEvent()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FMouseControl::isLeftButtonPressed() bool FMouseControl::isLeftButtonPressed()
{ {
const auto& mouse_object = getMouseWithEvent(); auto mtype = getMouseWithEvent();
if ( mouse_object ) if ( mouse_protocol[mtype] )
return mouse_object->isLeftButtonPressed(); return mouse_protocol[mtype]->isLeftButtonPressed();
return false; return false;
} }
@ -1337,10 +1338,10 @@ bool FMouseControl::isLeftButtonPressed()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FMouseControl::isLeftButtonReleased() bool FMouseControl::isLeftButtonReleased()
{ {
const auto& mouse_object = getMouseWithEvent(); auto mtype = getMouseWithEvent();
if ( mouse_object ) if ( mouse_protocol[mtype] )
return mouse_object->isLeftButtonReleased(); return mouse_protocol[mtype]->isLeftButtonReleased();
return false; return false;
} }
@ -1348,10 +1349,10 @@ bool FMouseControl::isLeftButtonReleased()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FMouseControl::isLeftButtonDoubleClick() bool FMouseControl::isLeftButtonDoubleClick()
{ {
const auto& mouse_object = getMouseWithEvent(); auto mtype = getMouseWithEvent();
if ( mouse_object ) if ( mouse_protocol[mtype] )
return mouse_object->isLeftButtonDoubleClick(); return mouse_protocol[mtype]->isLeftButtonDoubleClick();
return false; return false;
} }
@ -1359,10 +1360,10 @@ bool FMouseControl::isLeftButtonDoubleClick()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FMouseControl::isRightButtonPressed() bool FMouseControl::isRightButtonPressed()
{ {
const auto& mouse_object = getMouseWithEvent(); auto mtype = getMouseWithEvent();
if ( mouse_object ) if ( mouse_protocol[mtype] )
return mouse_object->isRightButtonPressed(); return mouse_protocol[mtype]->isRightButtonPressed();
return false; return false;
} }
@ -1370,10 +1371,10 @@ bool FMouseControl::isRightButtonPressed()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FMouseControl::isRightButtonReleased() bool FMouseControl::isRightButtonReleased()
{ {
const auto& mouse_object = getMouseWithEvent(); auto mtype = getMouseWithEvent();
if ( mouse_object ) if ( mouse_protocol[mtype] )
return mouse_object->isRightButtonReleased(); return mouse_protocol[mtype]->isRightButtonReleased();
return false; return false;
} }
@ -1381,10 +1382,10 @@ bool FMouseControl::isRightButtonReleased()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FMouseControl::isMiddleButtonPressed() bool FMouseControl::isMiddleButtonPressed()
{ {
const auto& mouse_object = getMouseWithEvent(); auto mtype = getMouseWithEvent();
if ( mouse_object ) if ( mouse_protocol[mtype] )
return mouse_object->isMiddleButtonPressed(); return mouse_protocol[mtype]->isMiddleButtonPressed();
return false; return false;
} }
@ -1392,10 +1393,10 @@ bool FMouseControl::isMiddleButtonPressed()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FMouseControl::isMiddleButtonReleased() bool FMouseControl::isMiddleButtonReleased()
{ {
const auto& mouse_object = getMouseWithEvent(); auto mtype = getMouseWithEvent();
if ( mouse_object ) if ( mouse_protocol[mtype] )
return mouse_object->isMiddleButtonReleased(); return mouse_protocol[mtype]->isMiddleButtonReleased();
return false; return false;
} }
@ -1403,10 +1404,10 @@ bool FMouseControl::isMiddleButtonReleased()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FMouseControl::isShiftKeyPressed() bool FMouseControl::isShiftKeyPressed()
{ {
const auto& mouse_object = getMouseWithEvent(); auto mtype = getMouseWithEvent();
if ( mouse_object ) if ( mouse_protocol[mtype] )
return mouse_object->isShiftKeyPressed(); return mouse_protocol[mtype]->isShiftKeyPressed();
return false; return false;
} }
@ -1414,10 +1415,10 @@ bool FMouseControl::isShiftKeyPressed()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FMouseControl::isControlKeyPressed() bool FMouseControl::isControlKeyPressed()
{ {
const auto& mouse_object = getMouseWithEvent(); auto mtype = getMouseWithEvent();
if ( mouse_object ) if ( mouse_protocol[mtype] )
return mouse_object->isControlKeyPressed(); return mouse_protocol[mtype]->isControlKeyPressed();
return false; return false;
} }
@ -1425,10 +1426,10 @@ bool FMouseControl::isControlKeyPressed()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FMouseControl::isMetaKeyPressed() bool FMouseControl::isMetaKeyPressed()
{ {
const auto& mouse_object = getMouseWithEvent(); auto mtype = getMouseWithEvent();
if ( mouse_object ) if ( mouse_protocol[mtype] )
return mouse_object->isMetaKeyPressed(); return mouse_protocol[mtype]->isMetaKeyPressed();
return false; return false;
} }
@ -1436,10 +1437,10 @@ bool FMouseControl::isMetaKeyPressed()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FMouseControl::isWheelUp() bool FMouseControl::isWheelUp()
{ {
const auto& mouse_object = getMouseWithEvent(); auto mtype = getMouseWithEvent();
if ( mouse_object ) if ( mouse_protocol[mtype] )
return mouse_object->isWheelUp(); return mouse_protocol[mtype]->isWheelUp();
return false; return false;
} }
@ -1447,10 +1448,10 @@ bool FMouseControl::isWheelUp()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FMouseControl::isWheelDown() bool FMouseControl::isWheelDown()
{ {
const auto& mouse_object = getMouseWithEvent(); auto mtype = getMouseWithEvent();
if ( mouse_object ) if ( mouse_protocol[mtype] )
return mouse_object->isWheelDown(); return mouse_protocol[mtype]->isWheelDown();
return false; return false;
} }
@ -1458,10 +1459,10 @@ bool FMouseControl::isWheelDown()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FMouseControl::isMoved() bool FMouseControl::isMoved()
{ {
const auto& mouse_object = getMouseWithEvent(); auto mtype = getMouseWithEvent();
if ( mouse_object ) if ( mouse_protocol[mtype] )
return mouse_object->isMoved(); return mouse_protocol[mtype]->isMoved();
return false; return false;
} }
@ -1486,7 +1487,7 @@ bool FMouseControl::isGpmMouseEnabled()
if ( mouse_protocol.empty() ) if ( mouse_protocol.empty() )
return false; return false;
const auto& mouse = mouse_protocol[FMouse::gpm]; const auto& mouse = mouse_protocol[FMouse::gpm].get();
const auto& gpm_mouse = static_cast<FMouseGPM*>(mouse); const auto& gpm_mouse = static_cast<FMouseGPM*>(mouse);
if ( gpm_mouse ) if ( gpm_mouse )
@ -1507,7 +1508,7 @@ void FMouseControl::enable()
#ifdef F_HAVE_LIBGPM #ifdef F_HAVE_LIBGPM
if ( use_gpm_mouse ) if ( use_gpm_mouse )
{ {
auto mouse = mouse_protocol[FMouse::gpm]; auto mouse = mouse_protocol[FMouse::gpm].get();
auto gpm_mouse = static_cast<FMouseGPM*>(mouse); auto gpm_mouse = static_cast<FMouseGPM*>(mouse);
if ( gpm_mouse ) if ( gpm_mouse )
@ -1525,7 +1526,7 @@ void FMouseControl::disable()
#ifdef F_HAVE_LIBGPM #ifdef F_HAVE_LIBGPM
if ( use_gpm_mouse ) if ( use_gpm_mouse )
{ {
auto mouse = mouse_protocol[FMouse::gpm]; auto mouse = mouse_protocol[FMouse::gpm].get();
auto gpm_mouse = static_cast<FMouseGPM*>(mouse); auto gpm_mouse = static_cast<FMouseGPM*>(mouse);
if ( gpm_mouse ) if ( gpm_mouse )
@ -1541,7 +1542,7 @@ void FMouseControl::disable()
void FMouseControl::setRawData ( FMouse::mouse_type mt void FMouseControl::setRawData ( FMouse::mouse_type mt
, FKeyboard::keybuffer& fifo_buf) , FKeyboard::keybuffer& fifo_buf)
{ {
auto mouse = mouse_protocol[mt]; auto mouse = mouse_protocol[mt].get();
if ( mouse ) if ( mouse )
mouse->setRawData (fifo_buf); mouse->setRawData (fifo_buf);
@ -1569,7 +1570,9 @@ void FMouseControl::processQueuedInput()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FMouseControl::processEvent (struct timeval* time) void FMouseControl::processEvent (struct timeval* time)
{ {
auto mouse_object = getMouseWithData(); auto mtype = getMouseWithData();
auto mouse_object = mouse_protocol[mtype].get();
// Clear all old mouse events // Clear all old mouse events
clearEvent(); clearEvent();
@ -1588,7 +1591,7 @@ bool FMouseControl::getGpmKeyPressed (bool pending)
if ( mouse_protocol.empty() ) if ( mouse_protocol.empty() )
return false; return false;
auto mouse = mouse_protocol[FMouse::gpm]; auto mouse = mouse_protocol[FMouse::gpm].get();
auto gpm_mouse = static_cast<FMouseGPM*>(mouse); auto gpm_mouse = static_cast<FMouseGPM*>(mouse);
if ( gpm_mouse ) if ( gpm_mouse )
@ -1610,7 +1613,7 @@ void FMouseControl::drawPointer()
if ( mouse_protocol.empty() ) if ( mouse_protocol.empty() )
return; return;
auto mouse = mouse_protocol[FMouse::gpm]; auto mouse = mouse_protocol[FMouse::gpm].get();
auto gpm_mouse = static_cast<FMouseGPM*>(mouse); auto gpm_mouse = static_cast<FMouseGPM*>(mouse);
if ( gpm_mouse ) if ( gpm_mouse )
@ -1624,7 +1627,7 @@ void FMouseControl::drawPointer()
// private methods of FMouseControl // private methods of FMouseControl
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FMouse* FMouseControl::getMouseWithData() FMouse::mouse_type FMouseControl::getMouseWithData()
{ {
const auto& iter = \ const auto& iter = \
std::find_if ( std::begin(mouse_protocol) std::find_if ( std::begin(mouse_protocol)
@ -1636,11 +1639,11 @@ FMouse* FMouseControl::getMouseWithData()
} }
); );
return ( iter != mouse_protocol.end() ) ? iter->second : nullptr; return ( iter != mouse_protocol.end() ) ? iter->first : FMouse::none;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FMouse* FMouseControl::getMouseWithEvent() FMouse::mouse_type FMouseControl::getMouseWithEvent()
{ {
const auto& iter = \ const auto& iter = \
std::find_if ( std::begin(mouse_protocol) std::find_if ( std::begin(mouse_protocol)
@ -1652,7 +1655,7 @@ FMouse* FMouseControl::getMouseWithEvent()
} }
); );
return ( iter != mouse_protocol.end() ) ? iter->second : nullptr; return ( iter != mouse_protocol.end() ) ? iter->first : FMouse::none;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -32,7 +32,6 @@ namespace finalcut
// static class attributes // static class attributes
bool FObject::timer_modify_lock; bool FObject::timer_modify_lock;
FObject::FTimerList* FObject::timer_list{nullptr};
const FString* fc::emptyFString::empty_string{nullptr}; const FString* fc::emptyFString::empty_string{nullptr};
@ -46,26 +45,9 @@ FObject::FObject (FObject* parent)
: parent_obj{parent} : parent_obj{parent}
{ {
if ( parent ) // add object to parent if ( parent ) // add object to parent
{
parent->addChild(this); parent->addChild(this);
}
else else
{
timer_modify_lock = false; timer_modify_lock = false;
if ( ! timer_list )
{
try
{
timer_list = new FTimerList;
}
catch (const std::bad_alloc&)
{
badAllocOutput ("FTimerList");
return;
}
}
}
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -73,12 +55,6 @@ FObject::~FObject() // destructor
{ {
delOwnTimers(); // Delete all timers of this object delOwnTimers(); // Delete all timers of this object
if ( ! has_parent && timer_list )
{
delete timer_list;
timer_list = nullptr;
}
if ( ! has_parent && ! fc::emptyFString::isNull() ) if ( ! has_parent && ! fc::emptyFString::isNull() )
fc::emptyFString::clear(); fc::emptyFString::clear();
@ -268,6 +244,7 @@ int FObject::addTimer (int interval)
timeval currentTime{}; timeval currentTime{};
int id{1}; int id{1};
timer_modify_lock = true; timer_modify_lock = true;
auto& timer_list = globalTimerList();
// find an unused timer id // find an unused timer id
if ( ! timer_list->empty() ) if ( ! timer_list->empty() )
@ -317,6 +294,7 @@ bool FObject::delTimer (int id) const
return false; return false;
timer_modify_lock = true; timer_modify_lock = true;
auto& timer_list = globalTimerList();
auto iter = timer_list->begin(); auto iter = timer_list->begin();
const auto& last = timer_list->end(); const auto& last = timer_list->end();
@ -339,6 +317,8 @@ bool FObject::delOwnTimers() const
{ {
// Deletes all timers of this object // Deletes all timers of this object
auto& timer_list = globalTimerList();
if ( ! timer_list ) if ( ! timer_list )
return false; return false;
@ -365,6 +345,8 @@ bool FObject::delAllTimers() const
{ {
// Deletes all timers of all objects // Deletes all timers of all objects
auto& timer_list = globalTimerList();
if ( ! timer_list ) if ( ! timer_list )
return false; return false;
@ -405,6 +387,8 @@ uInt FObject::processTimerEvent()
if ( isTimerInUpdating() ) if ( isTimerInUpdating() )
return 0; return 0;
auto& timer_list = globalTimerList();
if ( ! timer_list ) if ( ! timer_list )
return 0; return 0;
@ -440,4 +424,11 @@ void FObject::performTimerAction (FObject*, FEvent*)
// to process the passed object and timer event // to process the passed object and timer event
} }
//----------------------------------------------------------------------
FObject::FTimerListPtr& FObject::globalTimerList()
{
static const auto& timer_list = make_unique<FTimerList>();
return timer_list;
}
} // namespace finalcut } // namespace finalcut

View File

@ -47,10 +47,6 @@ FOptiAttr::FOptiAttr()
reset_byte_mask.attr.bit.printed = true; reset_byte_mask.attr.bit.printed = true;
} }
//----------------------------------------------------------------------
FOptiAttr::~FOptiAttr() // destructor
{ }
// public methods of FOptiAttr // public methods of FOptiAttr
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -52,10 +52,6 @@ FOptiMove::FOptiMove (int baud)
set_cursor_down ("\n"); set_cursor_down ("\n");
} }
//----------------------------------------------------------------------
FOptiMove::~FOptiMove() // destructor
{ }
// public methods of FOptiMove // public methods of FOptiMove
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -608,7 +604,7 @@ int FOptiMove::capDurationToLength (int duration) const
//---------------------------------------------------------------------- //----------------------------------------------------------------------
int FOptiMove::repeatedAppend ( const Capability& o int FOptiMove::repeatedAppend ( const Capability& o
, volatile int count , int count
, char* dst ) const , char* dst ) const
{ {
const std::size_t src_len = std::strlen(o.cap); const std::size_t src_len = std::strlen(o.cap);
@ -623,8 +619,9 @@ int FOptiMove::repeatedAppend ( const Capability& o
{ {
dst += dst_len; dst += dst_len;
std::size_t free = BUF_SIZE - dst_len - 2; std::size_t free = BUF_SIZE - dst_len - 2;
int cnt = count;
while ( count-- > 0 ) while ( cnt-- > 0 )
{ {
std::strncpy (dst, o.cap, free); std::strncpy (dst, o.cap, free);
dst += src_len; dst += src_len;

View File

@ -31,26 +31,7 @@ namespace finalcut
// class FPoint // class FPoint
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FPoint::~FPoint() // destructor
{ }
// public methods of FPoint // public methods of FPoint
//----------------------------------------------------------------------
FPoint& FPoint::operator = (const FPoint& p)
{
xpos = p.xpos;
ypos = p.ypos;
return *this;
}
//----------------------------------------------------------------------
FPoint& FPoint::operator = (FPoint&& p) noexcept
{
xpos = std::move(p.xpos);
ypos = std::move(p.ypos);
return *this;
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FPoint& FPoint::operator += (const FPoint& p) FPoint& FPoint::operator += (const FPoint& p)
{ {

View File

@ -42,8 +42,7 @@ FProgressbar::FProgressbar(FWidget* parent)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FProgressbar::~FProgressbar() // destructor FProgressbar::~FProgressbar() noexcept = default; // destructor
{ }
// public methods of FProgressbar // public methods of FProgressbar

View File

@ -46,8 +46,7 @@ FRadioButton::FRadioButton (const FString& txt, FWidget* parent)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FRadioButton::~FRadioButton() // destructor FRadioButton::~FRadioButton() noexcept = default; // destructor
{ }
// private methods of FRadioButton // private methods of FRadioButton

View File

@ -49,8 +49,7 @@ FRadioMenuItem::FRadioMenuItem (const FString& txt, FWidget* parent)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FRadioMenuItem::~FRadioMenuItem() // destructor FRadioMenuItem::~FRadioMenuItem() noexcept = default; // destructor
{ }
// private methods of FRadioMenuItem // private methods of FRadioMenuItem

View File

@ -51,32 +51,8 @@ FRect::FRect (const FPoint& p1, const FPoint& p2)
, Y2{p2.getY()} , Y2{p2.getY()}
{ } { }
//----------------------------------------------------------------------
FRect::~FRect() // destructor
{ }
// public methods of FRect // public methods of FRect
//----------------------------------------------------------------------
FRect& FRect::operator = (const FRect& r)
{
X1 = r.X1;
Y1 = r.Y1;
X2 = r.X2;
Y2 = r.Y2;
return *this;
}
//----------------------------------------------------------------------
FRect& FRect::operator = (FRect&& r) noexcept
{
X1 = std::move(r.X1);
Y1 = std::move(r.Y1);
X2 = std::move(r.X2);
Y2 = std::move(r.Y2);
return *this;
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FRect::isEmpty() const bool FRect::isEmpty() const
{ {

View File

@ -33,26 +33,7 @@ namespace finalcut
// class FSize // class FSize
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FSize::~FSize() // destructor
{ }
// public methods of FSize // public methods of FSize
//----------------------------------------------------------------------
FSize& FSize::operator = (const FSize& s)
{
width = s.width;
height = s.height;
return *this;
}
//----------------------------------------------------------------------
FSize& FSize::operator = (FSize&& s) noexcept
{
width = std::move(s.width);
height = std::move(s.height);
return *this;
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FSize& FSize::operator += (const FSize& s) FSize& FSize::operator += (const FSize& s)
{ {

View File

@ -48,8 +48,7 @@ FSpinBox::FSpinBox (FWidget* parent)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FSpinBox::~FSpinBox() // destructor FSpinBox::~FSpinBox() noexcept = default; // destructor
{ }
// public methods of FSpinBox // public methods of FSpinBox

View File

@ -54,35 +54,13 @@ FStartOptions::FStartOptions()
, dark_theme{false} , dark_theme{false}
{ } { }
//----------------------------------------------------------------------
FStartOptions::~FStartOptions() // destructor
{ }
// public methods of FStartOptions // public methods of FStartOptions
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FStartOptions& FStartOptions::getFStartOptions() FStartOptions& FStartOptions::getFStartOptions()
{ {
if ( start_options == nullptr ) static const auto& start_options = make_unique<FStartOptions>();
{ return *start_options.get();
try
{
start_options = new FStartOptions;
}
catch (const std::bad_alloc&)
{
badAllocOutput ("FStartOptions");
std::abort();
}
}
return *start_options;
}
//----------------------------------------------------------------------
void FStartOptions::destroyObject()
{
if ( start_options )
delete start_options;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -143,12 +143,12 @@ FStatusBar::~FStatusBar() // destructor
while ( iter != key_list.end() ) while ( iter != key_list.end() )
{ {
(*iter)->setConnectedStatusbar(nullptr); (*iter)->setConnectedStatusbar(nullptr);
delAccelerator (*iter); FWidget::delAccelerator (*iter);
iter = key_list.erase(iter); iter = key_list.erase(iter);
} }
} }
setStatusBar(nullptr); FWidget::setStatusBar(nullptr);
} }

View File

@ -49,8 +49,7 @@ FSwitch::FSwitch (const FString& txt, FWidget* parent)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FSwitch::~FSwitch() // destructor FSwitch::~FSwitch() noexcept = default; // destructor
{ }
// public methods of FSwitch // public methods of FSwitch

View File

@ -3,7 +3,7 @@
* * * *
* This file is part of the FINAL CUT widget toolkit * * This file is part of the FINAL CUT widget toolkit *
* * * *
* Copyright 2019 Markus Gans * * Copyright 2019-2020 Markus Gans *
* * * *
* FINAL CUT is free software; you can redistribute it and/or modify * * FINAL CUT is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as * * it under the terms of the GNU Lesser General Public License as *
@ -31,12 +31,7 @@ namespace finalcut
// constructors and destructor // constructors and destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FSystem::FSystem() FSystem::~FSystem() noexcept = default; // destructor
{ }
//----------------------------------------------------------------------
FSystem::~FSystem() // destructor
{ }
} // namespace finalcut } // namespace finalcut

View File

@ -35,12 +35,8 @@ namespace finalcut
// constructors and destructor // constructors and destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FSystemImpl::FSystemImpl() FSystemImpl::~FSystemImpl() noexcept = default; // destructor
{ }
//----------------------------------------------------------------------
FSystemImpl::~FSystemImpl() // destructor
{ }
// public methods of FSystemImpl // public methods of FSystemImpl
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -1419,7 +1419,7 @@ void FTerm::init_alt_charset()
} }
} }
enum column enum Column : int
{ {
vt100_key = 0, vt100_key = 0,
utf8_char = 1 utf8_char = 1
@ -2272,7 +2272,6 @@ inline void FTerm::deallocationValues()
const defaultPutChar* putchar_ptr = &(putchar()); const defaultPutChar* putchar_ptr = &(putchar());
delete putchar_ptr; delete putchar_ptr;
destroyColorPaletteTheme(); destroyColorPaletteTheme();
FStartOptions::destroyObject();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -43,15 +43,15 @@ namespace finalcut
{ {
// Enumeration // Enumeration
enum fullWidthSupport enum class FullWidthSupport
{ {
unknown_fullwidth_support = -1, unknown = -1,
supports_fullwidth = 0, no = 0,
no_fullwidth_support = 1 yes = 1
}; };
// global state // global state
static fullWidthSupport has_fullwidth_support = unknown_fullwidth_support; static FullWidthSupport has_fullwidth_support = FullWidthSupport::unknown;
// Function prototypes // Function prototypes
bool hasAmbiguousWidth (wchar_t); bool hasAmbiguousWidth (wchar_t);
@ -250,7 +250,7 @@ bool hasFullWidthSupports()
{ {
// Checks if the terminal has full-width character support // Checks if the terminal has full-width character support
if ( has_fullwidth_support == unknown_fullwidth_support ) if ( has_fullwidth_support == FullWidthSupport::unknown )
{ {
if ( ! FTerm::isInitialized() ) if ( ! FTerm::isInitialized() )
return true; // Assume that it is a modern terminal with full-width support return true; // Assume that it is a modern terminal with full-width support
@ -262,12 +262,12 @@ bool hasFullWidthSupports()
|| FTerm::isOpenBSDTerm() || FTerm::isOpenBSDTerm()
|| FTerm::isSunTerminal() || FTerm::isSunTerminal()
|| FTerm::isAnsiTerminal() ) || FTerm::isAnsiTerminal() )
has_fullwidth_support = no_fullwidth_support; has_fullwidth_support = FullWidthSupport::no;
else else
has_fullwidth_support = supports_fullwidth; has_fullwidth_support = FullWidthSupport::yes;
} }
return ( has_fullwidth_support == supports_fullwidth) ? true : false; return ( has_fullwidth_support == FullWidthSupport::yes) ? true : false;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -528,7 +528,7 @@ std::size_t getColumnWidth (const FTermBuffer& tb)
, tb.front().attr.bit.char_width , tb.front().attr.bit.char_width
, [] (std::size_t s, const FChar& c) , [] (std::size_t s, const FChar& c)
{ {
return std::move(s) + c.attr.bit.char_width; return s + c.attr.bit.char_width;
} }
); );
} }

View File

@ -38,8 +38,8 @@ namespace finalcut
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// class FTermBuffer // class FTermBuffer
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FTermBuffer::~FTermBuffer() // destructor FTermBuffer::~FTermBuffer() noexcept = default; // destructor
{ }
// public methods of FTermBuffer // public methods of FTermBuffer
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -72,7 +72,7 @@ int FTermBuffer::write (const FString& string)
nc.attr.byte[2] = 0; nc.attr.byte[2] = 0;
nc.attr.byte[3] = 0; nc.attr.byte[3] = 0;
getColumnWidth(nc); // add column width getColumnWidth(nc); // add column width
data.push_back(std::move(nc)); data.emplace_back(std::move(nc));
} }
return len; return len;
@ -86,8 +86,7 @@ int FTermBuffer::write (wchar_t ch)
getColumnWidth(nc); // add column width getColumnWidth(nc); // add column width
nc.attr.bit.no_changes = false; nc.attr.bit.no_changes = false;
nc.attr.bit.printed = false; nc.attr.bit.printed = false;
data.emplace_back(std::move(nc));
data.push_back(nc);
return 1; return 1;
} }

View File

@ -43,16 +43,6 @@ FTermDetection* FTermcapQuirks::term_detection {nullptr};
// class FTermcapQuirks // class FTermcapQuirks
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// constructors and destructor
//----------------------------------------------------------------------
FTermcapQuirks::FTermcapQuirks()
{ }
//----------------------------------------------------------------------
FTermcapQuirks::~FTermcapQuirks() // destructor
{ }
// public methods of FTermcapQuirks // public methods of FTermcapQuirks
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermcapQuirks::terminalFixup() void FTermcapQuirks::terminalFixup()

View File

@ -52,10 +52,6 @@ FTermios::FTermios()
init(); init();
} }
//----------------------------------------------------------------------
FTermios::~FTermios() // destructor
{ }
// public methods of FTermios // public methods of FTermios
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermios::init() void FTermios::init()

View File

@ -52,11 +52,6 @@ namespace finalcut
// class FTermOpenBSD // class FTermOpenBSD
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// constructors and destructor
//----------------------------------------------------------------------
FTermOpenBSD::~FTermOpenBSD() // destructor
{ }
// public methods of FTermOpenBSD // public methods of FTermOpenBSD
//---------------------------------------------------------------------- //----------------------------------------------------------------------
#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(UNIT_TEST) #if defined(__NetBSD__) || defined(__OpenBSD__) || defined(UNIT_TEST)

View File

@ -70,10 +70,6 @@ FTermXTerminal::FTermXTerminal()
keyboard = FTerm::getFKeyboard(); keyboard = FTerm::getFKeyboard();
} }
//----------------------------------------------------------------------
FTermXTerminal::~FTermXTerminal() // destructor
{ }
// public methods of FTermXTerminal // public methods of FTermXTerminal
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -48,8 +48,7 @@ FTextView::FTextView(FWidget* parent)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FTextView::~FTextView() // destructor FTextView::~FTextView() noexcept = default; // destructor
{ }
// public methods of FTextView // public methods of FTextView

View File

@ -485,7 +485,7 @@ void FToggleButton::init()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FToggleButton::drawText (const FString& label_text, std::size_t hotkeypos) void FToggleButton::drawText (FString&& label_text, std::size_t hotkeypos)
{ {
if ( FTerm::isMonochron() ) if ( FTerm::isMonochron() )
setReverse(true); setReverse(true);

View File

@ -443,8 +443,7 @@ int FVTerm::print (FTermArea* area, const FTermBuffer& term_buffer)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
int FVTerm::print (wchar_t c) int FVTerm::print (wchar_t c)
{ {
FChar nc{}; // next character FChar nc{FVTerm::getAttribute()}; // next character
nc = FVTerm::getAttribute();
nc.ch[0] = c; nc.ch[0] = c;
nc.attr.byte[2] = 0; nc.attr.byte[2] = 0;
nc.attr.byte[3] = 0; nc.attr.byte[3] = 0;

View File

@ -126,7 +126,7 @@ class FButtonGroup : public FScrollView
// Methods // Methods
void init(); void init();
void drawText (const FString&, std::size_t); void drawText (FString&&, std::size_t);
bool directFocusCheckedRadioButton (FToggleButton*) const; bool directFocusCheckedRadioButton (FToggleButton*) const;
bool directFocusRadioButton() const; bool directFocusRadioButton() const;
void directFocus(); void directFocus();

View File

@ -72,7 +72,7 @@ class FCheckBox : public FToggleButton
FCheckBox (const FCheckBox&) = delete; FCheckBox (const FCheckBox&) = delete;
// Destructor // Destructor
~FCheckBox() override; ~FCheckBox() noexcept override;
// Disable copy assignment operator (=) // Disable copy assignment operator (=)
FCheckBox& operator = (const FCheckBox&) = delete; FCheckBox& operator = (const FCheckBox&) = delete;

View File

@ -72,7 +72,7 @@ class FCheckMenuItem : public FMenuItem
FCheckMenuItem (const FCheckMenuItem&) = delete; FCheckMenuItem (const FCheckMenuItem&) = delete;
// Destructor // Destructor
~FCheckMenuItem() override; ~FCheckMenuItem() noexcept override;
// Disable copy assignment operator (=) // Disable copy assignment operator (=)
FCheckMenuItem& operator = (const FCheckMenuItem&) = delete; FCheckMenuItem& operator = (const FCheckMenuItem&) = delete;

View File

@ -142,7 +142,7 @@ class FComboBox : public FWidget
FComboBox (const FComboBox&) = delete; FComboBox (const FComboBox&) = delete;
// Destructor // Destructor
~FComboBox() override; ~FComboBox() noexcept override;
// Disable copy assignment operator (=) // Disable copy assignment operator (=)
FComboBox& operator = (const FComboBox&) = delete; FComboBox& operator = (const FComboBox&) = delete;

View File

@ -78,7 +78,7 @@ class FDialogListMenu : public FMenu
FDialogListMenu (const FDialogListMenu&) = delete; FDialogListMenu (const FDialogListMenu&) = delete;
// Destructor // Destructor
~FDialogListMenu() override; ~FDialogListMenu() noexcept override;
// Disable copy assignment operator (=) // Disable copy assignment operator (=)
FDialogListMenu& operator = (const FDialogListMenu&) = delete; FDialogListMenu& operator = (const FDialogListMenu&) = delete;

View File

@ -127,7 +127,7 @@ class FKeyEvent : public FEvent // keyboard event
public: public:
FKeyEvent() = default; FKeyEvent() = default;
FKeyEvent (fc::events, FKey); FKeyEvent (fc::events, FKey);
~FKeyEvent(); ~FKeyEvent() = default;
FKey key() const; FKey key() const;
bool isAccepted() const; bool isAccepted() const;
@ -150,7 +150,7 @@ class FMouseEvent : public FEvent // mouse event
FMouseEvent() = default; FMouseEvent() = default;
FMouseEvent (fc::events, const FPoint&, const FPoint&, int); FMouseEvent (fc::events, const FPoint&, const FPoint&, int);
FMouseEvent (fc::events, const FPoint&, int); FMouseEvent (fc::events, const FPoint&, int);
~FMouseEvent(); ~FMouseEvent() = default;
const FPoint& getPos() const; const FPoint& getPos() const;
const FPoint& getTermPos() const; const FPoint& getTermPos() const;
@ -177,7 +177,7 @@ class FWheelEvent : public FEvent // wheel event
FWheelEvent() = default; FWheelEvent() = default;
FWheelEvent (fc::events, const FPoint&, int); FWheelEvent (fc::events, const FPoint&, int);
FWheelEvent (fc::events, const FPoint&, const FPoint&, int); FWheelEvent (fc::events, const FPoint&, const FPoint&, int);
~FWheelEvent(); ~FWheelEvent() = default;
const FPoint& getPos() const; const FPoint& getPos() const;
const FPoint& getTermPos() const; const FPoint& getTermPos() const;
@ -203,7 +203,7 @@ class FFocusEvent : public FEvent // focus event
public: public:
FFocusEvent() = default; FFocusEvent() = default;
explicit FFocusEvent (fc::events); explicit FFocusEvent (fc::events);
~FFocusEvent(); ~FFocusEvent() = default;
bool gotFocus() const; bool gotFocus() const;
bool lostFocus() const; bool lostFocus() const;
@ -230,7 +230,7 @@ class FAccelEvent : public FEvent // focus event
FAccelEvent() = default; FAccelEvent() = default;
FAccelEvent (fc::events, FWidget*); FAccelEvent (fc::events, FWidget*);
FAccelEvent (const FAccelEvent&) = delete; FAccelEvent (const FAccelEvent&) = delete;
~FAccelEvent(); ~FAccelEvent() = default;
FAccelEvent& operator = (const FAccelEvent&) = delete; FAccelEvent& operator = (const FAccelEvent&) = delete;
FWidget* focusedWidget() const; FWidget* focusedWidget() const;
@ -253,7 +253,7 @@ class FResizeEvent : public FEvent // resize event
public: public:
FResizeEvent() = default; FResizeEvent() = default;
explicit FResizeEvent (fc::events); explicit FResizeEvent (fc::events);
~FResizeEvent(); ~FResizeEvent() = default;
bool isAccepted() const; bool isAccepted() const;
void accept(); void accept();
@ -273,7 +273,7 @@ class FShowEvent : public FEvent // show event
public: public:
FShowEvent() = default; FShowEvent() = default;
explicit FShowEvent (fc::events); explicit FShowEvent (fc::events);
~FShowEvent(); ~FShowEvent() = default;
}; };
@ -286,7 +286,7 @@ class FHideEvent : public FEvent // hide event
public: public:
FHideEvent() = default; FHideEvent() = default;
explicit FHideEvent (fc::events); explicit FHideEvent (fc::events);
~FHideEvent(); ~FHideEvent() = default;
}; };
@ -299,7 +299,7 @@ class FCloseEvent : public FEvent // close event
public: public:
FCloseEvent() = default; FCloseEvent() = default;
explicit FCloseEvent(fc::events); explicit FCloseEvent(fc::events);
~FCloseEvent(); ~FCloseEvent() = default;
bool isAccepted() const; bool isAccepted() const;
void accept(); void accept();
@ -319,7 +319,7 @@ class FTimerEvent : public FEvent // timer event
public: public:
FTimerEvent() = default; FTimerEvent() = default;
FTimerEvent (fc::events, int); FTimerEvent (fc::events, int);
~FTimerEvent(); ~FTimerEvent() = default;
int getTimerId() const; int getTimerId() const;
@ -341,7 +341,7 @@ class FUserEvent : public FEvent // user event
FUserEvent (const FUserEvent&) = delete; FUserEvent (const FUserEvent&) = delete;
FUserEvent (fc::events, int); FUserEvent (fc::events, int);
~FUserEvent(); ~FUserEvent() = default;
// Disable copy assignment operator (=) // Disable copy assignment operator (=)
FUserEvent& operator = (const FUserEvent&) = delete; FUserEvent& operator = (const FUserEvent&) = delete;

View File

@ -100,7 +100,7 @@ class FKeyboard final
FKeyboard (const FKeyboard&) = delete; FKeyboard (const FKeyboard&) = delete;
// Destructor // Destructor
~FKeyboard(); ~FKeyboard() = default;
// Disable copy assignment operator (=) // Disable copy assignment operator (=)
FKeyboard& operator = (const FKeyboard&) = delete; FKeyboard& operator = (const FKeyboard&) = delete;

View File

@ -163,8 +163,8 @@ class FLineEdit : public FWidget
void adjustSize() override; void adjustSize() override;
private: private:
// Typedef // Using-declaration
typedef std::pair<std::size_t, std::size_t> offsetPair; using offsetPair = std::pair<std::size_t, std::size_t>;
// Enumeration // Enumeration
enum dragScroll enum dragScroll

View File

@ -73,13 +73,13 @@ class FListBoxItem
{ {
public: public:
// Constructors // Constructors
FListBoxItem (); FListBoxItem() = default;
FListBoxItem (const FListBoxItem&); // copy constructor FListBoxItem (const FListBoxItem&); // copy constructor
template <typename DT = std::nullptr_t> template <typename DT = std::nullptr_t>
explicit FListBoxItem (const FString&, DT&& = DT() ); explicit FListBoxItem (const FString&, DT&& = DT() );
// Destructor // Destructor
virtual ~FListBoxItem(); virtual ~FListBoxItem() noexcept;
// copy copy assignment operator (=) // copy copy assignment operator (=)
FListBoxItem& operator = (const FListBoxItem&); FListBoxItem& operator = (const FListBoxItem&);

View File

@ -219,23 +219,16 @@ class FListViewIterator
using iterator_stack = std::stack<iterator>; using iterator_stack = std::stack<iterator>;
// Constructor // Constructor
FListViewIterator (); FListViewIterator () = default;
FListViewIterator (iterator); FListViewIterator (iterator);
FListViewIterator (const FListViewIterator&); // copy constructor
FListViewIterator (FListViewIterator&&) noexcept; // move constructor
// Destructor
~FListViewIterator();
// Overloaded operators // Overloaded operators
FListViewIterator& operator = (const FListViewIterator&);
FListViewIterator& operator = (FListViewIterator&&) noexcept;
FListViewIterator& operator ++ (); // prefix FListViewIterator& operator ++ (); // prefix
FListViewIterator operator ++ (int); // postfix FListViewIterator operator ++ (int); // postfix
FListViewIterator& operator -- (); // prefix FListViewIterator& operator -- (); // prefix
FListViewIterator operator -- (int); // postfix FListViewIterator operator -- (int); // postfix
FListViewIterator& operator += (volatile int); FListViewIterator& operator += (int);
FListViewIterator& operator -= (volatile int); FListViewIterator& operator -= (int);
FObject*& operator * () const; FObject*& operator * () const;
FObject* operator -> () const; FObject* operator -> () const;
bool operator == (const FListViewIterator&) const; bool operator == (const FListViewIterator&) const;
@ -542,8 +535,7 @@ class FListView : public FWidget
struct FListView::Header struct FListView::Header
{ {
public: public:
Header() Header () = default;
{ }
FString name{}; FString name{};
fc::text_alignment alignment{fc::alignLeft}; fc::text_alignment alignment{fc::alignLeft};

View File

@ -102,17 +102,16 @@ class FMenuBar : public FWindow, public FMenuList
void cb_itemDeactivated (const FMenuItem*) const; void cb_itemDeactivated (const FMenuItem*) const;
private: private:
// Constants struct menuText
static constexpr auto NOT_SET = static_cast<std::size_t>(-1);
// Typedef
typedef struct
{ {
FString text; FString text;
std::size_t startpos; std::size_t startpos;
std::size_t hotkeypos; std::size_t hotkeypos;
bool no_underline; bool no_underline;
} menuText; };
// Constants
static constexpr auto NOT_SET = static_cast<std::size_t>(-1);
// Inquiry // Inquiry
bool isMenu (const FMenuItem*) const; bool isMenu (const FMenuItem*) const;

View File

@ -59,6 +59,10 @@
#include <cstring> #include <cstring>
#include <array>
#include <memory>
#include "final/fbutton.h"
#include "final/fdialog.h" #include "final/fdialog.h"
#include "final/fwidgetcolors.h" #include "final/fwidgetcolors.h"
@ -95,7 +99,7 @@ class FMessageBox : public FDialog
, ButtonType, ButtonType, ButtonType , ButtonType, ButtonType, ButtonType
, FWidget* = nullptr ); , FWidget* = nullptr );
// Destructor // Destructor
~FMessageBox() override; virtual ~FMessageBox() noexcept override;
// copy assignment operator (=) // copy assignment operator (=)
FMessageBox& operator = (const FMessageBox&); FMessageBox& operator = (const FMessageBox&);
@ -140,10 +144,12 @@ class FMessageBox : public FDialog
// Constants // Constants
static constexpr std::size_t MAX_BUTTONS = 3; static constexpr std::size_t MAX_BUTTONS = 3;
// Using-declaration
using FButtons = std::array<std::unique_ptr<FButton>, MAX_BUTTONS>;
// Methods // Methods
void init(); void init();
void allocation(); void allocation();
void deallocation();
void initCallbacks(); void initCallbacks();
void calculateDimensions(); void calculateDimensions();
void draw() override; void draw() override;
@ -154,7 +160,8 @@ class FMessageBox : public FDialog
FString headline_text{}; FString headline_text{};
FString text{}; FString text{};
FStringList text_components{}; FStringList text_components{};
FButton* button[MAX_BUTTONS]{nullptr};
FButtons button;
std::size_t max_line_width{0}; std::size_t max_line_width{0};
FColor emphasis_color{getColorTheme()->dialog_emphasis_fg}; FColor emphasis_color{getColorTheme()->dialog_emphasis_fg};
ButtonType button_digit[MAX_BUTTONS]{FMessageBox::Reject}; ButtonType button_digit[MAX_BUTTONS]{FMessageBox::Reject};

View File

@ -257,7 +257,7 @@ class FMouseGPM final : public FMouse
FMouseGPM(); FMouseGPM();
// Destructor // Destructor
~FMouseGPM() override; ~FMouseGPM() override = default;
// Accessors // Accessors
FString getClassName() const override; FString getClassName() const override;
@ -581,13 +581,14 @@ class FMouseControl
void drawPointer(); void drawPointer();
private: private:
// Typedef // Using-declaration
typedef std::map<FMouse::mouse_type, FMouse*> FMouseProtocol; using FMousePtr = std::unique_ptr<FMouse>;
typedef std::unique_ptr<FMouseData> FMouseDataPtr; using FMouseDataPtr = std::unique_ptr<FMouseData>;
using FMouseProtocol = std::map<FMouse::mouse_type, FMousePtr>;
// Accessor // Accessor
FMouse* getMouseWithData(); FMouse::mouse_type getMouseWithData();
FMouse* getMouseWithEvent(); FMouse::mouse_type getMouseWithEvent();
void xtermMouse (bool) const; void xtermMouse (bool) const;
void enableXTermMouse() const; void enableXTermMouse() const;
void disableXTermMouse() const; void disableXTermMouse() const;

View File

@ -150,8 +150,9 @@ class FObject
FObject* object; FObject* object;
}; };
// Typedefs // Using-declaration
typedef std::vector<FTimerData> FTimerList; using FTimerList = std::vector<FTimerData>;
using FTimerListPtr = const std::unique_ptr<FTimerList>;
// Accessor // Accessor
FTimerList* getTimerList() const; FTimerList* getTimerList() const;
@ -169,6 +170,7 @@ class FObject
private: private:
// Method // Method
virtual void performTimerAction (FObject*, FEvent*); virtual void performTimerAction (FObject*, FEvent*);
static FTimerListPtr& globalTimerList();
// Data members // Data members
FObject* parent_obj{nullptr}; FObject* parent_obj{nullptr};
@ -177,7 +179,6 @@ class FObject
bool has_parent{false}; bool has_parent{false};
bool widget_object{false}; bool widget_object{false};
static bool timer_modify_lock; static bool timer_modify_lock;
static FTimerList* timer_list;
}; };
@ -267,7 +268,7 @@ inline bool FObject::isTimerInUpdating() const
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline FObject::FTimerList* FObject::getTimerList() const inline FObject::FTimerList* FObject::getTimerList() const
{ return timer_list; } { return globalTimerList().get(); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FObject::setWidgetProperty (bool property) inline void FObject::setWidgetProperty (bool property)

View File

@ -51,8 +51,7 @@ namespace finalcut
class FOptiAttr final class FOptiAttr final
{ {
public: public:
// Typedef struct TermEnv
typedef struct
{ {
const char* t_enter_bold_mode; const char* t_enter_bold_mode;
const char* t_exit_bold_mode; const char* t_exit_bold_mode;
@ -92,7 +91,7 @@ class FOptiAttr final
int max_color; int max_color;
int attr_without_color; int attr_without_color;
bool ansi_default_color; bool ansi_default_color;
} TermEnv; };
// Constructor // Constructor
FOptiAttr(); FOptiAttr();
@ -101,7 +100,7 @@ class FOptiAttr final
FOptiAttr (const FOptiAttr&) = delete; FOptiAttr (const FOptiAttr&) = delete;
// Destructor // Destructor
~FOptiAttr(); ~FOptiAttr() noexcept = default;
// Disable copy assignment operator (=) // Disable copy assignment operator (=)
FOptiAttr& operator = (const FOptiAttr&) = delete; FOptiAttr& operator = (const FOptiAttr&) = delete;

View File

@ -89,7 +89,7 @@ class FOptiMove final
explicit FOptiMove (int = 0); explicit FOptiMove (int = 0);
// Destructor // Destructor
~FOptiMove(); ~FOptiMove() noexcept = default;
// Accessors // Accessors
FString getClassName() const; FString getClassName() const;
@ -168,7 +168,7 @@ class FOptiMove final
void calculateCharDuration(); void calculateCharDuration();
int capDuration (const char[], int) const; int capDuration (const char[], int) const;
int capDurationToLength (int) const; int capDurationToLength (int) const;
int repeatedAppend (const Capability&, volatile int, char*) const; int repeatedAppend (const Capability&, int, char*) const;
int relativeMove (char[], int, int, int, int) const; int relativeMove (char[], int, int, int, int) const;
int verticalMove (char[], int, int) const; int verticalMove (char[], int, int) const;
void downMove (char[], int&, int, int) const; void downMove (char[], int&, int, int) const;

View File

@ -52,21 +52,14 @@ class FPoint
public: public:
// Constructors // Constructors
FPoint () = default; FPoint () = default;
FPoint (const FPoint&); // copy constructor
FPoint (FPoint&&) noexcept; // move constructor
FPoint (int, int); FPoint (int, int);
// Destructor
virtual ~FPoint();
// Overloaded operators // Overloaded operators
FPoint& operator = (const FPoint&);
FPoint& operator = (FPoint&&) noexcept;
FPoint& operator += (const FPoint&); FPoint& operator += (const FPoint&);
FPoint& operator -= (const FPoint&); FPoint& operator -= (const FPoint&);
// Accessors // Accessors
virtual FString getClassName(); FString getClassName();
int getX() const; int getX() const;
int getY() const; int getY() const;
void setX (int); void setX (int);
@ -102,18 +95,6 @@ class FPoint
// FPoint inline functions // FPoint inline functions
//----------------------------------------------------------------------
inline FPoint::FPoint (const FPoint& p) // copy constructor
: xpos{p.xpos}
, ypos{p.ypos}
{ }
//----------------------------------------------------------------------
inline FPoint::FPoint (FPoint&& p) noexcept // move constructor
: xpos{std::move(p.xpos)}
, ypos{std::move(p.ypos)}
{ }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline FPoint::FPoint (int x, int y) inline FPoint::FPoint (int x, int y)
: xpos{x} : xpos{x}

View File

@ -66,7 +66,7 @@ class FProgressbar : public FWidget
explicit FProgressbar(FWidget* = nullptr); explicit FProgressbar(FWidget* = nullptr);
// Destructor // Destructor
~FProgressbar() override; ~FProgressbar() noexcept override;
// Accessors // Accessors
FString getClassName() const override; FString getClassName() const override;

View File

@ -72,7 +72,7 @@ class FRadioButton : public FToggleButton
FRadioButton (const FRadioButton&) = delete; FRadioButton (const FRadioButton&) = delete;
// Destructor // Destructor
~FRadioButton() override; ~FRadioButton() noexcept override;
// Disable copy assignment operator (=) // Disable copy assignment operator (=)
FRadioButton& operator = (const FRadioButton&) = delete; FRadioButton& operator = (const FRadioButton&) = delete;

View File

@ -72,7 +72,7 @@ class FRadioMenuItem : public FMenuItem
FRadioMenuItem (const FRadioMenuItem&) = delete; FRadioMenuItem (const FRadioMenuItem&) = delete;
// Destructor // Destructor
~FRadioMenuItem() override; ~FRadioMenuItem() noexcept override;
// Disable copy assignment operator (=) // Disable copy assignment operator (=)
FRadioMenuItem& operator = (const FRadioMenuItem&) = delete; FRadioMenuItem& operator = (const FRadioMenuItem&) = delete;

View File

@ -60,21 +60,12 @@ class FRect
public: public:
// Constructors // Constructors
FRect () = default; FRect () = default;
FRect (const FRect&); // copy constructor
FRect (FRect&&) noexcept; // move constructor
FRect (int, int, std::size_t, std::size_t); FRect (int, int, std::size_t, std::size_t);
FRect (const FPoint&, const FSize&); FRect (const FPoint&, const FSize&);
FRect (const FPoint&, const FPoint&); FRect (const FPoint&, const FPoint&);
// Destructor
virtual ~FRect();
// Overloaded operators
FRect& operator = (const FRect&);
FRect& operator = (FRect&&) noexcept;
// Accessors // Accessors
virtual FString getClassName(); FString getClassName();
int getX1() const; int getX1() const;
int getY1() const; int getY1() const;
int getX2() const; int getX2() const;
@ -147,22 +138,6 @@ class FRect
}; };
// FRect inline functions // FRect inline functions
//----------------------------------------------------------------------
inline FRect::FRect (const FRect& r) // copy constructor
: X1{r.X1}
, Y1{r.Y1}
, X2{r.X2}
, Y2{r.Y2}
{ }
//----------------------------------------------------------------------
inline FRect::FRect (FRect&& r) noexcept // move constructor
: X1{std::move(r.X1)}
, Y1{std::move(r.Y1)}
, X2{std::move(r.X2)}
, Y2{std::move(r.Y2)}
{ }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline FRect::FRect (int x, int y, std::size_t width, std::size_t height) inline FRect::FRect (int x, int y, std::size_t width, std::size_t height)
: X1{x} : X1{x}

View File

@ -60,8 +60,8 @@ namespace finalcut
// class forward declaration // class forward declaration
class FScrollbar; class FScrollbar;
// Global typedef // Global using-declaration
typedef std::shared_ptr<FScrollbar> FScrollbarPtr; using FScrollbarPtr = std::shared_ptr<FScrollbar>;
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// class FScrollbar // class FScrollbar
@ -70,7 +70,7 @@ typedef std::shared_ptr<FScrollbar> FScrollbarPtr;
class FScrollbar : public FWidget class FScrollbar : public FWidget
{ {
public: public:
// Using-declarations // Using-declaration
using FWidget::setGeometry; using FWidget::setGeometry;
// Enumeration // Enumeration

View File

@ -57,21 +57,14 @@ class FSize
public: public:
// Constructors // Constructors
FSize () = default; FSize () = default;
FSize (const FSize&); // copy constructor
FSize (FSize&&) noexcept; // move constructor
FSize (std::size_t, std::size_t); FSize (std::size_t, std::size_t);
// Destructor
virtual ~FSize();
// Overloaded operators // Overloaded operators
FSize& operator = (const FSize&);
FSize& operator = (FSize&&) noexcept;
FSize& operator += (const FSize&); FSize& operator += (const FSize&);
FSize& operator -= (const FSize&); FSize& operator -= (const FSize&);
// Accessors // Accessors
virtual FString getClassName(); FString getClassName();
std::size_t getWidth() const; std::size_t getWidth() const;
std::size_t getHeight() const; std::size_t getHeight() const;
std::size_t getArea() const; std::size_t getArea() const;
@ -111,18 +104,6 @@ class FSize
}; };
// FSize inline functions // FSize inline functions
//----------------------------------------------------------------------
inline FSize::FSize (const FSize& s) // copy constructor
: width{s.width}
, height{s.height}
{ }
//----------------------------------------------------------------------
inline FSize::FSize (FSize&& s) noexcept // move constructor
: width{std::move(s.width)}
, height{std::move(s.height)}
{ }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline FSize::FSize (std::size_t w, std::size_t h) inline FSize::FSize (std::size_t w, std::size_t h)
: width{w} : width{w}

View File

@ -74,7 +74,7 @@ class FSpinBox : public FWidget
FSpinBox (const FSpinBox&) = delete; FSpinBox (const FSpinBox&) = delete;
// Destructor // Destructor
~FSpinBox() override; ~FSpinBox() noexcept override;
// Disable copy assignment operator (=) // Disable copy assignment operator (=)
FSpinBox& operator = (const FSpinBox&) = delete; FSpinBox& operator = (const FSpinBox&) = delete;

View File

@ -59,7 +59,7 @@ class FStartOptions final
FStartOptions (const FStartOptions&) = delete; FStartOptions (const FStartOptions&) = delete;
// Destructor // Destructor
~FStartOptions(); ~FStartOptions() = default;
// Disable copy assignment operator (=) // Disable copy assignment operator (=)
FStartOptions& operator = (const FStartOptions&) = delete; FStartOptions& operator = (const FStartOptions&) = delete;
@ -71,9 +71,6 @@ class FStartOptions final
// Mutator // Mutator
void setDefault(); void setDefault();
// Method
static void destroyObject();
// Data members // Data members
uInt8 cursor_optimisation : 1; uInt8 cursor_optimisation : 1;
uInt8 mouse_support : 1; uInt8 mouse_support : 1;

View File

@ -68,8 +68,8 @@ namespace finalcut
// class forward declaration // class forward declaration
class FString; class FString;
// Global typedef // Global using-declaration
typedef std::vector<FString> FStringList; using FStringList = std::vector<FString>;
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -54,21 +54,6 @@ class FStyle
: attribute{attr} : attribute{attr}
{ } { }
// Copy constructor
FStyle (const FStyle& style)
: attribute{style.attribute}
{ }
// Destructor
~FStyle() = default;
// copy assignment operator (=)
FStyle& operator = (const FStyle& style)
{
attribute = style.attribute;
return *this;
}
// Accessor // Accessor
FString getClassName() const FString getClassName() const
{ return "FStyle"; } { return "FStyle"; }

View File

@ -72,7 +72,7 @@ class FSwitch : public FToggleButton
FSwitch (const FSwitch&) = delete; FSwitch (const FSwitch&) = delete;
// Destructor // Destructor
~FSwitch() override; ~FSwitch() noexcept override;
// Disable copy assignment operator (=) // Disable copy assignment operator (=)
FSwitch& operator = (const FSwitch&) = delete; FSwitch& operator = (const FSwitch&) = delete;

View File

@ -52,10 +52,10 @@ class FSystem
using fn_putc = int (*)(int); using fn_putc = int (*)(int);
// Constructor // Constructor
FSystem(); FSystem () = default;
// Destructor // Destructor
virtual ~FSystem(); virtual ~FSystem() noexcept;
// Methods // Methods
virtual uChar inPortByte (uShort) = 0; virtual uChar inPortByte (uShort) = 0;

View File

@ -97,10 +97,10 @@ class FSystemImpl : public FSystem
{ {
public: public:
// Constructor // Constructor
FSystemImpl(); FSystemImpl() = default;
// Destructor // Destructor
~FSystemImpl() override; ~FSystemImpl() noexcept override;
// Methods // Methods
#if defined(ISA_SYSCTL_SUPPORT) #if defined(ISA_SYSCTL_SUPPORT)

View File

@ -161,10 +161,10 @@ class FTermXTerminal;
class FTerm final class FTerm final
{ {
public: public:
// Typedef // Using-declarations
typedef std::function<int(int)> defaultPutChar; using defaultPutChar = std::function<int(int)>;
typedef std::shared_ptr<FColorPalette> FColorPalettePtr; using FColorPalettePtr = std::shared_ptr<FColorPalette>;
typedef FColorPalette::FSetPalette FSetPalette; using FSetPalette = FColorPalette::FSetPalette;
// Constructor // Constructor
FTerm(); FTerm();

View File

@ -69,7 +69,7 @@ class FTermBuffer
FTermBuffer (Iterator, Iterator); FTermBuffer (Iterator, Iterator);
// Destructor // Destructor
virtual ~FTermBuffer(); virtual ~FTermBuffer() noexcept;
// Overloaded operators // Overloaded operators
template <typename typeT> template <typename typeT>

View File

@ -50,10 +50,10 @@ class FTermcapQuirks final
{ {
public: public:
// Constructors // Constructors
FTermcapQuirks(); FTermcapQuirks() = default;
// Destructor // Destructor
~FTermcapQuirks(); ~FTermcapQuirks() noexcept = default;
// Accessor // Accessor
FString getClassName() const; FString getClassName() const;

View File

@ -57,15 +57,13 @@ class FTermData final
typedef std::unordered_map<std::string, fc::encoding> EncodingMap; typedef std::unordered_map<std::string, fc::encoding> EncodingMap;
// Constructors // Constructors
FTermData() FTermData () = default;
{ }
// Disable copy constructor // Disable copy constructor
FTermData (const FTermData&) = delete; FTermData (const FTermData&) = delete;
// Destructor // Destructor
~FTermData() ~FTermData() noexcept = default;
{ }
// Disable copy assignment operator (=) // Disable copy assignment operator (=)
FTermData& operator = (const FTermData&) = delete; FTermData& operator = (const FTermData&) = delete;

View File

@ -50,8 +50,7 @@ namespace finalcut
class FTermDetection final class FTermDetection final
{ {
public: public:
// Typedefs struct FTerminalType
typedef struct
{ {
// byte #0 // byte #0
uInt8 ansi : 1; uInt8 ansi : 1;
@ -77,7 +76,7 @@ class FTermDetection final
uInt8 kterm : 1; uInt8 kterm : 1;
uInt8 mlterm : 1; uInt8 mlterm : 1;
uInt8 : 4; // padding bits uInt8 : 4; // padding bits
} FTerminalType; };
// Constructors // Constructors
FTermDetection(); FTermDetection();

View File

@ -79,8 +79,8 @@ class FTermData;
class FTermFreeBSD final class FTermFreeBSD final
{ {
public: public:
// Typedef // Using-declaration
typedef fc::freebsdConsoleCursorStyle CursorStyle; using CursorStyle = fc::freebsdConsoleCursorStyle;
// Constructors // Constructors
FTermFreeBSD() = default; FTermFreeBSD() = default;

View File

@ -55,7 +55,7 @@ class FTermios final
FTermios(); FTermios();
// Destructor // Destructor
~FTermios(); ~FTermios() noexcept = default;
// Accessors // Accessors
FString getClassName() const; FString getClassName() const;

View File

@ -77,8 +77,8 @@ class FTermDetection;
class FTermLinux final class FTermLinux final
{ {
public: public:
// Typedef // Using-declaration
typedef fc::linuxConsoleCursorStyle CursorStyle; using CursorStyle = fc::linuxConsoleCursorStyle;
// Constructors // Constructors
FTermLinux() = default; FTermLinux() = default;
@ -123,7 +123,6 @@ class FTermLinux final
FKey modifierKeyCorrection (const FKey&); FKey modifierKeyCorrection (const FKey&);
private: private:
// Typedef
struct ModifierKey // bit field struct ModifierKey // bit field
{ {
uChar shift : 1; // 0..1 uChar shift : 1; // 0..1
@ -133,17 +132,17 @@ class FTermLinux final
uChar : 4; // padding bits uChar : 4; // padding bits
}; };
typedef struct struct RGB
{ {
uChar red; uChar red;
uChar green; uChar green;
uChar blue; uChar blue;
} RGB; };
typedef struct struct ColorMap
{ {
RGB color[16]; RGB color[16];
} ColorMap; };
// Accessors // Accessors
int getFramebuffer_bpp(); int getFramebuffer_bpp();

View File

@ -81,7 +81,7 @@ class FTermOpenBSD final
FTermOpenBSD (const FTermOpenBSD&) = delete; FTermOpenBSD (const FTermOpenBSD&) = delete;
// Destructor // Destructor
~FTermOpenBSD(); ~FTermOpenBSD() noexcept = default;
// Disable copy assignment operator (=) // Disable copy assignment operator (=)
FTermOpenBSD& operator = (const FTermOpenBSD&) = delete; FTermOpenBSD& operator = (const FTermOpenBSD&) = delete;

View File

@ -58,7 +58,7 @@ class FTermXTerminal final
FTermXTerminal (const FTermXTerminal&) = delete; FTermXTerminal (const FTermXTerminal&) = delete;
// Destructor // Destructor
~FTermXTerminal(); ~FTermXTerminal() noexcept = default;
// Disable copy assignment operator (=) // Disable copy assignment operator (=)
FTermXTerminal& operator = (const FTermXTerminal&) = delete; FTermXTerminal& operator = (const FTermXTerminal&) = delete;

View File

@ -77,7 +77,7 @@ class FTextView : public FWidget
FTextView (const FTextView&) = delete; FTextView (const FTextView&) = delete;
// Destructor // Destructor
~FTextView() override; ~FTextView() noexcept override;
// Disable copy assignment operator (=) // Disable copy assignment operator (=)
FTextView& operator = (const FTextView&) = delete; FTextView& operator = (const FTextView&) = delete;

View File

@ -148,7 +148,7 @@ class FToggleButton : public FWidget
// Methods // Methods
void init(); void init();
void drawText (const FString&, std::size_t); void drawText (FString&&, std::size_t);
void correctSize (FSize&) const; void correctSize (FSize&) const;
// Data members // Data members

View File

@ -36,6 +36,7 @@
#include <array> #include <array>
#include <functional> #include <functional>
#include <limits> #include <limits>
#include <memory>
#include <unordered_map> #include <unordered_map>
#include <string> #include <string>
@ -49,29 +50,28 @@
<< " in " \ << " in " \
<< __func__ << std::endl; << __func__ << std::endl;
typedef unsigned char uChar; using uChar = unsigned char;
typedef unsigned short uShort; using uShort = unsigned short;
typedef unsigned int uInt; using uInt = unsigned int;
typedef unsigned long uLong; using uLong = unsigned long;
typedef std::uint8_t uInt8; using uInt8 = std::uint8_t;
typedef std::uint16_t uInt16; using uInt16 = std::uint16_t;
typedef std::uint32_t uInt32; using uInt32 = std::uint32_t;
typedef std::uint64_t uInt64; using uInt64 = std::uint64_t;
typedef signed int sInt; using sInt = signed int;
typedef signed long sLong; using sLong = signed long;
typedef std::int8_t sInt8; using sInt8 = std::int8_t;
typedef std::int16_t sInt16; using sInt16 = std::int16_t;
typedef std::int32_t sInt32; using sInt32 = std::int32_t;
typedef std::int64_t sInt64; using sInt64 = std::int64_t;
typedef long double lDouble; using lDouble = long double;
typedef uInt16 FColor; using FColor = uInt16;
typedef uInt16 FAttribute; using FAttribute = uInt16;
typedef uInt32 FKey; using FKey = uInt32;
typedef void* FDataPtr; using FCall = std::function<void()>;
typedef std::function<void()> FCall;
namespace finalcut namespace finalcut
{ {
@ -115,7 +115,13 @@ struct getPrecision
} }
}; };
typedef std::unordered_map<wchar_t, wchar_t> charSubstitution; template <typename T, typename... Args>
std::unique_ptr<T> make_unique (Args&&... args)
{
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
}
using charSubstitution = std::unordered_map<wchar_t, wchar_t>;
struct FCharAttribute struct FCharAttribute
{ {
@ -155,42 +161,39 @@ union attribute
static constexpr uInt UNICODE_MAX = 5; static constexpr uInt UNICODE_MAX = 5;
typedef std::array<wchar_t, UNICODE_MAX> FUnicode; using FUnicode = std::array<wchar_t, UNICODE_MAX>;
typedef struct struct FChar
{ {
FUnicode ch; // Character code FUnicode ch{}; // Character code
FUnicode encoded_char; // Encoded output character FUnicode encoded_char{}; // Encoded output character
FColor fg_color; // Foreground color FColor fg_color{}; // Foreground color
FColor bg_color; // Background color FColor bg_color{}; // Background color
attribute attr; // Attributes attribute attr{}; // Attributes
} FChar; };
namespace fc namespace fc
{ {
typedef struct struct FKeyMap
{ {
FKey num; FKey num;
const char* string; const char* string;
char tname[4]; char tname[4];
} };
FKeyMap;
typedef struct struct FMetakeyMap
{ {
FKey num; FKey num;
char string[8]; char string[8];
} };
FMetakeyMap;
typedef struct struct FKeyName
{ {
FKey num; FKey num;
char string[25]; char string[25];
} };
FKeyName;
} // namespace fc } // namespace fc
@ -198,7 +201,7 @@ FKeyName;
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool operator == (const FChar& lhs, const FChar& rhs) inline bool operator == (const FChar& lhs, const FChar& rhs)
{ {
return operator == (lhs.ch, rhs.ch) return operator == (lhs.ch, rhs.ch) // Compare FUnicode
&& lhs.fg_color == rhs.fg_color && lhs.fg_color == rhs.fg_color
&& lhs.bg_color == rhs.bg_color && lhs.bg_color == rhs.bg_color
&& lhs.attr.byte[0] == rhs.attr.byte[0] && lhs.attr.byte[0] == rhs.attr.byte[0]

View File

@ -87,22 +87,22 @@ class FWidget;
class FVTerm class FVTerm
{ {
public: public:
// Typedefs and Enumeration struct FTermArea; // forward declaration
typedef struct struct FVTermPreprocessing; // forward declaration
struct FLineChanges
{ {
uInt xmin; // X-position with the first change uInt xmin; // X-position with the first change
uInt xmax; // X-position with the last change uInt xmax; // X-position with the last change
uInt trans_count; // Number of transparent characters uInt trans_count; // Number of transparent characters
} FLineChanges; };
typedef void (FVTerm::*FPreprocessingHandler)(); // Using-declarations
typedef std::function<void()> FPreprocessingFunction; using FPreprocessingHandler = void (FVTerm::*)();
using FPreprocessingFunction = std::function<void()> ;
struct FTermArea; // forward declaration using FPreprocessing = std::vector<FVTermPreprocessing>;
struct FVTermPreprocessing; // forward declaration
typedef std::vector<FVTermPreprocessing> FPreprocessing;
// Enumerations
enum covered_state enum covered_state
{ {
non_covered, non_covered,
@ -500,50 +500,16 @@ struct FVTerm::FTermArea // define virtual terminal character properties
struct FVTerm::FVTermPreprocessing struct FVTerm::FVTermPreprocessing
{ {
// Constructor // Constructor
FVTermPreprocessing() FVTermPreprocessing() = default;
: instance(nullptr)
, function(nullptr)
{ }
FVTermPreprocessing (const FVTerm* i, const FPreprocessingFunction& f) FVTermPreprocessing (const FVTerm* i, const FPreprocessingFunction& f)
: instance(i) : instance(i)
, function(f) , function(f)
{ } { }
FVTermPreprocessing (const FVTermPreprocessing& p) // copy constructor
: instance(p.instance)
, function(p.function)
{ }
FVTermPreprocessing (FVTermPreprocessing&& p) noexcept // move constructor
: instance(std::move(p.instance))
, function(std::move(p.function))
{ }
// Overloaded operators
FVTermPreprocessing& operator = (const FVTermPreprocessing& p)
{
instance = p.instance;
function = p.function;
return *this;
}
FVTermPreprocessing& operator = (FVTermPreprocessing&& p) noexcept
{
instance = p.instance;
function = p.function;
p.instance = nullptr;
p.function = nullptr;
return *this;
}
// Destructor
~FVTermPreprocessing()
{ }
// Data members // Data members
const FVTerm* instance{}; const FVTerm* instance{nullptr};
FPreprocessingFunction function{}; FPreprocessingFunction function{nullptr};
}; };

View File

@ -125,20 +125,18 @@ class FWidgetColors;
class FWidget : public FVTerm, public FObject class FWidget : public FVTerm, public FObject
{ {
public: public:
// Using-declaration
using FVTerm::setColor;
using FVTerm::print;
struct FAccelerator struct FAccelerator
{ {
alignas(8) FKey key; alignas(8) FKey key;
FWidget* object; FWidget* object;
}; };
// Typedefs // Using-declarations
typedef std::vector<FWidget*> FWidgetList; using FVTerm::setColor;
typedef std::vector<FAccelerator> FAcceleratorList; using FVTerm::print;
typedef std::shared_ptr<FWidgetColors> FWidgetColorsPtr; using FWidgetList = std::vector<FWidget*>;
using FAcceleratorList = std::vector<FAccelerator>;
using FWidgetColorsPtr = std::shared_ptr<FWidgetColors>;
struct FWidgetFlags // Properties of a widget ⚑ struct FWidgetFlags // Properties of a widget ⚑
{ {

View File

@ -61,7 +61,7 @@ class SGRoptimizer final
SGRoptimizer (const SGRoptimizer&) = delete; SGRoptimizer (const SGRoptimizer&) = delete;
// Destructor // Destructor
~SGRoptimizer(); ~SGRoptimizer() noexcept = default;
// Disable copy assignment operator (=) // Disable copy assignment operator (=)
SGRoptimizer& operator = (const SGRoptimizer&) = delete; SGRoptimizer& operator = (const SGRoptimizer&) = delete;

Some files were not shown because too many files have changed in this diff Show More