Improvement of the move semantics in FVTermPreprocessing

This commit is contained in:
Markus Gans 2020-12-03 23:20:33 +01:00
parent 4517038521
commit 226663889b
31 changed files with 125 additions and 141 deletions

View File

@ -478,7 +478,7 @@ void FListViewItem::resetVisibleLineCounter()
// constructor and destructor // constructor and destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FListViewIterator::FListViewIterator (iterator iter) FListViewIterator::FListViewIterator (Iterator iter)
: node{iter} : node{iter}
{ } { }
@ -533,7 +533,7 @@ FListViewIterator& FListViewIterator::operator -= (int n)
// private methods of FListViewIterator // private methods of FListViewIterator
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FListViewIterator::nextElement (iterator& iter) void FListViewIterator::nextElement (Iterator& iter)
{ {
const auto& item = static_cast<FListViewItem*>(*iter); const auto& item = static_cast<FListViewItem*>(*iter);
@ -570,7 +570,7 @@ void FListViewIterator::nextElement (iterator& iter)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FListViewIterator::prevElement (iterator& iter) void FListViewIterator::prevElement (Iterator& iter)
{ {
auto start_iter = iter; auto start_iter = iter;

View File

@ -130,7 +130,7 @@ bool FTermLinux::setPalette (FColor, int, int, int)
#endif #endif
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FTermLinux::isLinuxConsole() bool FTermLinux::isLinuxConsole() const
{ {
// Check if it's a Linux console // Check if it's a Linux console
@ -484,7 +484,7 @@ FKey FTermLinux::modifierKeyCorrection (const FKey& key_id)
// private methods of FTermLinux // private methods of FTermLinux
//---------------------------------------------------------------------- //----------------------------------------------------------------------
int FTermLinux::getFramebuffer_bpp() int FTermLinux::getFramebuffer_bpp() const
{ {
int fd{-1}; int fd{-1};
const char* fb = "/dev/fb/0"; const char* fb = "/dev/fb/0";
@ -707,7 +707,7 @@ int FTermLinux::setScreenFont ( const uChar fontdata[], uInt count
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
int FTermLinux::setUnicodeMap (struct unimapdesc* unimap) int FTermLinux::setUnicodeMap (struct unimapdesc* unimap) const
{ {
struct unimapinit advice; struct unimapinit advice;
const int fd_tty = FTerm::getTTYFileDescriptor(); const int fd_tty = FTerm::getTTYFileDescriptor();
@ -751,7 +751,7 @@ void FTermLinux::setLinuxCursorStyle (CursorStyle style) const
#if defined(ISA_SYSCTL_SUPPORT) #if defined(ISA_SYSCTL_SUPPORT)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline uInt16 FTermLinux::getInputStatusRegisterOne() inline uInt16 FTermLinux::getInputStatusRegisterOne() const
{ {
// Gets the VGA input-status-register-1 // Gets the VGA input-status-register-1
@ -1271,7 +1271,7 @@ FKey FTermLinux::shiftCtrlAltKeyCorrection (const FKey& key_id) const
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FTermLinux::initSpecialCharacter() inline void FTermLinux::initSpecialCharacter() const
{ {
const auto& fterm_data = FTerm::getFTermData(); const auto& fterm_data = FTerm::getFTermData();
const wchar_t c1 = fc::UpperHalfBlock; const wchar_t c1 = fc::UpperHalfBlock;
@ -1311,7 +1311,7 @@ sInt16 FTermLinux::getFontPos (wchar_t ucs) const
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermLinux::characterFallback ( wchar_t ucs void FTermLinux::characterFallback ( wchar_t ucs
, std::vector<wchar_t> fallback ) , std::vector<wchar_t> fallback ) const
{ {
constexpr sInt16 NOT_FOUND = -1; constexpr sInt16 NOT_FOUND = -1;
const auto& fterm_data = FTerm::getFTermData(); const auto& fterm_data = FTerm::getFTermData();

View File

@ -298,14 +298,14 @@ bool FVTerm::updateTerminal() const
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FVTerm::addPreprocessingHandler ( const FVTerm* instance void FVTerm::addPreprocessingHandler ( const FVTerm* instance
, const FPreprocessingFunction& function ) , FPreprocessingFunction&& function )
{ {
if ( ! print_area ) if ( ! print_area )
FVTerm::getPrintArea(); FVTerm::getPrintArea();
if ( print_area ) if ( print_area )
{ {
FVTermPreprocessing obj{ instance, function }; FVTermPreprocessing obj{ instance, std::move(function) };
delPreprocessingHandler (instance); delPreprocessingHandler (instance);
print_area->preproc_list.emplace_back(std::move(obj)); print_area->preproc_list.emplace_back(std::move(obj));
} }
@ -325,7 +325,7 @@ void FVTerm::delPreprocessingHandler (const FVTerm* instance)
while ( iter != print_area->preproc_list.end() ) while ( iter != print_area->preproc_list.end() )
{ {
if ( iter->instance.get() == instance ) if ( iter->instance.get() == instance )
iter = std::move(print_area->preproc_list.erase(iter)); iter = print_area->preproc_list.erase(iter);
else else
++iter; ++iter;
} }

View File

@ -1149,12 +1149,12 @@ FVTerm::FTermArea* FWidget::getPrintArea()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FWidget::addPreprocessingHandler ( const FVTerm* instance void FWidget::addPreprocessingHandler ( const FVTerm* instance
, const FPreprocessingFunction& function ) , FPreprocessingFunction&& function )
{ {
if ( ! getCurrentPrintArea() ) if ( ! getCurrentPrintArea() )
FWidget::getPrintArea(); FWidget::getPrintArea();
FVTerm::addPreprocessingHandler (instance, function); FVTerm::addPreprocessingHandler (instance, std::move(function));
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -1781,8 +1781,6 @@ void FWidget::finish()
delete window_list; delete window_list;
window_list = nullptr; window_list = nullptr;
} }
destroyColorTheme();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -2061,13 +2059,6 @@ void FWidget::initColorTheme()
} }
} }
//----------------------------------------------------------------------
void FWidget::destroyColorTheme()
{
const FWidgetColorsPtr* theme = &(getColorTheme());
delete theme;
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FWidget::removeQueuedEvent() const void FWidget::removeQueuedEvent() const
{ {

View File

@ -162,7 +162,7 @@ class FApplication : public FWidget
using CmdOption = struct option; using CmdOption = struct option;
#endif #endif
// Typedefs // Using-declaration
using EventPair = std::pair<FObject*, FEvent*>; using EventPair = std::pair<FObject*, FEvent*>;
using FEventQueue = std::deque<EventPair>; using FEventQueue = std::deque<EventPair>;
using CmdMap = std::unordered_map<int, std::function<void(char*)>>; using CmdMap = std::unordered_map<int, std::function<void(char*)>>;

View File

@ -211,8 +211,8 @@ class FCallback
void emitCallback (const FString& emit_signal) const; void emitCallback (const FString& emit_signal) const;
private: private:
// Typedefs // Using-declaration
typedef std::vector<FCallbackData> FCallbackObjects; using FCallbackObjects = std::vector<FCallbackData>;
// Data members // Data members
FCallbackObjects callback_objects{}; FCallbackObjects callback_objects{};

View File

@ -49,8 +49,8 @@ namespace finalcut
class FColorPalette class FColorPalette
{ {
public: public:
// Typedef // Using-declaration
typedef std::function<void(FColor, int, int, int)> FSetPalette; using FSetPalette = std::function<void(FColor, int, int, int)>;
// Constructor // Constructor
explicit FColorPalette (const FSetPalette&); explicit FColorPalette (const FSetPalette&);

View File

@ -155,15 +155,14 @@ class FDialog : public FWindow
void onClose (FCloseEvent*) override; void onClose (FCloseEvent*) override;
private: private:
// Typedef struct MouseStates
typedef struct
{ {
int mouse_x; int mouse_x;
int mouse_y; int mouse_y;
FPoint termPos; FPoint termPos;
std::size_t zoom_btn; std::size_t zoom_btn;
bool mouse_over_menu; bool mouse_over_menu;
} MouseStates; };
// Constant // Constant
static constexpr std::size_t MENU_BTN = 3; static constexpr std::size_t MENU_BTN = 3;

View File

@ -138,7 +138,6 @@ class FFileDialog : public FDialog
void adjustSize() override; void adjustSize() override;
private: private:
// Typedef
struct FDirEntry struct FDirEntry
{ {
// Constructor // Constructor
@ -183,7 +182,7 @@ class FFileDialog : public FDialog
uChar : 1; // padding bits uChar : 1; // padding bits
}; };
typedef std::vector<FDirEntry> DirEntries; using DirEntries = std::vector<FDirEntry>;
// Methods // Methods
void init(); void init();

View File

@ -88,8 +88,8 @@ class FKeyboard final
// Constants // Constants
static constexpr std::size_t FIFO_BUF_SIZE{512}; static constexpr std::size_t FIFO_BUF_SIZE{512};
// Typedef // Using-declaration
typedef char keybuffer[FIFO_BUF_SIZE]; using keybuffer = char[FIFO_BUF_SIZE];
// Constructor // Constructor
FKeyboard(); FKeyboard();

View File

@ -169,9 +169,7 @@ class FListBox : public FWidget
public: public:
// Using-declaration // Using-declaration
using FWidget::setGeometry; using FWidget::setGeometry;
using FListBoxItems = std::vector<FListBoxItem>;
// Typedef
typedef std::vector<FListBoxItem> FListBoxItems;
// Constructor // Constructor
explicit FListBox (FWidget* = nullptr); explicit FListBox (FWidget* = nullptr);
@ -276,10 +274,10 @@ class FListBox : public FWidget
void adjustSize() override; void adjustSize() override;
private: private:
// Typedefs // Using-declaration
typedef std::unordered_map<int, std::function<void()>> KeyMap; using KeyMap = std::unordered_map<int, std::function<void()>>;
typedef std::unordered_map<int, std::function<bool()>> KeyMapResult; using KeyMapResult = std::unordered_map<int, std::function<bool()>>;
typedef std::function<void(FListBoxItem&, FDataAccess*, std::size_t)> LazyInsert; using LazyInsert = std::function<void(FListBoxItem&, FDataAccess*, std::size_t)>;
// Enumeration // Enumeration
enum convert_type enum convert_type

View File

@ -48,6 +48,7 @@
#endif #endif
#include <list> #include <list>
#include <iterator>
#include <memory> #include <memory>
#include <stack> #include <stack>
#include <unordered_map> #include <unordered_map>
@ -215,16 +216,19 @@ class FListViewIterator
public: public:
// Using-declarations // Using-declarations
using FObjectList = std::list<FObject*>; using FObjectList = std::list<FObject*>;
using iterator = FObjectList::iterator; using Iterator = FObjectList::iterator;
using iterator_stack = std::stack<iterator>; using IteratorStack = std::stack<Iterator>;
// Constructor // Constructor
FListViewIterator () = default; FListViewIterator () = default;
FListViewIterator (iterator); FListViewIterator (Iterator);
FListViewIterator (const FListViewIterator&) = default; FListViewIterator (const FListViewIterator&) = default;
FListViewIterator (FListViewIterator&& ) FListViewIterator (FListViewIterator&& i) noexcept
noexcept (std::is_nothrow_move_constructible<FListViewIterator>::value) : iter_path{std::move(i.iter_path)}
= default; , node{i.node}
, position{i.position}
{ }
// Overloaded operators // Overloaded operators
FListViewIterator& operator = (const FListViewIterator&) = default; FListViewIterator& operator = (const FListViewIterator&) = default;
FListViewIterator& operator = (FListViewIterator&&) noexcept = default; FListViewIterator& operator = (FListViewIterator&&) noexcept = default;
@ -248,12 +252,12 @@ class FListViewIterator
private: private:
// Methods // Methods
void nextElement (iterator&); void nextElement (Iterator&);
void prevElement (iterator&); void prevElement (Iterator&);
// Data members // Data members
iterator_stack iter_path{}; IteratorStack iter_path{};
iterator node{}; Iterator node{};
int position{0}; int position{0};
}; };
@ -293,9 +297,7 @@ class FListView : public FWidget
public: public:
// Using-declaration // Using-declaration
using FWidget::setGeometry; using FWidget::setGeometry;
using FListViewItems = std::list<FListViewItem*>;
// Typedef
typedef std::list<FListViewItem*> FListViewItems;
// Constructor // Constructor
explicit FListView (FWidget* = nullptr); explicit FListView (FWidget* = nullptr);
@ -401,18 +403,17 @@ class FListView : public FWidget
void adjustSize() override; void adjustSize() override;
private: private:
// Typedefs struct Header; // forward declaration
typedef std::unordered_map<int, std::function<void()>> KeyMap;
typedef std::unordered_map<int, std::function<bool()>> KeyMapResult; // Using-declaration
using KeyMap = std::unordered_map<int, std::function<void()>>;
using KeyMapResult = std::unordered_map<int, std::function<bool()>>;
using HeaderItems = std::vector<Header>;
using SortTypes = std::vector<fc::sorting_type>;
// Constants // Constants
static constexpr std::size_t checkbox_space = 4; static constexpr std::size_t checkbox_space = 4;
// Typedef
struct Header; // forward declaration
typedef std::vector<Header> HeaderItems;
typedef std::vector<fc::sorting_type> SortTypes;
// Constants // Constants
static constexpr int USE_MAX_SIZE = -1; static constexpr int USE_MAX_SIZE = -1;

View File

@ -132,12 +132,7 @@ class FMenu : public FWindow, public FMenuList
void cb_menuitemToggled (const FMenuItem*) const; void cb_menuitemToggled (const FMenuItem*) const;
private: private:
// Constants struct MouseStates
static constexpr auto NOT_SET = static_cast<std::size_t>(-1);
static constexpr bool SELECT_ITEM = true;
// Typedef
typedef struct
{ {
uChar focus_changed : 1; uChar focus_changed : 1;
uChar hide_sub_menu : 1; uChar hide_sub_menu : 1;
@ -146,14 +141,18 @@ class FMenu : public FWindow, public FMenuList
uChar mouse_over_supermenu : 1; uChar mouse_over_supermenu : 1;
uChar mouse_over_menubar : 1; uChar mouse_over_menubar : 1;
uChar : 2; // padding bits uChar : 2; // padding bits
} MouseStates; };
typedef struct struct MenuText
{ {
FString text; FString text;
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);
static constexpr bool SELECT_ITEM = true;
// Accessors // Accessors
FWidget* getSuperMenu() const; FWidget* getSuperMenu() const;

View File

@ -122,8 +122,7 @@ class FMouseData
void clearButtonState(); void clearButtonState();
protected: protected:
// Typedef and Enumerations struct FMouseButton // bit field
typedef struct
{ {
uChar left_button : 2; // 0..3 uChar left_button : 2; // 0..3
uChar right_button : 2; // 0..3 uChar right_button : 2; // 0..3
@ -135,8 +134,9 @@ class FMouseData
uChar wheel_down : 1; // 0..1 uChar wheel_down : 1; // 0..1
uChar mouse_moved : 1; // 0..1 uChar mouse_moved : 1; // 0..1
uChar : 4; // padding bits uChar : 4; // padding bits
} FMouseButton; // bit field };
// Enumerations
enum states enum states
{ {
Undefined = 0, Undefined = 0,

View File

@ -159,15 +159,16 @@ class FOptiAttr final
const char* changeAttribute (FChar&, FChar&); const char* changeAttribute (FChar&, FChar&);
private: private:
// Typedefs and Enumerations struct Capability
typedef SGRoptimizer::AttributeBuffer AttributeBuffer;
typedef struct
{ {
const char* cap; const char* cap;
bool caused_reset; bool caused_reset;
} Capability; };
// Using-declaration
using AttributeBuffer = SGRoptimizer::AttributeBuffer;
// Enumerations
enum init_reset_tests enum init_reset_tests
{ {
no_test = 0x00, no_test = 0x00,

View File

@ -57,8 +57,7 @@ namespace finalcut
class FOptiMove final class FOptiMove final
{ {
public: public:
// Typedef struct TermEnv
typedef struct
{ {
const char* t_cursor_home; const char* t_cursor_home;
const char* t_carriage_return; const char* t_carriage_return;
@ -83,7 +82,7 @@ class FOptiMove final
int tabstop; int tabstop;
bool automatic_left_margin; bool automatic_left_margin;
bool eat_nl_glitch; bool eat_nl_glitch;
} TermEnv; };
// Constructor // Constructor
explicit FOptiMove (int = 0); explicit FOptiMove (int = 0);
@ -147,16 +146,15 @@ class FOptiMove final
const char* moveCursor (int, int, int, int); const char* moveCursor (int, int, int, int);
private: private:
// Constant struct Capability
static constexpr std::size_t BUF_SIZE{512};
// Typedef
typedef struct
{ {
const char* cap; const char* cap;
int duration; int duration;
int length; int length;
} Capability; };
// Constant
static constexpr std::size_t BUF_SIZE{512};
// Constants // Constants
static constexpr int LONG_DURATION{INT_MAX}; static constexpr int LONG_DURATION{INT_MAX};

View File

@ -149,8 +149,8 @@ class FScrollView : public FWidget
void copy2area(); void copy2area();
private: private:
// Typedefs // Using-declaration
typedef std::unordered_map<int, std::function<void()>> KeyMap; using KeyMap = std::unordered_map<int, std::function<void()>>;
// Constants // Constants
static constexpr int vertical_border_spacing = 2; static constexpr int vertical_border_spacing = 2;

View File

@ -230,8 +230,8 @@ class FStatusBar : public FWindow
void cb_statuskey_activated (const FStatusKey*); void cb_statuskey_activated (const FStatusKey*);
private: private:
// Typedef // Using-declaration
typedef std::vector<FStatusKey*> FKeyList; using FKeyList = std::vector<FStatusKey*>;
// Methods // Methods
void init(); void init();

View File

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

View File

@ -251,7 +251,7 @@ class FTerm final
static bool canChangeColorPalette(); static bool canChangeColorPalette();
// Mutators // Mutators
static void setFSystem (std::unique_ptr<FSystem>&&); static void setFSystem (std::unique_ptr<FSystem>&);
static void setTermType (const char[]); static void setTermType (const char[]);
static void setInsertCursor (bool); static void setInsertCursor (bool);
static void setInsertCursor(); static void setInsertCursor();
@ -391,7 +391,7 @@ inline FString FTerm::getClassName()
{ return "FTerm"; } { return "FTerm"; }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FTerm::setFSystem (std::unique_ptr<FSystem>&& fsystem) inline void FTerm::setFSystem (std::unique_ptr<FSystem>& fsystem)
{ {
getFSystem().swap(fsystem); getFSystem().swap(fsystem);
} }

View File

@ -75,13 +75,11 @@ namespace finalcut
class FTermcap final class FTermcap final
{ {
public: public:
// Typedef struct TCapMap
typedef struct
{ {
const char* string; const char* string;
char tname[alignof(char*)]; char tname[alignof(char*)];
} };
TCapMap;
// Using-declaration // Using-declaration
using fn_putc = int (*)(int); using fn_putc = int (*)(int);

View File

@ -53,8 +53,8 @@ namespace finalcut
class FTermData final class FTermData final
{ {
public: public:
// Typedefs // Using-declaration
typedef std::unordered_map<std::string, fc::encoding> EncodingMap; using EncodingMap = std::unordered_map<std::string, fc::encoding>;
// Constructors // Constructors
FTermData () = default; FTermData () = default;

View File

@ -99,7 +99,7 @@ class FTermLinux final
void setUTF8 (bool) const; void setUTF8 (bool) const;
// Inquiries // Inquiries
bool isLinuxConsole(); bool isLinuxConsole() const;
bool isVGAFontUsed() const; bool isVGAFontUsed() const;
bool isNewFontUsed() const; bool isNewFontUsed() const;
@ -140,7 +140,7 @@ class FTermLinux final
}; };
// Accessors // Accessors
int getFramebuffer_bpp(); int getFramebuffer_bpp() const;
bool getScreenFont(); bool getScreenFont();
bool getUnicodeMap (); bool getUnicodeMap ();
ModifierKey& getModifierKey(); ModifierKey& getModifierKey();
@ -148,12 +148,12 @@ class FTermLinux final
// Mutators // Mutators
int setScreenFont ( const uChar[], uInt, uInt, uInt int setScreenFont ( const uChar[], uInt, uInt, uInt
, bool = false ); , bool = false );
int setUnicodeMap (struct unimapdesc*); int setUnicodeMap (struct unimapdesc*) const;
void setLinuxCursorStyle (fc::linuxConsoleCursorStyle) const; void setLinuxCursorStyle (fc::linuxConsoleCursorStyle) const;
// Methods // Methods
#if defined(ISA_SYSCTL_SUPPORT) #if defined(ISA_SYSCTL_SUPPORT)
uInt16 getInputStatusRegisterOne(); uInt16 getInputStatusRegisterOne() const;
uChar readAttributeController (uChar); uChar readAttributeController (uChar);
void writeAttributeController (uChar, uChar); void writeAttributeController (uChar, uChar);
uChar getAttributeMode(); uChar getAttributeMode();
@ -174,8 +174,8 @@ class FTermLinux final
FKey ctrlAltKeyCorrection (const FKey&) const; FKey ctrlAltKeyCorrection (const FKey&) const;
FKey shiftCtrlAltKeyCorrection (const FKey&) const; FKey shiftCtrlAltKeyCorrection (const FKey&) const;
sInt16 getFontPos (wchar_t ucs) const; sInt16 getFontPos (wchar_t ucs) const;
void initSpecialCharacter(); void initSpecialCharacter() const;
void characterFallback (wchar_t, std::vector<wchar_t>); void characterFallback (wchar_t, std::vector<wchar_t>) const;
// Data members // Data members
#if defined(__linux__) #if defined(__linux__)

View File

@ -47,7 +47,7 @@
#define WSKBD_BELL_DOVOLUME 0x4 // get/set volume #define WSKBD_BELL_DOVOLUME 0x4 // get/set volume
#define WSKBD_BELL_DOALL 0x7 // all of the above #define WSKBD_BELL_DOALL 0x7 // all of the above
typedef uInt32 kbd_t; using kbd_t = uInt32;
struct wskbd_bell_data struct wskbd_bell_data
{ {

View File

@ -137,8 +137,8 @@ class FTextView : public FWidget
void adjustSize() override; void adjustSize() override;
private: private:
// Typedefs // Using-declaration
typedef std::unordered_map<int, std::function<void()>> KeyMap; using KeyMap = std::unordered_map<int, std::function<void()>>;
// Accessors // Accessors
std::size_t getTextHeight() const; std::size_t getTextHeight() const;

View File

@ -253,7 +253,7 @@ class FVTerm
void putVTerm() const; void putVTerm() const;
bool updateTerminal() const; bool updateTerminal() const;
virtual void addPreprocessingHandler ( const FVTerm* virtual void addPreprocessingHandler ( const FVTerm*
, const FPreprocessingFunction& ); , FPreprocessingFunction&& );
virtual void delPreprocessingHandler (const FVTerm*); virtual void delPreprocessingHandler (const FVTerm*);
template <typename... Args> template <typename... Args>
int printf (const FString&, Args&&...); int printf (const FString&, Args&&...);
@ -491,7 +491,9 @@ struct FVTerm::FTermArea // define virtual terminal character properties
struct D struct D
{ {
void operator () (const FVTerm*) const void operator () (const FVTerm*) const
{ } {
// No deleting of pointer objects when exiting the std::unique_ptr
}
}; };
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -501,9 +503,9 @@ struct D
struct FVTerm::FVTermPreprocessing struct FVTerm::FVTermPreprocessing
{ {
// Constructor // Constructor
FVTermPreprocessing (const FVTerm* i, const FPreprocessingFunction& f) FVTermPreprocessing (const FVTerm* i, FPreprocessingFunction&& f)
: instance(std::unique_ptr<const FVTerm, D>(i)) : instance(std::unique_ptr<const FVTerm, D>(i))
, function(f) , function(std::move(f))
{ } { }
FVTermPreprocessing (const FVTermPreprocessing&) = delete; FVTermPreprocessing (const FVTermPreprocessing&) = delete;

View File

@ -136,7 +136,6 @@ class FWidget : public FVTerm, public FObject
using FVTerm::print; using FVTerm::print;
using FWidgetList = std::vector<FWidget*>; using FWidgetList = std::vector<FWidget*>;
using FAcceleratorList = std::vector<FAccelerator>; using FAcceleratorList = std::vector<FAccelerator>;
using FWidgetColorsPtr = std::shared_ptr<FWidgetColors>;
struct FWidgetFlags // Properties of a widget ⚑ struct FWidgetFlags // Properties of a widget ⚑
{ {
@ -187,7 +186,7 @@ class FWidget : public FVTerm, public FObject
static FWidgetList*& getWindowList(); static FWidgetList*& getWindowList();
static FMenuBar* getMenuBar(); static FMenuBar* getMenuBar();
static FStatusBar* getStatusBar(); static FStatusBar* getStatusBar();
static FWidgetColorsPtr& getColorTheme(); static auto getColorTheme() -> std::shared_ptr<FWidgetColors>&;
virtual FWidget* getFirstFocusableWidget (FObjectList); virtual FWidget* getFirstFocusableWidget (FObjectList);
virtual FWidget* getLastFocusableWidget (FObjectList); virtual FWidget* getLastFocusableWidget (FObjectList);
const FAcceleratorList& getAcceleratorList() const; const FAcceleratorList& getAcceleratorList() const;
@ -338,7 +337,7 @@ class FWidget : public FVTerm, public FObject
static FWidgetList*& getAlwaysOnTopList(); static FWidgetList*& getAlwaysOnTopList();
static FWidgetList*& getWidgetCloseList(); static FWidgetList*& getWidgetCloseList();
void addPreprocessingHandler ( const FVTerm* void addPreprocessingHandler ( const FVTerm*
, const FPreprocessingFunction& ) override; , FPreprocessingFunction&& ) override;
void delPreprocessingHandler (const FVTerm*) override; void delPreprocessingHandler (const FVTerm*) override;
// Inquiry // Inquiry
@ -443,7 +442,6 @@ class FWidget : public FVTerm, public FObject
void drawChildren(); void drawChildren();
static bool isDefaultTheme(); static bool isDefaultTheme();
static void initColorTheme(); static void initColorTheme();
void destroyColorTheme();
void removeQueuedEvent() const; void removeQueuedEvent() const;
void setStatusbarText (bool) const; void setStatusbarText (bool) const;
@ -573,9 +571,9 @@ inline FStatusBar* FWidget::getStatusBar()
{ return statusbar; } { return statusbar; }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline FWidget::FWidgetColorsPtr& FWidget::getColorTheme() inline auto FWidget::getColorTheme() -> std::shared_ptr<FWidgetColors>&
{ {
static auto color_theme = new FWidgetColorsPtr(); static const auto& color_theme = make_unique<std::shared_ptr<FWidgetColors>>();
return *color_theme; return *color_theme;
} }

View File

@ -51,8 +51,8 @@ class SGRoptimizer final
// Constants // Constants
static constexpr std::size_t ATTR_BUF_SIZE{8192}; static constexpr std::size_t ATTR_BUF_SIZE{8192};
// Typedefs // Using-declaration
typedef std::array<char, ATTR_BUF_SIZE> AttributeBuffer; using AttributeBuffer = std::array<char, ATTR_BUF_SIZE>;
// Constructors // Constructors
explicit SGRoptimizer (AttributeBuffer&); explicit SGRoptimizer (AttributeBuffer&);

View File

@ -623,8 +623,8 @@ void ftermfreebsdTest::freebsdConsoleTest()
setenv ("COLUMNS", "80", 1); setenv ("COLUMNS", "80", 1);
setenv ("LINES", "25", 1); setenv ("LINES", "25", 1);
auto fsys = finalcut::make_unique<test::FSystemTest>(); std::unique_ptr<finalcut::FSystem> fsys = finalcut::make_unique<test::FSystemTest>();
finalcut::FTerm::setFSystem(std::move(fsys)); finalcut::FTerm::setFSystem(fsys);
std::cout << "\n"; std::cout << "\n";
const auto& data = finalcut::FTerm::getFTermData(); const auto& data = finalcut::FTerm::getFTermData();

View File

@ -1559,8 +1559,8 @@ void FTermLinuxTest::classNameTest()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermLinuxTest::linuxConsoleTest() void FTermLinuxTest::linuxConsoleTest()
{ {
auto fsys = finalcut::make_unique<test::FSystemTest>(); std::unique_ptr<finalcut::FSystem> fsys = finalcut::make_unique<test::FSystemTest>();
finalcut::FTerm::setFSystem(std::move(fsys)); finalcut::FTerm::setFSystem(fsys);
std::cout << "\n"; std::cout << "\n";
const auto& data = finalcut::FTerm::getFTermData(); const auto& data = finalcut::FTerm::getFTermData();
@ -1681,8 +1681,8 @@ void FTermLinuxTest::linuxConsoleTest()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermLinuxTest::linuxCursorStyleTest() void FTermLinuxTest::linuxCursorStyleTest()
{ {
auto fsys = finalcut::make_unique<test::FSystemTest>(); std::unique_ptr<finalcut::FSystem> fsys = finalcut::make_unique<test::FSystemTest>();
finalcut::FTerm::setFSystem(std::move(fsys)); finalcut::FTerm::setFSystem(fsys);
std::cout << "\n"; std::cout << "\n";
const auto& data = finalcut::FTerm::getFTermData(); const auto& data = finalcut::FTerm::getFTermData();
@ -1870,8 +1870,8 @@ void FTermLinuxTest::linuxCursorStyleTest()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermLinuxTest::linuxColorPaletteTest() void FTermLinuxTest::linuxColorPaletteTest()
{ {
auto fsys = finalcut::make_unique<test::FSystemTest>(); std::unique_ptr<finalcut::FSystem> fsys = finalcut::make_unique<test::FSystemTest>();
finalcut::FTerm::setFSystem(std::move(fsys)); finalcut::FTerm::setFSystem(fsys);
std::cout << "\n"; std::cout << "\n";
const auto& data = finalcut::FTerm::getFTermData(); const auto& data = finalcut::FTerm::getFTermData();
@ -2145,8 +2145,8 @@ void FTermLinuxTest::linuxColorPaletteTest()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermLinuxTest::linuxFontTest() void FTermLinuxTest::linuxFontTest()
{ {
auto fsys = finalcut::make_unique<test::FSystemTest>(); std::unique_ptr<finalcut::FSystem> fsys = finalcut::make_unique<test::FSystemTest>();
finalcut::FTerm::setFSystem(std::move(fsys)); finalcut::FTerm::setFSystem(fsys);
std::cout << "\n"; std::cout << "\n";
const auto& data = finalcut::FTerm::getFTermData(); const auto& data = finalcut::FTerm::getFTermData();
@ -2288,8 +2288,8 @@ void FTermLinuxTest::linuxFontTest()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermLinuxTest::modifierKeyTest() void FTermLinuxTest::modifierKeyTest()
{ {
auto fsys = finalcut::make_unique<test::FSystemTest>(); std::unique_ptr<finalcut::FSystem> fsys = finalcut::make_unique<test::FSystemTest>();
finalcut::FTerm::setFSystem(std::move(fsys)); finalcut::FTerm::setFSystem(fsys);
const auto& fsystem = finalcut::FTerm::getFSystem(); const auto& fsystem = finalcut::FTerm::getFSystem();
auto fsystest = static_cast<test::FSystemTest*>(fsystem.get()); auto fsystest = static_cast<test::FSystemTest*>(fsystem.get());

View File

@ -345,8 +345,8 @@ void ftermopenbsdTest::classNameTest()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void ftermopenbsdTest::netbsdConsoleTest() void ftermopenbsdTest::netbsdConsoleTest()
{ {
auto fsys = finalcut::make_unique<test::FSystemTest>(); std::unique_ptr<finalcut::FSystem> fsys = finalcut::make_unique<test::FSystemTest>();
finalcut::FTerm::setFSystem(std::move(fsys)); finalcut::FTerm::setFSystem(fsys);
std::cout << "\n"; std::cout << "\n";
const auto& data = finalcut::FTerm::getFTermData(); const auto& data = finalcut::FTerm::getFTermData();
@ -449,8 +449,8 @@ void ftermopenbsdTest::netbsdConsoleTest()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void ftermopenbsdTest::openbsdConsoleTest() void ftermopenbsdTest::openbsdConsoleTest()
{ {
auto fsys = finalcut::make_unique<test::FSystemTest>(); std::unique_ptr<finalcut::FSystem> fsys = finalcut::make_unique<test::FSystemTest>();
finalcut::FTerm::setFSystem(std::move(fsys)); finalcut::FTerm::setFSystem(fsys);
std::cout << "\n"; std::cout << "\n";
const auto& data = finalcut::FTerm::getFTermData(); const auto& data = finalcut::FTerm::getFTermData();