Several small code improvements
This commit is contained in:
parent
f364f76aea
commit
90b389035e
|
@ -100,7 +100,7 @@ matrix:
|
|||
- bash <(curl -s https://codecov.io/bash)
|
||||
|
||||
#
|
||||
# sonarcloud
|
||||
# SonarCloud
|
||||
#
|
||||
- os: linux
|
||||
env:
|
||||
|
|
|
@ -36,7 +36,7 @@ using finalcut::FSize;
|
|||
// class SegmentView
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class SegmentView : public finalcut::FDialog
|
||||
class SegmentView final : public finalcut::FDialog
|
||||
{
|
||||
public:
|
||||
explicit SegmentView (finalcut::FWidget* = nullptr);
|
||||
|
|
|
@ -34,7 +34,7 @@ using finalcut::FSize;
|
|||
// class Background
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class Background : public finalcut::FDialog
|
||||
class Background final : public finalcut::FDialog
|
||||
{
|
||||
public:
|
||||
// Typedef
|
||||
|
|
|
@ -42,7 +42,7 @@ constexpr lDouble PI{3.141592653589793238L};
|
|||
// class Button
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class Button : public finalcut::FButton
|
||||
class Button final : public finalcut::FButton
|
||||
{
|
||||
public:
|
||||
// Constructor
|
||||
|
@ -106,7 +106,7 @@ void Button::onKeyPress (finalcut::FKeyEvent* ev)
|
|||
// class Calc
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class Calc : public finalcut::FDialog
|
||||
class Calc final : public finalcut::FDialog
|
||||
{
|
||||
public:
|
||||
// Constructor
|
||||
|
|
|
@ -36,7 +36,7 @@ using finalcut::FSize;
|
|||
// class CheckList
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class CheckList : public finalcut::FDialog
|
||||
class CheckList final : public finalcut::FDialog
|
||||
{
|
||||
public:
|
||||
// Constructor
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
// class Keyboard
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class Keyboard : public finalcut::FWidget
|
||||
class Keyboard final : public finalcut::FWidget
|
||||
{
|
||||
public:
|
||||
// Constructor
|
||||
|
|
|
@ -76,7 +76,7 @@ FString& mapToString ( std::map<FString
|
|||
// class Listbox
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class Listbox : public FDialog
|
||||
class Listbox final : public FDialog
|
||||
{
|
||||
public:
|
||||
// Constructor
|
||||
|
|
|
@ -36,7 +36,7 @@ using finalcut::FSize;
|
|||
// class Listview
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class Listview : public finalcut::FDialog
|
||||
class Listview final : public finalcut::FDialog
|
||||
{
|
||||
public:
|
||||
// Constructor
|
||||
|
|
|
@ -31,7 +31,7 @@ using finalcut::FSize;
|
|||
// class Mandelbrot
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class Mandelbrot : public finalcut::FDialog
|
||||
class Mandelbrot final : public finalcut::FDialog
|
||||
{
|
||||
public:
|
||||
// Constructor
|
||||
|
|
|
@ -31,7 +31,7 @@ using finalcut::FSize;
|
|||
// class Menu
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class Menu : public finalcut::FDialog
|
||||
class Menu final : public finalcut::FDialog
|
||||
{
|
||||
public:
|
||||
// Constructor
|
||||
|
|
|
@ -33,7 +33,7 @@ using finalcut::FSize;
|
|||
// class ColorChooser
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class ColorChooser : public finalcut::FWidget
|
||||
class ColorChooser final : public finalcut::FWidget
|
||||
{
|
||||
public:
|
||||
// Constructor
|
||||
|
@ -172,7 +172,7 @@ inline FColor ColorChooser::getBackground()
|
|||
// class Brushes
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class Brushes : public finalcut::FWidget
|
||||
class Brushes final : public finalcut::FWidget
|
||||
{
|
||||
public:
|
||||
// Constructor
|
||||
|
@ -308,7 +308,7 @@ inline void Brushes::setBackground (FColor color)
|
|||
// class MouseDraw
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class MouseDraw : public finalcut::FDialog
|
||||
class MouseDraw final : public finalcut::FDialog
|
||||
{
|
||||
public:
|
||||
// Using-declaration
|
||||
|
|
|
@ -42,7 +42,7 @@ using finalcut::FSize;
|
|||
// class RotoZoomer
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class RotoZoomer : public finalcut::FDialog
|
||||
class RotoZoomer final : public finalcut::FDialog
|
||||
{
|
||||
public:
|
||||
// Constructor
|
||||
|
|
|
@ -31,7 +31,7 @@ using finalcut::FSize;
|
|||
// class Scrollview
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class Scrollview : public finalcut::FScrollView
|
||||
class Scrollview final : public finalcut::FScrollView
|
||||
{
|
||||
public:
|
||||
// Constructor
|
||||
|
@ -190,7 +190,7 @@ void Scrollview::cb_goNorth (const finalcut::FWidget*, const FDataPtr)
|
|||
// class Scrollviewdemo
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class Scrollviewdemo : public finalcut::FDialog
|
||||
class Scrollviewdemo final : public finalcut::FDialog
|
||||
{
|
||||
public:
|
||||
// Constructor
|
||||
|
|
|
@ -122,7 +122,8 @@ void streamingIntoFStringExample()
|
|||
|
||||
// ...from wide string
|
||||
finalcut::FString streamer3;
|
||||
streamer3 << const_cast<wchar_t*>(L"wchar_t*");
|
||||
wchar_t* wchar_str{const_cast<wchar_t*>(L"wchar_t*")};
|
||||
streamer3 << wchar_str;
|
||||
std::cout << " stream in: " << streamer3 << std::endl;
|
||||
|
||||
// ...from c++ string
|
||||
|
@ -132,7 +133,8 @@ void streamingIntoFStringExample()
|
|||
|
||||
// ...from c-string
|
||||
finalcut::FString streamer5;
|
||||
streamer5 << const_cast<char*>("char*");
|
||||
char* char_str{C_STR("char*")};
|
||||
streamer5 << char_str;
|
||||
std::cout << " stream in: " << streamer5 << std::endl;
|
||||
|
||||
// ...from wide character
|
||||
|
|
|
@ -34,7 +34,7 @@ using finalcut::FColorPair;
|
|||
// class AttribDlg
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class AttribDlg : public finalcut::FDialog
|
||||
class AttribDlg final : public finalcut::FDialog
|
||||
{
|
||||
public:
|
||||
// Constructor
|
||||
|
@ -200,7 +200,7 @@ void AttribDlg::adjustSize()
|
|||
// class AttribDemo
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class AttribDemo : public finalcut::FWidget
|
||||
class AttribDemo final : public finalcut::FWidget
|
||||
{
|
||||
public:
|
||||
// Constructor
|
||||
|
@ -425,19 +425,18 @@ void AttribDemo::draw()
|
|||
|
||||
const std::vector<std::function<void()> > effect
|
||||
{
|
||||
[&] { printDim(); },
|
||||
[&] { printNormal(); },
|
||||
[&] { printBold(); },
|
||||
[&] { printBoldDim(); },
|
||||
[&] { printItalic(); },
|
||||
[&] { printUnderline(); },
|
||||
[&] { printDblUnderline(); },
|
||||
[&] { printCrossesOut(); },
|
||||
[&] { printBlink(); },
|
||||
[&] { printReverse(); },
|
||||
[&] { printStandout(); },
|
||||
[&] { printInvisible(); },
|
||||
[&] { printProtected(); },
|
||||
[this] { printNormal(); },
|
||||
[this] { printBold(); },
|
||||
[this] { printBoldDim(); },
|
||||
[this] { printItalic(); },
|
||||
[this] { printUnderline(); },
|
||||
[this] { printDblUnderline(); },
|
||||
[this] { printCrossesOut(); },
|
||||
[this] { printBlink(); },
|
||||
[this] { printReverse(); },
|
||||
[this] { printStandout(); },
|
||||
[this] { printInvisible(); },
|
||||
[this] { printProtected(); },
|
||||
};
|
||||
|
||||
for (std::size_t y{0}; y < getParentWidget()->getHeight() - 7; y++)
|
||||
|
|
|
@ -237,7 +237,9 @@ void debug (finalcut::FApplication& TermApp)
|
|||
}
|
||||
#else
|
||||
void debug (finalcut::FApplication&)
|
||||
{ }
|
||||
{
|
||||
// FINAL CUT was compiled without debug option
|
||||
}
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace fc = finalcut::fc;
|
|||
// class Timer
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class Timer : public finalcut::FWidget
|
||||
class Timer final : public finalcut::FWidget
|
||||
{
|
||||
public:
|
||||
// Constructor
|
||||
|
|
|
@ -33,7 +33,7 @@ using finalcut::FStyle;
|
|||
// class Transparent
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class Transparent : public finalcut::FDialog
|
||||
class Transparent final : public finalcut::FDialog
|
||||
{
|
||||
public:
|
||||
// Typedef and Enumeration
|
||||
|
@ -74,6 +74,7 @@ Transparent::Transparent ( finalcut::FWidget* parent
|
|||
: finalcut::FDialog(parent)
|
||||
, type(tt)
|
||||
{
|
||||
// Set statusbar text for this window
|
||||
setStatusbarMessage("Press Q to quit");
|
||||
}
|
||||
|
||||
|
@ -139,7 +140,7 @@ void Transparent::onKeyPress (finalcut::FKeyEvent* ev)
|
|||
// class MainWindow
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class MainWindow : public finalcut::FDialog
|
||||
class MainWindow final : public finalcut::FDialog
|
||||
{
|
||||
public:
|
||||
// Constructor
|
||||
|
@ -212,8 +213,8 @@ MainWindow::MainWindow (finalcut::FWidget* parent)
|
|||
ibg->setGeometry (FPoint(42, 3), FSize(29, 7));
|
||||
ibg->unsetTransparentShadow();
|
||||
|
||||
// Statusbar at the bottom
|
||||
status_bar.setMessage("Press Q to quit");
|
||||
// Set statusbar text for this window
|
||||
setStatusbarMessage("Press Q to quit");
|
||||
|
||||
unsetTransparentShadow();
|
||||
activateDialog();
|
||||
|
|
|
@ -66,6 +66,7 @@ bool sortAscending ( const finalcut::FObject* lhs
|
|||
const sInt64 r_number = StringToNumber(r_item->getText(column));
|
||||
return bool( l_number < r_number ); // lhs < rhs
|
||||
}
|
||||
|
||||
case 3:
|
||||
{
|
||||
std::setlocale(LC_NUMERIC, "C");
|
||||
|
@ -73,6 +74,9 @@ bool sortAscending ( const finalcut::FObject* lhs
|
|||
const double r_number = r_item->getText(column).toDouble();
|
||||
return bool( l_number < r_number ); // lhs < rhs
|
||||
}
|
||||
|
||||
default:
|
||||
break; // Don't do anything
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -102,6 +106,9 @@ bool sortDescending ( const finalcut::FObject* lhs
|
|||
const double r_number = r_item->getText(column).toDouble();
|
||||
return bool( l_number > r_number ); // lhs > rhs
|
||||
}
|
||||
|
||||
default:
|
||||
break; // Don't do anything
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -112,7 +119,7 @@ bool sortDescending ( const finalcut::FObject* lhs
|
|||
// class Treeview
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class Treeview : public finalcut::FDialog
|
||||
class Treeview final : public finalcut::FDialog
|
||||
{
|
||||
public:
|
||||
// Constructor
|
||||
|
|
|
@ -38,20 +38,20 @@ using finalcut::FSize;
|
|||
// class ProgressDialog
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class ProgressDialog : public finalcut::FDialog
|
||||
class ProgressDialog final : public finalcut::FDialog
|
||||
{
|
||||
public:
|
||||
// Constructor
|
||||
explicit ProgressDialog (finalcut::FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
ProgressDialog (const ProgressDialog&) = delete;
|
||||
// Copy constructor
|
||||
ProgressDialog (const ProgressDialog&) = default;
|
||||
|
||||
// Destructor
|
||||
~ProgressDialog() override;
|
||||
|
||||
// Disable assignment operator (=)
|
||||
ProgressDialog& operator = (const ProgressDialog&) = delete;
|
||||
// Assignment operator (=)
|
||||
ProgressDialog& operator = (const ProgressDialog&) = default;
|
||||
|
||||
private:
|
||||
// Event handlers
|
||||
|
@ -181,7 +181,7 @@ void ProgressDialog::cb_exit_bar (const finalcut::FWidget*, const FDataPtr)
|
|||
// class TextWindow
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class TextWindow : public finalcut::FDialog
|
||||
class TextWindow final : public finalcut::FDialog
|
||||
{
|
||||
public:
|
||||
// Constructor
|
||||
|
@ -247,7 +247,7 @@ void TextWindow::adjustSize()
|
|||
// class MyDialog
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class MyDialog : public finalcut::FDialog
|
||||
class MyDialog final : public finalcut::FDialog
|
||||
{
|
||||
public:
|
||||
// Constructor
|
||||
|
|
|
@ -31,7 +31,7 @@ using finalcut::FSize;
|
|||
// class Watch
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class Watch : public finalcut::FDialog
|
||||
class Watch final : public finalcut::FDialog
|
||||
{
|
||||
public:
|
||||
// Constructor
|
||||
|
|
|
@ -32,7 +32,7 @@ using finalcut::FSize;
|
|||
// class SmallWindow
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class SmallWindow : public finalcut::FDialog
|
||||
class SmallWindow final : public finalcut::FDialog
|
||||
{
|
||||
public:
|
||||
// Constructor
|
||||
|
@ -160,20 +160,20 @@ void SmallWindow::onTimer (finalcut::FTimerEvent*)
|
|||
// class Window
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class Window : public finalcut::FDialog
|
||||
class Window final : public finalcut::FDialog
|
||||
{
|
||||
public:
|
||||
// Constructor
|
||||
explicit Window (finalcut::FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
Window (const Window&) = delete;
|
||||
// Copy constructor
|
||||
Window (const Window&) = default;
|
||||
|
||||
// Destructor
|
||||
~Window() override;
|
||||
|
||||
// Disable assignment operator (=)
|
||||
Window& operator = (const Window&) = delete;
|
||||
// Assignment operator (=)
|
||||
Window& operator = (const Window&) = default;
|
||||
|
||||
private:
|
||||
// Typedefs
|
||||
|
|
|
@ -88,8 +88,9 @@ FApplication::FApplication ( const int& _argc
|
|||
|
||||
if ( ! (_argc && _argv) )
|
||||
{
|
||||
static char* empty{C_STR("")};
|
||||
app_argc = 0;
|
||||
static char empty_str[1] = "";
|
||||
auto empty = const_cast<char*>(empty_str);
|
||||
app_argv = static_cast<char**>(&empty);
|
||||
}
|
||||
|
||||
|
@ -179,8 +180,7 @@ bool FApplication::sendEvent ( const FObject* receiver
|
|||
|
||||
if ( receiver->isWidget() )
|
||||
{
|
||||
const auto r_widget = static_cast<const FWidget*>(receiver);
|
||||
auto widget = const_cast<FWidget*>(r_widget);
|
||||
const auto widget = static_cast<const FWidget*>(receiver);
|
||||
|
||||
if ( getModalDialogCounter() > 0 )
|
||||
{
|
||||
|
@ -363,7 +363,13 @@ void FApplication::closeConfirmationDialog (FWidget* w, FCloseEvent* ev)
|
|||
if ( ret == FMessageBox::Yes )
|
||||
ev->accept();
|
||||
else
|
||||
{
|
||||
ev->ignore();
|
||||
|
||||
// Status bar restore after closing the FMessageBox
|
||||
if ( getStatusBar() )
|
||||
getStatusBar()->drawMessage();
|
||||
}
|
||||
}
|
||||
|
||||
// private methods of FApplication
|
||||
|
|
|
@ -521,7 +521,9 @@ inline void FButton::drawTopBottomBackground()
|
|||
//----------------------------------------------------------------------
|
||||
inline void FButton::drawButtonTextLine (const FString& button_text)
|
||||
{
|
||||
std::size_t z{0};
|
||||
std::size_t pos{};
|
||||
std::size_t columns{0};
|
||||
print() << FPoint(2 + int(indent), 1 + int(vcenter_offset))
|
||||
<< FColorPair (button_fg, button_bg);
|
||||
|
||||
|
@ -547,8 +549,7 @@ inline void FButton::drawButtonTextLine (const FString& button_text)
|
|||
if ( active_focus && (isMonochron() || getMaxColor() < 16) )
|
||||
setBold();
|
||||
|
||||
for ( std::size_t z{0}, columns{0}
|
||||
; pos < center_offset + column_width && columns + 2 < getWidth(); )
|
||||
while ( pos < center_offset + column_width && columns + 2 < getWidth() )
|
||||
{
|
||||
if ( z == hotkeypos && getFlags().active )
|
||||
{
|
||||
|
|
|
@ -538,7 +538,7 @@ void FComboBox::draw()
|
|||
{
|
||||
const auto& wc = getFWidgetColors();
|
||||
|
||||
const FColorPair button_color = [&] ()
|
||||
const FColorPair button_color = [this, &wc] ()
|
||||
{
|
||||
if ( list_window.isEmpty() )
|
||||
return FColorPair ( wc.scrollbar_button_inactive_fg
|
||||
|
|
|
@ -491,8 +491,46 @@ FListViewIterator::FListViewIterator (iterator iter)
|
|||
: node(iter)
|
||||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
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(i.iter_path) // move constructor
|
||||
, node(i.node)
|
||||
, position(i.position)
|
||||
{
|
||||
i.iter_path = iterator_stack{};
|
||||
i.node = iterator{};
|
||||
i.position = 0;
|
||||
}
|
||||
|
||||
// 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 = i.iter_path;
|
||||
node = i.node;
|
||||
position = i.position;
|
||||
i.iter_path = iterator_stack{};
|
||||
i.node = iterator{};
|
||||
i.position = 0;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FListViewIterator& FListViewIterator::operator ++ () // prefix
|
||||
{
|
||||
|
|
|
@ -566,8 +566,9 @@ int FOptiMove::capDuration (const char cap[], int affcnt)
|
|||
if ( p[0] == '$' && p[1] == '<' && std::strchr(p, '>') )
|
||||
{
|
||||
float num = 0;
|
||||
p += 2;
|
||||
|
||||
for (p += 2; *p != '>'; p++)
|
||||
while ( *p != '>' )
|
||||
{
|
||||
if ( std::isdigit(uChar(*p)) )
|
||||
num = num * 10 + float(*p - '0');
|
||||
|
@ -575,11 +576,13 @@ int FOptiMove::capDuration (const char cap[], int affcnt)
|
|||
num *= float(affcnt);
|
||||
else if ( *p == '.' )
|
||||
{
|
||||
++p;
|
||||
p++;
|
||||
|
||||
if ( *p != '>' && std::isdigit(uChar(*p)) )
|
||||
num += float((*p - '0') / 10.0);
|
||||
}
|
||||
|
||||
p++;
|
||||
}
|
||||
|
||||
ms += num * 10;
|
||||
|
|
|
@ -56,6 +56,28 @@ FRect::~FRect() // destructor
|
|||
|
||||
|
||||
// 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 = r.X1;
|
||||
Y1 = r.Y1;
|
||||
X2 = r.X2;
|
||||
Y2 = r.Y2;
|
||||
r.X1 = r.Y1 = 0;
|
||||
r.X2 = r.Y2 = -1;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FRect::isEmpty() const
|
||||
{
|
||||
|
@ -310,27 +332,6 @@ FRect FRect::combined (const FRect& r) const
|
|||
return new_rect;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
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 = r.X1;
|
||||
Y1 = r.Y1;
|
||||
X2 = r.X2;
|
||||
Y2 = r.Y2;
|
||||
r.X1 = r.Y1 = 0;
|
||||
r.X2 = r.Y2 = -1;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// FRect non-member operators
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -60,9 +60,10 @@ FKey getHotkey (const FString& text)
|
|||
if ( text.isEmpty() )
|
||||
return 0;
|
||||
|
||||
std::size_t i{0};
|
||||
const std::size_t length = text.getLength();
|
||||
|
||||
for (std::size_t i{0}; i < length; i++)
|
||||
while ( i < length )
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -76,7 +77,10 @@ FKey getHotkey (const FString& text)
|
|||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -190,8 +190,12 @@ class FListViewIterator
|
|||
// Constructor
|
||||
FListViewIterator ();
|
||||
FListViewIterator (iterator);
|
||||
FListViewIterator (const FListViewIterator&); // copy constructor
|
||||
FListViewIterator (FListViewIterator&&) noexcept; // move constructor
|
||||
|
||||
// Overloaded operators
|
||||
FListViewIterator& operator = (const FListViewIterator&);
|
||||
FListViewIterator& operator = (FListViewIterator&&) noexcept;
|
||||
FListViewIterator& operator ++ (); // prefix
|
||||
FListViewIterator operator ++ (int); // postfix
|
||||
FListViewIterator& operator -- (); // prefix
|
||||
|
|
|
@ -99,22 +99,7 @@ class FVTerm
|
|||
typedef std::function<void()> FPreprocessingFunction;
|
||||
|
||||
struct FTermArea; // forward declaration
|
||||
|
||||
struct FVTermPreprocessing
|
||||
{
|
||||
FVTermPreprocessing()
|
||||
: instance(nullptr)
|
||||
, function(nullptr)
|
||||
{ }
|
||||
|
||||
FVTermPreprocessing (const FVTerm* i, const FPreprocessingFunction& f)
|
||||
: instance(i)
|
||||
, function(f)
|
||||
{ }
|
||||
|
||||
const FVTerm* instance;
|
||||
FPreprocessingFunction function;
|
||||
};
|
||||
struct FVTermPreprocessing; // forward declaration
|
||||
|
||||
typedef std::vector<FVTermPreprocessing> FPreprocessing;
|
||||
|
||||
|
@ -527,14 +512,17 @@ struct FVTerm::FTermArea // define virtual terminal character properties
|
|||
public:
|
||||
// Constructor
|
||||
FTermArea() = default;
|
||||
|
||||
// Disable copy constructor
|
||||
FTermArea (const FTermArea&) = delete;
|
||||
|
||||
// Destructor
|
||||
~FTermArea() = default;
|
||||
|
||||
// Disable assignment operator (=)
|
||||
FTermArea& operator = (const FTermArea&) = delete;
|
||||
|
||||
// Data members
|
||||
int offset_left{0}; // Distance from left terminal side
|
||||
int offset_top{0}; // Distance from top of the terminal
|
||||
int width{-1}; // Window width
|
||||
|
@ -555,6 +543,63 @@ struct FVTerm::FTermArea // define virtual terminal character properties
|
|||
};
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// struct FVTerm::FVTermPreprocessing
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
struct FVTerm::FVTermPreprocessing
|
||||
{
|
||||
// Constructor
|
||||
FVTermPreprocessing()
|
||||
: instance(nullptr)
|
||||
, function(nullptr)
|
||||
{ }
|
||||
|
||||
FVTermPreprocessing (const FVTerm* i, const FPreprocessingFunction& f)
|
||||
: instance(i)
|
||||
, function(f)
|
||||
{ }
|
||||
|
||||
FVTermPreprocessing (const FVTermPreprocessing& p) // copy constructor
|
||||
: instance(p.instance)
|
||||
, function(p.function)
|
||||
{ }
|
||||
|
||||
FVTermPreprocessing (FVTermPreprocessing&& p) noexcept // move constructor
|
||||
: instance(p.instance)
|
||||
, function(p.function)
|
||||
{
|
||||
p.instance = nullptr;
|
||||
p.function = nullptr;
|
||||
}
|
||||
|
||||
// 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
|
||||
const FVTerm* instance{};
|
||||
FPreprocessingFunction function{};
|
||||
};
|
||||
|
||||
|
||||
// FVTerm inline functions
|
||||
//----------------------------------------------------------------------
|
||||
template <typename typeT>
|
||||
|
|
|
@ -340,27 +340,7 @@ class FWidget : public FVTerm, public FObject
|
|||
static void quit();
|
||||
|
||||
protected:
|
||||
struct FCallbackData
|
||||
{
|
||||
FCallbackData()
|
||||
: cb_signal()
|
||||
, cb_instance(nullptr)
|
||||
, cb_function()
|
||||
, data(nullptr)
|
||||
{ }
|
||||
|
||||
FCallbackData (FString s, FWidget* i, FCallback c, FDataPtr d)
|
||||
: cb_signal(s)
|
||||
, cb_instance(i)
|
||||
, cb_function(c)
|
||||
, data(d)
|
||||
{ }
|
||||
|
||||
FString cb_signal;
|
||||
FWidget* cb_instance;
|
||||
FCallback cb_function;
|
||||
FDataPtr data;
|
||||
};
|
||||
struct FCallbackData; // forward declaration
|
||||
|
||||
// Typedefs
|
||||
typedef std::vector<FCallbackData> FCallbackObjects;
|
||||
|
@ -537,6 +517,79 @@ class FWidget : public FVTerm, public FObject
|
|||
friend void clearFlatBorder (FWidget*);
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// struct FWidget::FCallbackData
|
||||
//----------------------------------------------------------------------
|
||||
struct FWidget::FCallbackData
|
||||
{
|
||||
// Constructor
|
||||
FCallbackData()
|
||||
: cb_signal()
|
||||
, cb_instance(nullptr)
|
||||
, cb_function()
|
||||
, data(nullptr)
|
||||
{ }
|
||||
|
||||
FCallbackData (FString s, FWidget* i, FCallback c, FDataPtr d)
|
||||
: cb_signal(s)
|
||||
, cb_instance(i)
|
||||
, cb_function(c)
|
||||
, data(d)
|
||||
{ }
|
||||
|
||||
FCallbackData (const FCallbackData& c) // copy constructor
|
||||
: cb_signal(c.cb_signal)
|
||||
, cb_instance(c.cb_instance)
|
||||
, cb_function(c.cb_function)
|
||||
, data(c.data)
|
||||
{ }
|
||||
|
||||
FCallbackData (FCallbackData&& c) noexcept // move constructor
|
||||
: cb_signal(c.cb_signal)
|
||||
, cb_instance(c.cb_instance)
|
||||
, cb_function(c.cb_function)
|
||||
, data(c.data)
|
||||
{
|
||||
c.cb_signal.clear();
|
||||
c.cb_instance = nullptr;
|
||||
c.cb_function = nullptr;
|
||||
c.data = nullptr;
|
||||
}
|
||||
|
||||
// Destructor
|
||||
~FCallbackData()
|
||||
{ }
|
||||
|
||||
// Overloaded operators
|
||||
FCallbackData& operator = (const FCallbackData& c)
|
||||
{
|
||||
cb_signal = c.cb_signal;
|
||||
cb_instance = c.cb_instance;
|
||||
cb_function = c.cb_function;
|
||||
data = c.data;
|
||||
return *this;
|
||||
}
|
||||
|
||||
FCallbackData& operator = (FCallbackData&& c) noexcept
|
||||
{
|
||||
cb_signal = c.cb_signal;
|
||||
cb_instance = c.cb_instance;
|
||||
cb_function = c.cb_function;
|
||||
data = c.data;
|
||||
c.cb_signal.clear();
|
||||
c.cb_instance = nullptr;
|
||||
c.cb_function = nullptr;
|
||||
c.data = nullptr;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Data members
|
||||
FString cb_signal{};
|
||||
FWidget* cb_instance{};
|
||||
FCallback cb_function{};
|
||||
FDataPtr data{};
|
||||
};
|
||||
|
||||
|
||||
// non-member function forward declarations
|
||||
// implemented in fwidget_functions.cpp
|
||||
|
|
|
@ -56,12 +56,12 @@ class SGRoptimizer final
|
|||
// Constructors
|
||||
explicit SGRoptimizer (attributebuffer&);
|
||||
|
||||
// Destructor
|
||||
~SGRoptimizer();
|
||||
|
||||
// Disable copy constructor
|
||||
SGRoptimizer (const SGRoptimizer&) = delete;
|
||||
|
||||
// Destructor
|
||||
~SGRoptimizer();
|
||||
|
||||
// Disable assignment operator (=)
|
||||
SGRoptimizer& operator = (const SGRoptimizer&) = delete;
|
||||
|
||||
|
|
Loading…
Reference in New Issue