From 361f0e6a1458fd9d817b8baa7879aa5910382a38 Mon Sep 17 00:00:00 2001 From: Markus Gans Date: Sun, 12 Jul 2020 15:25:21 +0200 Subject: [PATCH] More function declared as const --- examples/calculator.cpp | 12 ++++----- examples/event-log.cpp | 4 +-- examples/mouse.cpp | 12 ++++----- examples/rotozoomer.cpp | 4 +-- examples/term-attributes.cpp | 4 +-- examples/ui.cpp | 20 +++++++-------- examples/windows.cpp | 4 +-- src/fapplication.cpp | 36 +++++++++++++-------------- src/fbutton.cpp | 2 +- src/fbuttongroup.cpp | 2 +- src/fcolorpalette.cpp | 2 +- src/fdialog.cpp | 2 +- src/ffiledialog.cpp | 8 +++--- src/fkeyboard.cpp | 8 +++--- src/flabel.cpp | 4 +-- src/flineedit.cpp | 8 +++--- src/flistbox.cpp | 8 +++--- src/flistview.cpp | 14 +++++------ src/flogger.cpp | 4 +-- src/fmenu.cpp | 12 ++++----- src/fmenubar.cpp | 10 ++++---- src/fmenuitem.cpp | 6 ++--- src/fmessagebox.cpp | 2 +- src/fmouse.cpp | 22 ++++++++--------- src/fobject.cpp | 6 ++--- src/foptiattr.cpp | 10 ++++---- src/foptimove.cpp | 8 +++--- src/fscrollbar.cpp | 6 ++--- src/fscrollview.cpp | 8 +++--- src/fstatusbar.cpp | 4 +-- src/fstring.cpp | 39 +++++++++++++++++------------- src/fterm.cpp | 12 ++++----- src/ftermbuffer.cpp | 6 ++--- src/ftermlinux.cpp | 26 ++++++++++---------- src/ftermxterminal.cpp | 2 +- src/ftextview.cpp | 10 ++++---- src/ftogglebutton.cpp | 2 +- src/fvterm.cpp | 26 ++++++++++---------- src/fwidget.cpp | 10 ++++---- src/fwindow.cpp | 2 +- src/include/final/fapplication.h | 36 +++++++++++++-------------- src/include/final/fbutton.h | 2 +- src/include/final/fbuttongroup.h | 2 +- src/include/final/fcolorpalette.h | 2 +- src/include/final/fdata.h | 33 +++++++++++++++++++------ src/include/final/fdialog.h | 2 +- src/include/final/ffiledialog.h | 8 +++--- src/include/final/fkeyboard.h | 14 +++++------ src/include/final/flabel.h | 8 +++--- src/include/final/flineedit.h | 10 ++++---- src/include/final/flistbox.h | 20 +++++++-------- src/include/final/flistview.h | 22 ++++++++--------- src/include/final/flog.h | 8 +++--- src/include/final/flogger.h | 4 +-- src/include/final/fmenu.h | 12 ++++----- src/include/final/fmenubar.h | 10 ++++---- src/include/final/fmenuitem.h | 6 ++--- src/include/final/fmessagebox.h | 2 +- src/include/final/fmouse.h | 26 ++++++++++---------- src/include/final/fobject.h | 6 ++--- src/include/final/foptiattr.h | 10 ++++---- src/include/final/foptimove.h | 8 +++--- src/include/final/fprogressbar.h | 4 +-- src/include/final/fscrollbar.h | 6 ++--- src/include/final/fscrollview.h | 12 ++++----- src/include/final/fspinbox.h | 4 +-- src/include/final/fstatusbar.h | 4 +-- src/include/final/fstring.h | 33 +++++++++++++------------ src/include/final/fterm.h | 18 +++++--------- src/include/final/ftermbuffer.h | 4 +-- src/include/final/ftermdata.h | 8 +++--- src/include/final/ftermlinux.h | 26 ++++++++++---------- src/include/final/ftermxterminal.h | 6 ++--- src/include/final/ftextview.h | 10 ++++---- src/include/final/ftogglebutton.h | 2 +- src/include/final/ftypes.h | 9 ++----- src/include/final/fvterm.h | 35 ++++++++++++++------------- src/include/final/fwidget.h | 28 ++++++++++----------- src/include/final/fwindow.h | 2 +- 79 files changed, 431 insertions(+), 418 deletions(-) diff --git a/examples/calculator.cpp b/examples/calculator.cpp index b637d85d..1c9eb947 100644 --- a/examples/calculator.cpp +++ b/examples/calculator.cpp @@ -207,15 +207,15 @@ class Calc final : public finalcut::FDialog void sine (lDouble&); void cosine (lDouble&); void tangent (lDouble&); - bool isDataEntryKey (int); - bool isOperatorKey (int); + bool isDataEntryKey (int) const; + bool isOperatorKey (int) const; lDouble& getValue(); void setDisplay (lDouble); void setInfixOperator (char); void clearInfixOperator(); void calcInfixOperator(); void adjustSize() override; - const wchar_t* getButtonText (const std::size_t); + const wchar_t* getButtonText (const std::size_t) const; void mapKeyFunctions(); // Data members @@ -941,7 +941,7 @@ void Calc::draw() } //---------------------------------------------------------------------- -bool Calc::isDataEntryKey (int key) +bool Calc::isDataEntryKey (int key) const { // Test if key is in {'.', '0'..'9'} const int data_entry_keys[] = @@ -968,7 +968,7 @@ bool Calc::isDataEntryKey (int key) } //---------------------------------------------------------------------- -bool Calc::isOperatorKey(int key) +bool Calc::isOperatorKey(int key) const { // Test if key is in {'*', '/', '+', '-', '^', '='} const int operators[] = @@ -1091,7 +1091,7 @@ void Calc::adjustSize() } //---------------------------------------------------------------------- -const wchar_t* Calc::getButtonText (const std::size_t key) +const wchar_t* Calc::getButtonText (const std::size_t key) const { static const wchar_t* const button_text[Calc::NUM_OF_BUTTONS] = { diff --git a/examples/event-log.cpp b/examples/event-log.cpp index a7ec3ec2..ee9284c8 100644 --- a/examples/event-log.cpp +++ b/examples/event-log.cpp @@ -58,7 +58,7 @@ class EventDialog final : public finalcut::FDialog private: // Methods - finalcut::FString getMouseButtonName (int); + finalcut::FString getMouseButtonName (int) const; void logMouseEvent ( const finalcut::FString& , const finalcut::FMouseEvent& ); @@ -103,7 +103,7 @@ EventDialog::~EventDialog() // destructor { } //---------------------------------------------------------------------- -finalcut::FString EventDialog::getMouseButtonName (int btn_state) +finalcut::FString EventDialog::getMouseButtonName (int btn_state) const { switch ( btn_state ) { diff --git a/examples/mouse.cpp b/examples/mouse.cpp index 16752c71..0992392b 100644 --- a/examples/mouse.cpp +++ b/examples/mouse.cpp @@ -49,8 +49,8 @@ class ColorChooser final : public finalcut::FWidget ColorChooser& operator = (const ColorChooser&) = delete; // Accessors - FColor getForeground(); - FColor getBackground(); + FColor getForeground() const; + FColor getBackground() const; private: // Mutator @@ -90,13 +90,13 @@ ColorChooser::~ColorChooser() { } //---------------------------------------------------------------------- -inline FColor ColorChooser::getForeground() +inline FColor ColorChooser::getForeground() const { return fg_color; } //---------------------------------------------------------------------- -inline FColor ColorChooser::getBackground() +inline FColor ColorChooser::getBackground() const { return bg_color; } @@ -192,7 +192,7 @@ class Brushes final : public finalcut::FWidget Brushes& operator = (const Brushes&) = delete; // Accessor - wchar_t getBrush(); + wchar_t getBrush() const; // Mutators void setForeground (FColor); @@ -293,7 +293,7 @@ void Brushes::onMouseDown (finalcut::FMouseEvent* ev) } //---------------------------------------------------------------------- -inline wchar_t Brushes::getBrush() +inline wchar_t Brushes::getBrush() const { return brush; } diff --git a/examples/rotozoomer.cpp b/examples/rotozoomer.cpp index 13ab5e1f..99f3d462 100644 --- a/examples/rotozoomer.cpp +++ b/examples/rotozoomer.cpp @@ -52,7 +52,7 @@ class RotoZoomer final : public finalcut::FDialog ~RotoZoomer() override; // Accessors - finalcut::FString getReport(); + finalcut::FString getReport() const; // Event handlers void onShow (finalcut::FShowEvent*) override; @@ -202,7 +202,7 @@ void RotoZoomer::generateReport() } //---------------------------------------------------------------------- -inline finalcut::FString RotoZoomer::getReport() +inline finalcut::FString RotoZoomer::getReport() const { return report; } diff --git a/examples/term-attributes.cpp b/examples/term-attributes.cpp index c7a18c6b..a40a4dd2 100644 --- a/examples/term-attributes.cpp +++ b/examples/term-attributes.cpp @@ -50,7 +50,7 @@ class AttribDlg final : public finalcut::FDialog AttribDlg& operator = (const AttribDlg&) = delete; // Methods - FColor getBGColor(); + FColor getBGColor() const; // Event handlers void onKeyPress (finalcut::FKeyEvent*) override; @@ -105,7 +105,7 @@ AttribDlg::~AttribDlg() { } //---------------------------------------------------------------------- -FColor AttribDlg::getBGColor() +FColor AttribDlg::getBGColor() const { return bgcolor; } diff --git a/examples/ui.cpp b/examples/ui.cpp index f223c5af..9399431e 100644 --- a/examples/ui.cpp +++ b/examples/ui.cpp @@ -301,14 +301,14 @@ class MyDialog final : public finalcut::FDialog void cb_copyClipboard (const finalcut::FWidget*, const FDataPtr); void cb_pasteClipboard (const finalcut::FWidget*, const FDataPtr); void cb_clearInput (const finalcut::FWidget*, const FDataPtr); - void cb_switchTheme (const finalcut::FWidget*, const FDataPtr); - void cb_input2buttonText (finalcut::FWidget*, FDataPtr); + void cb_switchTheme (const finalcut::FWidget*, const FDataPtr) const; + void cb_input2buttonText (finalcut::FWidget*, FDataPtr) const; void cb_setTitlebar (finalcut::FWidget*, const FDataPtr); void cb_showProgressBar (const finalcut::FWidget*, const FDataPtr); - void cb_updateNumber (finalcut::FWidget*, FDataPtr); - void cb_activateButton (finalcut::FWidget*, FDataPtr); + void cb_updateNumber (finalcut::FWidget*, FDataPtr) const; + void cb_activateButton (finalcut::FWidget*, FDataPtr) const; void cb_view (const finalcut::FWidget*, FDataPtr); - void cb_setInput (finalcut::FWidget*, FDataPtr); + void cb_setInput (finalcut::FWidget*, FDataPtr) const; // Data members bool initialized{false}; @@ -916,7 +916,7 @@ void MyDialog::cb_clearInput (const finalcut::FWidget*, const FDataPtr) } //---------------------------------------------------------------------- -void MyDialog::cb_switchTheme (const finalcut::FWidget* widget, const FDataPtr) +void MyDialog::cb_switchTheme (const finalcut::FWidget* widget, const FDataPtr) const { const auto& check_menu = *(static_cast(widget)); @@ -931,7 +931,7 @@ void MyDialog::cb_switchTheme (const finalcut::FWidget* widget, const FDataPtr) } //---------------------------------------------------------------------- -void MyDialog::cb_input2buttonText (finalcut::FWidget* widget, FDataPtr data) +void MyDialog::cb_input2buttonText (finalcut::FWidget* widget, FDataPtr data) const { auto& button = *(static_cast(widget)); const auto& lineedit = *(static_cast(data)); @@ -958,7 +958,7 @@ void MyDialog::cb_showProgressBar (const finalcut::FWidget*, const FDataPtr) } //---------------------------------------------------------------------- -void MyDialog::cb_updateNumber (finalcut::FWidget* widget, FDataPtr data) +void MyDialog::cb_updateNumber (finalcut::FWidget* widget, FDataPtr data) const { const auto& list = *(static_cast(widget)); auto& num = *(static_cast(data)); @@ -975,7 +975,7 @@ void MyDialog::cb_updateNumber (finalcut::FWidget* widget, FDataPtr data) } //---------------------------------------------------------------------- -void MyDialog::cb_activateButton (finalcut::FWidget* widget, FDataPtr data) +void MyDialog::cb_activateButton (finalcut::FWidget* widget, FDataPtr data) const { const auto& rb = *(static_cast(widget)); auto& button = *(static_cast(data)); @@ -1026,7 +1026,7 @@ void MyDialog::cb_view (const finalcut::FWidget*, FDataPtr data) } //---------------------------------------------------------------------- -void MyDialog::cb_setInput (finalcut::FWidget* widget, FDataPtr data) +void MyDialog::cb_setInput (finalcut::FWidget* widget, FDataPtr data) const { auto& ListBox = *(static_cast(widget)); auto& lineedit = *(static_cast(data)); diff --git a/examples/windows.cpp b/examples/windows.cpp index d624fc9a..491c5246 100644 --- a/examples/windows.cpp +++ b/examples/windows.cpp @@ -216,7 +216,7 @@ class Window final : public finalcut::FDialog void cb_closeWindows (const finalcut::FWidget*, const FDataPtr); void cb_next (const finalcut::FWidget*, const FDataPtr); void cb_previous (const finalcut::FWidget*, const FDataPtr); - void cb_destroyWindow (const finalcut::FWidget*, FDataPtr); + void cb_destroyWindow (const finalcut::FWidget*, FDataPtr) const; // Data members std::vector windows{}; @@ -542,7 +542,7 @@ void Window::cb_previous (const finalcut::FWidget*, const FDataPtr) } //---------------------------------------------------------------------- -void Window::cb_destroyWindow (const finalcut::FWidget*, FDataPtr data) +void Window::cb_destroyWindow (const finalcut::FWidget*, FDataPtr data) const { auto win_dat = static_cast(data); diff --git a/src/fapplication.cpp b/src/fapplication.cpp index 251f0a9c..e1519430 100644 --- a/src/fapplication.cpp +++ b/src/fapplication.cpp @@ -174,7 +174,7 @@ int FApplication::enterLoop() // event loop } //---------------------------------------------------------------------- -void FApplication::exitLoop() +void FApplication::exitLoop() const { app_exit_loop = true; } @@ -187,7 +187,7 @@ void FApplication::exit (int retcode) } //---------------------------------------------------------------------- -void FApplication::quit() +void FApplication::quit() const { FApplication::exit(0); } @@ -231,7 +231,7 @@ void FApplication::sendQueuedEvents() } //---------------------------------------------------------------------- -bool FApplication::eventInQueue() +bool FApplication::eventInQueue() const { if ( app_object ) return ( ! event_queue.empty() ); @@ -571,7 +571,7 @@ inline void FApplication::destroyLog() } //---------------------------------------------------------------------- -inline void FApplication::findKeyboardWidget() +inline void FApplication::findKeyboardWidget() const { // Find the widget that has the keyboard focus @@ -675,7 +675,7 @@ inline void FApplication::performKeyboardAction() } //---------------------------------------------------------------------- -inline void FApplication::sendEscapeKeyPressEvent() +inline void FApplication::sendEscapeKeyPressEvent() const { // Send an escape key press event FKeyEvent k_press_ev (fc::KeyPress_Event, fc::Fkey_escape); @@ -683,7 +683,7 @@ inline void FApplication::sendEscapeKeyPressEvent() } //---------------------------------------------------------------------- -inline bool FApplication::sendKeyDownEvent (FWidget* widget) +inline bool FApplication::sendKeyDownEvent (FWidget* widget) const { // Send key down event FKeyEvent k_down_ev (fc::KeyDown_Event, keyboard->getKey()); @@ -692,7 +692,7 @@ inline bool FApplication::sendKeyDownEvent (FWidget* widget) } //---------------------------------------------------------------------- -inline bool FApplication::sendKeyPressEvent (FWidget* widget) +inline bool FApplication::sendKeyPressEvent (FWidget* widget) const { // Send key press event FKeyEvent k_press_ev (fc::KeyPress_Event, keyboard->getKey()); @@ -701,7 +701,7 @@ inline bool FApplication::sendKeyPressEvent (FWidget* widget) } //---------------------------------------------------------------------- -inline bool FApplication::sendKeyUpEvent (FWidget* widget) +inline bool FApplication::sendKeyUpEvent (FWidget* widget) const { // Send key up event FKeyEvent k_up_ev (fc::KeyUp_Event, keyboard->getKey()); @@ -753,7 +753,7 @@ void FApplication::processKeyboardEvent() } //---------------------------------------------------------------------- -bool FApplication::processDialogSwitchAccelerator() +bool FApplication::processDialogSwitchAccelerator() const { if ( keyboard->getKey() >= fc::Fmkey_1 && keyboard->getKey() <= fc::Fmkey_9 ) @@ -784,7 +784,7 @@ bool FApplication::processDialogSwitchAccelerator() } //---------------------------------------------------------------------- -bool FApplication::processAccelerator (const FWidget* const& widget) +bool FApplication::processAccelerator (const FWidget* const& widget) const { bool accpt{false}; @@ -822,7 +822,7 @@ bool FApplication::processAccelerator (const FWidget* const& widget) } //---------------------------------------------------------------------- -bool FApplication::getMouseEvent() +bool FApplication::getMouseEvent() const { bool mouse_event_occurred{false}; @@ -870,7 +870,7 @@ FWidget*& FApplication::determineClickedWidget() } //---------------------------------------------------------------------- -void FApplication::unsetMoveSizeMode() +void FApplication::unsetMoveSizeMode() const { // Unset the move/size mode @@ -972,7 +972,7 @@ void FApplication::sendMouseEvent() //---------------------------------------------------------------------- void FApplication::sendMouseMoveEvent ( const FPoint& widgetMousePos , const FPoint& mouse_position - , int key_state ) + , int key_state ) const { if ( ! mouse ) return; @@ -1010,7 +1010,7 @@ void FApplication::sendMouseMoveEvent ( const FPoint& widgetMousePos //---------------------------------------------------------------------- void FApplication::sendMouseLeftClickEvent ( const FPoint& widgetMousePos , const FPoint& mouse_position - , int key_state ) + , int key_state ) const { if ( ! mouse ) return; @@ -1052,7 +1052,7 @@ void FApplication::sendMouseLeftClickEvent ( const FPoint& widgetMousePos //---------------------------------------------------------------------- void FApplication::sendMouseRightClickEvent ( const FPoint& widgetMousePos , const FPoint& mouse_position - , int key_state ) + , int key_state ) const { if ( ! mouse ) return; @@ -1086,7 +1086,7 @@ void FApplication::sendMouseRightClickEvent ( const FPoint& widgetMousePos //---------------------------------------------------------------------- void FApplication::sendMouseMiddleClickEvent ( const FPoint& widgetMousePos , const FPoint& mouse_position - , int key_state ) + , int key_state ) const { if ( ! mouse ) return; @@ -1125,7 +1125,7 @@ void FApplication::sendMouseMiddleClickEvent ( const FPoint& widgetMousePos //---------------------------------------------------------------------- void FApplication::sendWheelEvent ( const FPoint& widgetMousePos - , const FPoint& mouse_position ) + , const FPoint& mouse_position ) const { if ( ! mouse ) return; @@ -1226,7 +1226,7 @@ void FApplication::processCloseWidget() } //---------------------------------------------------------------------- -void FApplication::processLogger() +void FApplication::processLogger() const { // Synchronizing the stream buffer with the logging output diff --git a/src/fbutton.cpp b/src/fbutton.cpp index 2848c43c..753b2f7e 100644 --- a/src/fbutton.cpp +++ b/src/fbutton.cpp @@ -670,7 +670,7 @@ void FButton::draw() } //---------------------------------------------------------------------- -void FButton::updateStatusBar() +void FButton::updateStatusBar() const { if ( ! getFlags().focus || ! getStatusBar() ) return; diff --git a/src/fbuttongroup.cpp b/src/fbuttongroup.cpp index 7daeb8f6..303a2a21 100644 --- a/src/fbuttongroup.cpp +++ b/src/fbuttongroup.cpp @@ -542,7 +542,7 @@ void FButtonGroup::directFocus() } //---------------------------------------------------------------------- -void FButtonGroup::cb_buttonToggled (FWidget* widget, const FDataPtr) +void FButtonGroup::cb_buttonToggled (FWidget* widget, const FDataPtr) const { const auto& button = static_cast(widget); diff --git a/src/fcolorpalette.cpp b/src/fcolorpalette.cpp index 9180dbdc..e0e5fcf0 100644 --- a/src/fcolorpalette.cpp +++ b/src/fcolorpalette.cpp @@ -42,7 +42,7 @@ FColorPalette::~FColorPalette() // destructor // protected methods of FColorPalette //---------------------------------------------------------------------- -void FColorPalette::setPalette (FColor index, int r, int g, int b) +void FColorPalette::setPalette (FColor index, int r, int g, int b) const { set_palette (index, r, g, b); } diff --git a/src/fdialog.cpp b/src/fdialog.cpp index 59d3d93c..0e131c53 100644 --- a/src/fdialog.cpp +++ b/src/fdialog.cpp @@ -1270,7 +1270,7 @@ void FDialog::setZoomItem() } //---------------------------------------------------------------------- -inline std::size_t FDialog::getZoomButtonWidth() +inline std::size_t FDialog::getZoomButtonWidth() const { if ( ! isResizeable() ) return 0; diff --git a/src/ffiledialog.cpp b/src/ffiledialog.cpp index 565cfa0d..69cbb4d5 100644 --- a/src/ffiledialog.cpp +++ b/src/ffiledialog.cpp @@ -415,8 +415,8 @@ void FFileDialog::initCallbacks() } //---------------------------------------------------------------------- -inline bool FFileDialog::pattern_match ( const char* const pattern - , const char fname[] ) +inline bool FFileDialog::patternMatch ( const char* const pattern + , const char fname[] ) const { char search[128]{}; @@ -583,14 +583,14 @@ void FFileDialog::getEntry (const char* const dir, const struct dirent* d_entry) if ( entry.directory ) dir_entries.push_back (entry); - else if ( pattern_match(filter, entry.name.c_str()) ) + else if ( patternMatch(filter, entry.name.c_str()) ) dir_entries.push_back (entry); else entry.name.clear(); } //---------------------------------------------------------------------- -void FFileDialog::followSymLink (const char* const dir, FDirEntry& entry) +void FFileDialog::followSymLink (const char* const dir, FDirEntry& entry) const { if ( ! entry.symbolic_link ) return; // No symbolic link diff --git a/src/fkeyboard.cpp b/src/fkeyboard.cpp index 52afbfcd..039c18bc 100644 --- a/src/fkeyboard.cpp +++ b/src/fkeyboard.cpp @@ -82,7 +82,7 @@ void FKeyboard::fetchKeyCode() } //---------------------------------------------------------------------- -const FString FKeyboard::getKeyName (const FKey keynum) +const FString FKeyboard::getKeyName (const FKey keynum) const { for (std::size_t i{0}; fc::fkeyname[i].string[0] != 0; i++) if ( fc::fkeyname[i].num && fc::fkeyname[i].num == keynum ) @@ -179,7 +179,7 @@ void FKeyboard::escapeKeyHandling() // private methods of FKeyboard //---------------------------------------------------------------------- -inline FKey FKeyboard::getMouseProtocolKey() +inline FKey FKeyboard::getMouseProtocolKey() const { // Looking for mouse string in the key buffer @@ -357,7 +357,7 @@ bool FKeyboard::isKeypressTimeout() } //---------------------------------------------------------------------- -FKey FKeyboard::UTF8decode (const char utf8[]) +FKey FKeyboard::UTF8decode (const char utf8[]) const { FKey ucs{0}; // Universal coded character constexpr std::size_t max = 4; @@ -488,7 +488,7 @@ FKey FKeyboard::parseKeyString() } //---------------------------------------------------------------------- -FKey FKeyboard::keyCorrection (const FKey& keycode) +FKey FKeyboard::keyCorrection (const FKey& keycode) const { FKey key_correction; diff --git a/src/flabel.cpp b/src/flabel.cpp index ad3621fe..d388abb1 100644 --- a/src/flabel.cpp +++ b/src/flabel.cpp @@ -83,7 +83,7 @@ FLabel& FLabel::operator << (const wchar_t c) } //---------------------------------------------------------------------- -const FLabel& FLabel::operator >> (FString& s) +const FLabel& FLabel::operator >> (FString& s) const { s += text; return *this; @@ -266,7 +266,7 @@ void FLabel::setHotkeyAccelerator() } //---------------------------------------------------------------------- -std::size_t FLabel::getAlignOffset (const std::size_t length) +std::size_t FLabel::getAlignOffset (const std::size_t length) const { const std::size_t width(getWidth()); assert ( alignment == fc::alignLeft diff --git a/src/flineedit.cpp b/src/flineedit.cpp index c5e3984e..81823bee 100644 --- a/src/flineedit.cpp +++ b/src/flineedit.cpp @@ -88,7 +88,7 @@ FLineEdit& FLineEdit::operator << (const wchar_t c) } //---------------------------------------------------------------------- -const FLineEdit& FLineEdit::operator >> (FString& s) +const FLineEdit& FLineEdit::operator >> (FString& s) const { s += text; return *this; @@ -661,7 +661,7 @@ void FLineEdit::init() bool FLineEdit::hasHotkey() const { if ( label_text.isEmpty() ) - return 0; + return false; return label_text.includes('&'); } @@ -787,7 +787,7 @@ inline std::size_t FLineEdit::printPassword() } //---------------------------------------------------------------------- -inline std::size_t FLineEdit::getCursorColumnPos() +inline std::size_t FLineEdit::getCursorColumnPos() const { if ( input_type == FLineEdit::textfield ) { @@ -1104,7 +1104,7 @@ inline bool FLineEdit::keyInput (FKey key) } //---------------------------------------------------------------------- -inline wchar_t FLineEdit::characterFilter (const wchar_t c) +inline wchar_t FLineEdit::characterFilter (const wchar_t c) const { if ( input_filter.empty() ) return c; diff --git a/src/flistbox.cpp b/src/flistbox.cpp index 45234365..7f4415e5 100644 --- a/src/flistbox.cpp +++ b/src/flistbox.cpp @@ -766,7 +766,7 @@ void FListBox::drawBorder() } //---------------------------------------------------------------------- -void FListBox::drawScrollbars() +void FListBox::drawScrollbars() const { if ( ! hbar->isShown() && isHorizontallyScrollable() ) hbar->show(); @@ -1061,7 +1061,7 @@ inline void FListBox::setLineAttributes ( int y } //---------------------------------------------------------------------- -inline void FListBox::unsetAttributes() +inline void FListBox::unsetAttributes() const { if ( FTerm::isMonochron() ) // unset for the last element setReverse(false); @@ -1120,7 +1120,7 @@ void FListBox::recalculateHorizontalBar (std::size_t len, bool has_brackets) } //---------------------------------------------------------------------- -void FListBox::recalculateVerticalBar (std::size_t element_count) +void FListBox::recalculateVerticalBar (std::size_t element_count) const { const int vmax = ( element_count + 2 > getHeight() ) ? int(element_count - getHeight() + 2) @@ -1714,7 +1714,7 @@ void FListBox::processChanged() } //---------------------------------------------------------------------- -void FListBox::changeOnResize() +void FListBox::changeOnResize() const { if ( FTerm::isNewFont() ) { diff --git a/src/flistview.cpp b/src/flistview.cpp index a61c6905..82134c89 100644 --- a/src/flistview.cpp +++ b/src/flistview.cpp @@ -310,7 +310,7 @@ FObject::iterator FListViewItem::insert (FListViewItem* child) //---------------------------------------------------------------------- FObject::iterator FListViewItem::insert ( FListViewItem* child - , iterator parent_iter ) + , iterator parent_iter ) const { if ( parent_iter == FListView::getNullIterator() ) return FListView::getNullIterator(); @@ -335,7 +335,7 @@ FObject::iterator FListViewItem::insert ( FListViewItem* child } //---------------------------------------------------------------------- -void FListViewItem::remove (FListViewItem* item) +void FListViewItem::remove (FListViewItem* item) const { if ( item == nullptr || item == *FListView::getNullIterator() ) return; @@ -696,7 +696,7 @@ FListView::~FListView() // destructor // public methods of FListView //---------------------------------------------------------------------- -std::size_t FListView::getCount() +std::size_t FListView::getCount() const { int n{0}; @@ -1585,7 +1585,7 @@ void FListView::sort (Compare cmp) //---------------------------------------------------------------------- std::size_t FListView::getAlignOffset ( const fc::text_alignment align , const std::size_t column_width - , const std::size_t width ) + , const std::size_t width ) const { assert ( align == fc::alignLeft || align == fc::alignCenter @@ -1892,7 +1892,7 @@ void FListView::clearList() //---------------------------------------------------------------------- inline void FListView::setLineAttributes ( bool is_current - , bool is_focus ) + , bool is_focus ) const { const auto& wc = getColorTheme(); setColor (wc->list_fg, wc->list_bg); @@ -1927,7 +1927,7 @@ inline void FListView::setLineAttributes ( bool is_current } //---------------------------------------------------------------------- -inline FString FListView::getCheckBox (const FListViewItem* item) +inline FString FListView::getCheckBox (const FListViewItem* item) const { FString checkbox{""}; @@ -2511,7 +2511,7 @@ void FListView::processChanged() } //---------------------------------------------------------------------- -void FListView::changeOnResize() +void FListView::changeOnResize() const { if ( FTerm::isNewFont() ) { diff --git a/src/flogger.cpp b/src/flogger.cpp index 59ac1948..4e74138d 100644 --- a/src/flogger.cpp +++ b/src/flogger.cpp @@ -42,7 +42,7 @@ FLogger::~FLogger() // destructor // private methods of FLogger //---------------------------------------------------------------------- void FLogger::newlineReplace ( std::string& str - , const std::string& replace_str ) + , const std::string& replace_str ) const { std::size_t pos{0}; std::size_t npos{std::string::npos}; @@ -56,7 +56,7 @@ void FLogger::newlineReplace ( std::string& str } //---------------------------------------------------------------------- -const std::string FLogger::getTimeString() +const std::string FLogger::getTimeString() const { char str[100]; const auto& now = std::chrono::system_clock::now(); diff --git a/src/fmenu.cpp b/src/fmenu.cpp index 81cd2a4c..a6e3b767 100644 --- a/src/fmenu.cpp +++ b/src/fmenu.cpp @@ -339,7 +339,7 @@ void FMenu::cb_menuitemDisabled (const FWidget*, const FDataPtr) } //---------------------------------------------------------------------- -void FMenu::cb_menuitemToggled (FWidget* widget, const FDataPtr) +void FMenu::cb_menuitemToggled (FWidget* widget, const FDataPtr) const { const auto& m_item = static_cast(widget); @@ -444,7 +444,7 @@ bool FMenu::isMouseOverSuperMenu (const FPoint& termpos) } //---------------------------------------------------------------------- -bool FMenu::isMouseOverMenuBar (const FPoint& termpos) +bool FMenu::isMouseOverMenuBar (const FPoint& termpos) const { if ( getMenuBar() && isMenuBar(getMenuBar()) @@ -563,7 +563,7 @@ void FMenu::calculateDimensions() } //---------------------------------------------------------------------- -void FMenu::adjustItems() +void FMenu::adjustItems() const { for (auto&& item : getItemList()) { @@ -980,7 +980,7 @@ void FMenu::passEventToSuperMenu (FMouseEvent* const& ev) } //---------------------------------------------------------------------- -void FMenu::passEventToMenuBar (FMouseEvent* const& ev) +void FMenu::passEventToMenuBar (FMouseEvent* const& ev) const { // Mouse event handover to the menu bar @@ -1145,7 +1145,7 @@ bool FMenu::selectPrevItem() } //---------------------------------------------------------------------- -void FMenu::keypressMenuBar (FKeyEvent* ev) +void FMenu::keypressMenuBar (FKeyEvent* ev) const { auto mbar = getMenuBar(); @@ -1491,7 +1491,7 @@ inline void FMenu::setLineAttributes (const FMenuItem* m_item, int y) } //---------------------------------------------------------------------- -inline void FMenu::setCursorToHotkeyPosition (FMenuItem* m_item) +inline void FMenu::setCursorToHotkeyPosition (FMenuItem* m_item) const { const bool is_checkable = m_item->checkable; const bool is_selected = m_item->isSelected(); diff --git a/src/fmenubar.cpp b/src/fmenubar.cpp index aa879619..3428425d 100644 --- a/src/fmenubar.cpp +++ b/src/fmenubar.cpp @@ -228,7 +228,7 @@ void FMenuBar::onAccel (FAccelEvent* ev) } //---------------------------------------------------------------------- -void FMenuBar::cb_itemDeactivated (FWidget* widget, const FDataPtr) +void FMenuBar::cb_itemDeactivated (FWidget* widget, const FDataPtr) const { auto menuitem = static_cast(widget); @@ -263,7 +263,7 @@ void FMenuBar::init() } //---------------------------------------------------------------------- -void FMenuBar::calculateDimensions() +void FMenuBar::calculateDimensions() const { FPoint item_pos{1, 1}; @@ -577,7 +577,7 @@ inline void FMenuBar::setLineAttributes (const FMenuItem* menuitem) //---------------------------------------------------------------------- inline void FMenuBar::setCursorToHotkeyPosition ( FMenuItem* menuitem - , std::size_t hotkeypos ) + , std::size_t hotkeypos ) const { if ( ! menuitem->isSelected() ) return; @@ -675,7 +675,7 @@ inline void FMenuBar::drawTrailingSpace (std::size_t& x) } //---------------------------------------------------------------------- -void FMenuBar::adjustItems() +void FMenuBar::adjustItems() const { int item_X = 1; int item_Y = 1; @@ -928,7 +928,7 @@ void FMenuBar::mouseMoveOverList (const FMouseEvent* ev) } //---------------------------------------------------------------------- -void FMenuBar::passEventToMenu (const FMouseEvent* const& ev) +void FMenuBar::passEventToMenu (const FMouseEvent* const& ev) const { if ( ! hasSelectedItem() || ! getSelectedItem()->hasMenu() ) return; diff --git a/src/fmenuitem.cpp b/src/fmenuitem.cpp index ae1b3cd3..3679fe33 100644 --- a/src/fmenuitem.cpp +++ b/src/fmenuitem.cpp @@ -591,7 +591,7 @@ void FMenuItem::processDeactivate() } //---------------------------------------------------------------------- -void FMenuItem::createDialogList (FMenu* winmenu) +void FMenuItem::createDialogList (FMenu* winmenu) const { winmenu->clear(); @@ -651,7 +651,7 @@ void FMenuItem::createDialogList (FMenu* winmenu) //---------------------------------------------------------------------- template void FMenuItem::passMouseEvent ( T widget, const FMouseEvent* ev - , fc::events ev_type ) + , fc::events ev_type ) const { if ( ! widget ) return; @@ -695,7 +695,7 @@ void FMenuItem::passMouseEvent ( T widget, const FMouseEvent* ev } //---------------------------------------------------------------------- -void FMenuItem::cb_switchToDialog (const FWidget*, FDataPtr data) +void FMenuItem::cb_switchToDialog (const FWidget*, FDataPtr data) const { auto win = static_cast(data); diff --git a/src/fmessagebox.cpp b/src/fmessagebox.cpp index 34851705..269be13e 100644 --- a/src/fmessagebox.cpp +++ b/src/fmessagebox.cpp @@ -384,7 +384,7 @@ void FMessageBox::draw() } //---------------------------------------------------------------------- -void FMessageBox::resizeButtons() +void FMessageBox::resizeButtons() const { std::size_t len[3]{}; std::size_t max_size{}; diff --git a/src/fmouse.cpp b/src/fmouse.cpp index 7b6fbaf1..5a104580 100644 --- a/src/fmouse.cpp +++ b/src/fmouse.cpp @@ -59,7 +59,7 @@ const FString FMouse::getClassName() const } //---------------------------------------------------------------------- -inline const FPoint& FMouse::getPos() +inline const FPoint& FMouse::getPos() const { return mouse; } @@ -89,7 +89,7 @@ inline void FMouse::setDblclickInterval (const uInt64 timeout) } //---------------------------------------------------------------------- -inline bool FMouse::hasEvent() +inline bool FMouse::hasEvent() const { return mouse_event_occurred; } @@ -172,7 +172,7 @@ inline bool FMouse::isMoved() } //---------------------------------------------------------------------- -inline bool FMouse::isInputDataPending() +inline bool FMouse::isInputDataPending() const { return input_data_pending; } @@ -193,25 +193,25 @@ inline FMouse::FMouseButton& FMouse::getButtonState() } //---------------------------------------------------------------------- -inline const FPoint& FMouse::getNewPos() +inline const FPoint& FMouse::getNewPos() const { return new_mouse_position; } //---------------------------------------------------------------------- -uInt16 FMouse::getMaxWidth() +uInt16 FMouse::getMaxWidth() const { return max_width; } //---------------------------------------------------------------------- -uInt16 FMouse::getMaxHeight() +uInt16 FMouse::getMaxHeight() const { return max_height; } //---------------------------------------------------------------------- -uInt64 FMouse::getDblclickInterval() +uInt64 FMouse::getDblclickInterval() const { return dblclick_interval; } @@ -260,7 +260,7 @@ void FMouse::setEvent() } //---------------------------------------------------------------------- -bool FMouse::isDblclickTimeout (const timeval* time) +bool FMouse::isDblclickTimeout (const timeval* time) const { return FObject::isTimeout (time, dblclick_interval); } @@ -397,7 +397,7 @@ bool FMouseGPM::gpmMouse (bool enable) } //---------------------------------------------------------------------- -bool FMouseGPM::hasSignificantEvents() +bool FMouseGPM::hasSignificantEvents() const { return ! (gpm_ev.type & GPM_MOVE) || gpm_ev.wdy != 0 @@ -483,7 +483,7 @@ void FMouseGPM::drawGpmPointer() } //---------------------------------------------------------------------- -int FMouseGPM::gpmEvent (bool clear) +int FMouseGPM::gpmEvent (bool clear) const { const int max = ( gpm_fd > stdin_no ) ? gpm_fd : stdin_no; fd_set ifds{}; @@ -1598,7 +1598,7 @@ FMouse* FMouseControl::getMouseWithEvent() } //---------------------------------------------------------------------- -void FMouseControl::xtermMouse (bool enable) +void FMouseControl::xtermMouse (bool enable) const { // activate/deactivate the xterm mouse support diff --git a/src/fobject.cpp b/src/fobject.cpp index d75d1878..3bdb4470 100644 --- a/src/fobject.cpp +++ b/src/fobject.cpp @@ -307,7 +307,7 @@ int FObject::addTimer (int interval) } //---------------------------------------------------------------------- -bool FObject::delTimer (int id) +bool FObject::delTimer (int id) const { // Deletes a timer by using the timer identifier number @@ -333,7 +333,7 @@ bool FObject::delTimer (int id) } //---------------------------------------------------------------------- -bool FObject::delOwnTimer() +bool FObject::delOwnTimer() const { // Deletes all timers of this object @@ -359,7 +359,7 @@ bool FObject::delOwnTimer() } //---------------------------------------------------------------------- -bool FObject::delAllTimer() +bool FObject::delAllTimer() const { // Deletes all timers of all objects diff --git a/src/foptiattr.cpp b/src/foptiattr.cpp index d53d50a7..211772a9 100644 --- a/src/foptiattr.cpp +++ b/src/foptiattr.cpp @@ -1239,7 +1239,7 @@ inline bool FOptiAttr::hasColorChanged ( const FChar* const& term } //---------------------------------------------------------------------- -inline void FOptiAttr::resetColor (FChar*& attr) +inline void FOptiAttr::resetColor (FChar*& attr) const { if ( attr ) { @@ -1535,7 +1535,7 @@ inline void FOptiAttr::change_current_color ( const FChar* const& term } //---------------------------------------------------------------------- -inline void FOptiAttr::resetAttribute (FChar*& attr) +inline void FOptiAttr::resetAttribute (FChar*& attr) const { if ( attr ) { @@ -1555,7 +1555,7 @@ inline void FOptiAttr::reset (FChar*& attr) } //---------------------------------------------------------------------- -bool FOptiAttr::caused_reset_attributes (const char cap[], uChar test) +bool FOptiAttr::caused_reset_attributes (const char cap[], uChar test) const { // test if "cap" reset all attributes @@ -1648,14 +1648,14 @@ inline void FOptiAttr::detectSwitchOff (const FChar* const& term, const FChar* c } //---------------------------------------------------------------------- -inline bool FOptiAttr::switchOn() +inline bool FOptiAttr::switchOn() const { auto on_ptr = &on; return hasAttribute(on_ptr); } //---------------------------------------------------------------------- -inline bool FOptiAttr::switchOff() +inline bool FOptiAttr::switchOff() const { auto off_ptr = &off; return hasAttribute(off_ptr); diff --git a/src/foptimove.cpp b/src/foptimove.cpp index 95ce383c..8d45320b 100644 --- a/src/foptimove.cpp +++ b/src/foptimove.cpp @@ -463,7 +463,7 @@ void FOptiMove::set_clr_eol (const char cap[]) //---------------------------------------------------------------------- void FOptiMove::check_boundaries ( int& xold, int& yold - , int& xnew, int& ynew ) + , int& xnew, int& ynew ) const { if ( xold < 0 || xold >= int(screen_width) ) xold = -1; @@ -549,7 +549,7 @@ void FOptiMove::calculateCharDuration() } //---------------------------------------------------------------------- -int FOptiMove::capDuration (const char cap[], int affcnt) +int FOptiMove::capDuration (const char cap[], int affcnt) const { // calculate the duration in milliseconds of a given operation // cap - the term capability @@ -598,7 +598,7 @@ int FOptiMove::capDuration (const char cap[], int affcnt) } //---------------------------------------------------------------------- -int FOptiMove::capDurationToLength (int duration) +int FOptiMove::capDurationToLength (int duration) const { if ( duration != LONG_DURATION ) return (duration + char_duration - 1) / char_duration; @@ -609,7 +609,7 @@ int FOptiMove::capDurationToLength (int duration) //---------------------------------------------------------------------- int FOptiMove::repeatedAppend ( const capability& o , volatile int count - , char* dst ) + , char* dst ) const { const std::size_t src_len = std::strlen(o.cap); const std::size_t dst_len = ( dst != nullptr ) ? std::strlen(dst) : 0; diff --git a/src/fscrollbar.cpp b/src/fscrollbar.cpp index 3c96b6ce..43b3a004 100644 --- a/src/fscrollbar.cpp +++ b/src/fscrollbar.cpp @@ -626,7 +626,7 @@ FScrollbar::sType FScrollbar::getClickedScrollType (int x, int y) } //---------------------------------------------------------------------- -FScrollbar::sType FScrollbar::getVerticalClickedScrollType (int y) +FScrollbar::sType FScrollbar::getVerticalClickedScrollType (int y) const { if ( y == 1 ) { @@ -649,7 +649,7 @@ FScrollbar::sType FScrollbar::getVerticalClickedScrollType (int y) } //---------------------------------------------------------------------- -FScrollbar::sType FScrollbar::getHorizontalClickedScrollType (int x) +FScrollbar::sType FScrollbar::getHorizontalClickedScrollType (int x) const { if ( FTerm::isNewFont() ) { @@ -696,7 +696,7 @@ FScrollbar::sType FScrollbar::getHorizontalClickedScrollType (int x) } //---------------------------------------------------------------------- -int FScrollbar::getSliderClickPos (int mouse_x, int mouse_y) +int FScrollbar::getSliderClickPos (int mouse_x, int mouse_y) const { // Get the clicked position on the slider diff --git a/src/fscrollview.cpp b/src/fscrollview.cpp index f5a1e30b..fb82aef3 100644 --- a/src/fscrollview.cpp +++ b/src/fscrollview.cpp @@ -694,7 +694,7 @@ void FScrollView::copy2area() // private methods of FScrollView //---------------------------------------------------------------------- -inline const FPoint FScrollView::getViewportCursorPos() +inline const FPoint FScrollView::getViewportCursorPos() const { const auto& window = FWindow::getWindowWidget(this); @@ -773,7 +773,7 @@ inline void FScrollView::mapKeyFunctions() } //---------------------------------------------------------------------- -void FScrollView::calculateScrollbarPos() +void FScrollView::calculateScrollbarPos() const { const std::size_t width = getWidth(); const std::size_t height = getHeight(); @@ -794,7 +794,7 @@ void FScrollView::calculateScrollbarPos() } //---------------------------------------------------------------------- -void FScrollView::setHorizontalScrollBarVisibility() +void FScrollView::setHorizontalScrollBarVisibility() const { assert ( v_mode == fc::Auto || v_mode == fc::Hidden @@ -820,7 +820,7 @@ void FScrollView::setHorizontalScrollBarVisibility() } //---------------------------------------------------------------------- -void FScrollView::setVerticalScrollBarVisibility() +void FScrollView::setVerticalScrollBarVisibility() const { assert ( v_mode == fc::Auto || v_mode == fc::Hidden diff --git a/src/fstatusbar.cpp b/src/fstatusbar.cpp index 03b6030f..806ce8be 100644 --- a/src/fstatusbar.cpp +++ b/src/fstatusbar.cpp @@ -528,14 +528,14 @@ void FStatusBar::init() } //---------------------------------------------------------------------- -int FStatusBar::getKeyNameWidth (const FStatusKey* key) +int FStatusBar::getKeyNameWidth (const FStatusKey* key) const { const FString& key_name = FTerm::getKeyName(key->getKey()); return int(getColumnWidth(key_name)); } //---------------------------------------------------------------------- -int FStatusBar::getKeyTextWidth (const FStatusKey* key) +int FStatusBar::getKeyTextWidth (const FStatusKey* key) const { const FString& key_text = key->getText(); return int(getColumnWidth(key_text)); diff --git a/src/fstring.cpp b/src/fstring.cpp index 55987c14..21eb6997 100644 --- a/src/fstring.cpp +++ b/src/fstring.cpp @@ -273,99 +273,104 @@ FString& FString::operator << (const char c) } //---------------------------------------------------------------------- -const FString& FString::operator >> (FString& s) +const FString& FString::operator >> (FString& s) const { s._insert (s.length, length, string); - _assign(s.string); return *this; } //---------------------------------------------------------------------- -const FString& FString::operator >> (std::wstring& s) +const FString& FString::operator >> (std::wstring& s) const { s += std::wstring(string); return *this; } //---------------------------------------------------------------------- -const FString& FString::operator >> (std::string& s) +const FString& FString::operator >> (std::string& s) const { s += toString(); return *this; } //---------------------------------------------------------------------- -const FString& FString::operator >> (wchar_t& c) +const FString& FString::operator >> (wchar_t& c) const { c = ( length > 0 ) ? string[0] : L'\0'; return *this; } //---------------------------------------------------------------------- -const FString& FString::operator >> (char& c) +const FString& FString::operator >> (char& c) const { c = ( length > 0 ) ? char(string[0] & 0xff) : '\0'; return *this; } //---------------------------------------------------------------------- -const FString& FString::operator >> (sInt16& num) +const FString& FString::operator >> (sInt16& num) const { num = toShort(); return *this; } //---------------------------------------------------------------------- -const FString& FString::operator >> (uInt16& num) +const FString& FString::operator >> (uInt16& num) const { num = toUShort(); return *this; } //---------------------------------------------------------------------- -const FString& FString::operator >> (sInt32& num) +const FString& FString::operator >> (sInt32& num) const { num = toInt(); return *this; } //---------------------------------------------------------------------- -const FString& FString::operator >> (uInt32& num) +const FString& FString::operator >> (uInt32& num) const { num = toUInt(); return *this; } //---------------------------------------------------------------------- -const FString& FString::operator >> (sInt64& num) +const FString& FString::operator >> (sInt64& num) const { num = toLong(); return *this; } //---------------------------------------------------------------------- -const FString& FString::operator >> (uInt64& num) +const FString& FString::operator >> (uInt64& num) const { num = toULong(); return *this; } //---------------------------------------------------------------------- -const FString& FString::operator >> (double& num) +const FString& FString::operator >> (double& num) const { num = toDouble(); return *this; } //---------------------------------------------------------------------- -const FString& FString::operator >> (float& num) +const FString& FString::operator >> (float& num) const { num = toFloat(); return *this; } //---------------------------------------------------------------------- -const FString& FString::operator () () +FString::operator bool () const +{ + return bool(string); +} + +//---------------------------------------------------------------------- +const FString& FString::operator () () const { return *this; } @@ -1034,7 +1039,7 @@ const FString& FString::insert (const FString& s, std::size_t pos) } //---------------------------------------------------------------------- -FString const FString::replace (const FString& from, const FString& to) +FString const FString::replace (const FString& from, const FString& to) const { FString s{*this}; @@ -1544,7 +1549,7 @@ inline const wchar_t* FString::_to_wcstring (const char s[]) const //---------------------------------------------------------------------- inline const wchar_t* FString::_extractToken ( wchar_t* rest[] , const wchar_t s[] - , const wchar_t delim[] ) + , const wchar_t delim[] ) const { wchar_t* token = ( s ) ? const_cast(s) : *rest; diff --git a/src/fterm.cpp b/src/fterm.cpp index 6cbe556c..e2ff12b2 100644 --- a/src/fterm.cpp +++ b/src/fterm.cpp @@ -2190,7 +2190,7 @@ void FTerm::useNormalScreenBuffer() } //---------------------------------------------------------------------- -inline void FTerm::allocationValues() +inline void FTerm::allocationValues() const { FStartOptions::getFStartOptions(); getFTermData(); @@ -2401,7 +2401,7 @@ bool FTerm::init_terminal() } //---------------------------------------------------------------------- -void FTerm::initOSspecifics() +void FTerm::initOSspecifics() const { #if defined(__linux__) linux->init(); // Initialize Linux console @@ -2435,7 +2435,7 @@ void FTerm::initOSspecifics() } //---------------------------------------------------------------------- -void FTerm::initTermspecifics() +void FTerm::initTermspecifics() const { if ( isKdeTerminal() ) setKDECursor(fc::UnderlineCursor); @@ -2448,7 +2448,7 @@ void FTerm::initTermspecifics() } //---------------------------------------------------------------------- -void FTerm::initBaudRate() +void FTerm::initBaudRate() const { const int stdout_no = FTermios::getStdOut(); const uInt baud = FTermios::getBaudRate(); @@ -2529,7 +2529,7 @@ void FTerm::finish() } //---------------------------------------------------------------------- -void FTerm::finishOSspecifics() +void FTerm::finishOSspecifics() const { #if defined(__linux__) linux->finish(); @@ -2541,7 +2541,7 @@ void FTerm::finishOSspecifics() } //---------------------------------------------------------------------- -void FTerm::finish_encoding() +void FTerm::finish_encoding() const { #if defined(__linux__) if ( isLinuxTerm() && data->hasUTF8Console() ) diff --git a/src/ftermbuffer.cpp b/src/ftermbuffer.cpp index 7dd82959..81c3ec88 100644 --- a/src/ftermbuffer.cpp +++ b/src/ftermbuffer.cpp @@ -92,9 +92,9 @@ int FTermBuffer::write (wchar_t ch) } //---------------------------------------------------------------------- -void FTermBuffer::write (const FStyle& style) +void FTermBuffer::write (const FStyle& style) const { - FAttribute attr = style.getStyle(); + FAttribute attr = style.getStyle(); if ( attr == 0 ) FVTerm::setNormal(); @@ -129,7 +129,7 @@ void FTermBuffer::write (const FStyle& style) } //---------------------------------------------------------------------- -void FTermBuffer::write (const FColorPair& pair) +void FTermBuffer::write (const FColorPair& pair) const { FVTerm::setColor(pair.getForegroundColor(), pair.getBackgroundColor()); } diff --git a/src/ftermlinux.cpp b/src/ftermlinux.cpp index f4263b2d..8023a248 100644 --- a/src/ftermlinux.cpp +++ b/src/ftermlinux.cpp @@ -63,7 +63,7 @@ FTermLinux::~FTermLinux() // destructor // public methods of FTermLinux //---------------------------------------------------------------------- #if defined(__linux__) -fc::linuxConsoleCursorStyle FTermLinux::getCursorStyle() +fc::linuxConsoleCursorStyle FTermLinux::getCursorStyle() const { // Get the current set cursor style @@ -102,7 +102,7 @@ bool FTermLinux::setCursorStyle (fc::linuxConsoleCursorStyle style) } //---------------------------------------------------------------------- -void FTermLinux::setUTF8 (bool enable) +void FTermLinux::setUTF8 (bool enable) const { if ( ! FTerm::isLinuxTerm() ) return; @@ -420,7 +420,7 @@ bool FTermLinux::resetColorMap() } //---------------------------------------------------------------------- -void FTermLinux::setBeep (int Hz, int ms) +void FTermLinux::setBeep (int Hz, int ms) const { if ( ! FTerm::isLinuxTerm() ) return; @@ -440,7 +440,7 @@ void FTermLinux::setBeep (int Hz, int ms) } //---------------------------------------------------------------------- -void FTermLinux::resetBeep() +void FTermLinux::resetBeep() const { if ( ! FTerm::isLinuxTerm() ) return; @@ -763,7 +763,7 @@ int FTermLinux::setUnicodeMap (struct unimapdesc* unimap) } //---------------------------------------------------------------------- -void FTermLinux::setLinuxCursorStyle (CursorStyle style) +void FTermLinux::setLinuxCursorStyle (CursorStyle style) const { FTerm::putstringf (CSI "?%dc", style); } @@ -1008,7 +1008,7 @@ bool FTermLinux::resetVGAPalette() #endif // defined(ISA_SYSCTL_SUPPORT) //---------------------------------------------------------------------- -FKey FTermLinux::shiftKeyCorrection (const FKey& key_id) +FKey FTermLinux::shiftKeyCorrection (const FKey& key_id) const { switch ( key_id ) { @@ -1048,7 +1048,7 @@ FKey FTermLinux::shiftKeyCorrection (const FKey& key_id) } //---------------------------------------------------------------------- -FKey FTermLinux::ctrlKeyCorrection (const FKey& key_id) +FKey FTermLinux::ctrlKeyCorrection (const FKey& key_id) const { switch ( key_id ) { @@ -1088,7 +1088,7 @@ FKey FTermLinux::ctrlKeyCorrection (const FKey& key_id) } //---------------------------------------------------------------------- -FKey FTermLinux::altKeyCorrection (const FKey& key_id) +FKey FTermLinux::altKeyCorrection (const FKey& key_id) const { switch ( key_id ) { @@ -1128,7 +1128,7 @@ FKey FTermLinux::altKeyCorrection (const FKey& key_id) } //---------------------------------------------------------------------- -FKey FTermLinux::shiftCtrlKeyCorrection (const FKey& key_id) +FKey FTermLinux::shiftCtrlKeyCorrection (const FKey& key_id) const { switch ( key_id ) { @@ -1168,7 +1168,7 @@ FKey FTermLinux::shiftCtrlKeyCorrection (const FKey& key_id) } //---------------------------------------------------------------------- -FKey FTermLinux::shiftAltKeyCorrection (const FKey& key_id) +FKey FTermLinux::shiftAltKeyCorrection (const FKey& key_id) const { switch ( key_id ) { @@ -1208,7 +1208,7 @@ FKey FTermLinux::shiftAltKeyCorrection (const FKey& key_id) } //---------------------------------------------------------------------- -FKey FTermLinux::ctrlAltKeyCorrection (const FKey& key_id) +FKey FTermLinux::ctrlAltKeyCorrection (const FKey& key_id) const { switch ( key_id ) { @@ -1248,7 +1248,7 @@ FKey FTermLinux::ctrlAltKeyCorrection (const FKey& key_id) } //---------------------------------------------------------------------- -FKey FTermLinux::shiftCtrlAltKeyCorrection (const FKey& key_id) +FKey FTermLinux::shiftCtrlAltKeyCorrection (const FKey& key_id) const { switch ( key_id ) { @@ -1315,7 +1315,7 @@ inline void FTermLinux::initSpecialCharacter() } //---------------------------------------------------------------------- -sInt16 FTermLinux::getFontPos (wchar_t ucs) +sInt16 FTermLinux::getFontPos (wchar_t ucs) const { constexpr sInt16 NOT_FOUND = -1; diff --git a/src/ftermxterminal.cpp b/src/ftermxterminal.cpp index e78669aa..2a501e2f 100644 --- a/src/ftermxterminal.cpp +++ b/src/ftermxterminal.cpp @@ -308,7 +308,7 @@ void FTermXTerminal::captureFontAndTitle() // private methods of FTermXTerminal //---------------------------------------------------------------------- -void FTermXTerminal::warnNotInitialized() +void FTermXTerminal::warnNotInitialized() const { *FApplication::getLog() << FLog::Warn << "The FTermXTerminal object has " diff --git a/src/ftextview.cpp b/src/ftextview.cpp index 50ef7d98..060ad2df 100644 --- a/src/ftextview.cpp +++ b/src/ftextview.cpp @@ -562,13 +562,13 @@ void FTextView::adjustSize() // private methods of FTextView //---------------------------------------------------------------------- -std::size_t FTextView::getTextHeight() +std::size_t FTextView::getTextHeight() const { return getHeight() - 2 + std::size_t(nf_offset); } //---------------------------------------------------------------------- -std::size_t FTextView::getTextWidth() +std::size_t FTextView::getTextWidth() const { return getWidth() - 2 - std::size_t(nf_offset); } @@ -702,7 +702,7 @@ void FTextView::drawText() } //---------------------------------------------------------------------- -inline bool FTextView::useFDialogBorder() +inline bool FTextView::useFDialogBorder() const { const auto& parent = getParentWidget(); bool use_fdialog_border{false}; @@ -722,7 +722,7 @@ inline bool FTextView::useFDialogBorder() } //---------------------------------------------------------------------- -inline bool FTextView::isPrintable (wchar_t ch) +inline bool FTextView::isPrintable (wchar_t ch) const { // Check for printable characters @@ -742,7 +742,7 @@ void FTextView::processChanged() } //---------------------------------------------------------------------- -void FTextView::changeOnResize() +void FTextView::changeOnResize() const { const std::size_t width = getWidth(); const std::size_t height = getHeight(); diff --git a/src/ftogglebutton.cpp b/src/ftogglebutton.cpp index 4c7e748f..c22314c6 100644 --- a/src/ftogglebutton.cpp +++ b/src/ftogglebutton.cpp @@ -533,7 +533,7 @@ void FToggleButton::drawText (const FString& label_text, std::size_t hotkeypos) } //---------------------------------------------------------------------- -void FToggleButton::correctSize (FSize& size) +void FToggleButton::correctSize (FSize& size) const { const std::size_t hotkey_mark = ( getHotkey(text) ) ? 1 : 0; const std::size_t column_width = getColumnWidth(text); diff --git a/src/fvterm.cpp b/src/fvterm.cpp index 665ae218..94cc408c 100644 --- a/src/fvterm.cpp +++ b/src/fvterm.cpp @@ -117,7 +117,7 @@ const FPoint FVTerm::getPrintCursor() } //---------------------------------------------------------------------- -void FVTerm::setTermXY (int x, int y) +void FVTerm::setTermXY (int x, int y) const { // Sets the hardware cursor to the given (x,y) position @@ -168,7 +168,7 @@ void FVTerm::setTerminalUpdates (terminal_update refresh_state) } //---------------------------------------------------------------------- -void FVTerm::hideCursor (bool enable) +void FVTerm::hideCursor (bool enable) const { // Hides or shows the input cursor on the terminal @@ -194,7 +194,7 @@ void FVTerm::setPrintCursor (const FPoint& pos) } //---------------------------------------------------------------------- -FColor FVTerm::rgb2ColorIndex (uInt8 r, uInt8 g, uInt8 b) +FColor FVTerm::rgb2ColorIndex (uInt8 r, uInt8 g, uInt8 b) const { // Converts a 24-bit RGB color to a 256-color compatible approximation @@ -775,7 +775,7 @@ void FVTerm::resizeArea ( const FRect& box area->has_changes = false; const FSize size{full_width, full_height}; - setTextToDefault (area, size); + resetTextAreaToDefault (area, size); } //---------------------------------------------------------------------- @@ -1369,8 +1369,8 @@ void FVTerm::initTerminal() // private methods of FVTerm //---------------------------------------------------------------------- -inline void FVTerm::setTextToDefault ( const FTermArea* area - , const FSize& size ) +inline void FVTerm::resetTextAreaToDefault ( const FTermArea* area + , const FSize& size ) const { FChar default_char; FLineChanges unchanged; @@ -1751,7 +1751,7 @@ bool FVTerm::hasChildAreaChanges (FTermArea* area) const } //---------------------------------------------------------------------- -void FVTerm::clearChildAreaChanges (const FTermArea* area) +void FVTerm::clearChildAreaChanges (const FTermArea* area) const { if ( ! area ) return; @@ -2397,7 +2397,7 @@ void FVTerm::printRange ( uInt xmin, uInt xmax, uInt y //---------------------------------------------------------------------- inline void FVTerm::replaceNonPrintableFullwidth ( uInt x - , FChar*& print_char ) + , FChar*& print_char ) const { // Replace non-printable full-width characters that are truncated // from the right or left terminal side @@ -2564,7 +2564,7 @@ void FVTerm::printHalfCovertFullWidthCharacter ( uInt& x, uInt y //---------------------------------------------------------------------- inline void FVTerm::skipPaddingCharacter ( uInt& x, uInt y - , const FChar* const& print_char ) + , const FChar* const& print_char ) const { if ( isFullWidthChar(print_char) ) // full-width character { @@ -2740,7 +2740,7 @@ void FVTerm::cursorWrap() } //---------------------------------------------------------------------- -bool FVTerm::printWrap (FTermArea* area) +bool FVTerm::printWrap (FTermArea* area) const { bool end_of_area{false}; const int width = area->width; @@ -2882,7 +2882,7 @@ bool FVTerm::updateTerminalCursor() } //---------------------------------------------------------------------- -bool FVTerm::isInsideTerminal (const FPoint& pos) +bool FVTerm::isInsideTerminal (const FPoint& pos) const { // Check whether the coordinates are within the virtual terminal @@ -2895,7 +2895,7 @@ bool FVTerm::isInsideTerminal (const FPoint& pos) } //---------------------------------------------------------------------- -inline bool FVTerm::isTermSizeChanged() +inline bool FVTerm::isTermSizeChanged() const { const auto& data = FTerm::getFTermData(); @@ -3016,7 +3016,7 @@ inline void FVTerm::appendChar (FChar*& next_char) } //---------------------------------------------------------------------- -inline void FVTerm::appendAttributes (FChar*& next_attr) +inline void FVTerm::appendAttributes (FChar*& next_attr) const { auto term_attr = &term_attribute; diff --git a/src/fwidget.cpp b/src/fwidget.cpp index 311756ef..88db56fa 100644 --- a/src/fwidget.cpp +++ b/src/fwidget.cpp @@ -338,7 +338,7 @@ void FWidget::useParentWidgetColor() } //---------------------------------------------------------------------- -void FWidget::setColor() +void FWidget::setColor() const { // Changes colors to the widget default colors setColor (foreground_color, background_color); @@ -566,7 +566,7 @@ void FWidget::setRightPadding (int right, bool adjust) } //---------------------------------------------------------------------- -void FWidget::setTermSize (const FSize& size) +void FWidget::setTermSize (const FSize& size) const { // Set xterm size to width x height @@ -1407,7 +1407,7 @@ void FWidget::adjustSize() } //---------------------------------------------------------------------- -void FWidget::adjustSizeGlobal() +void FWidget::adjustSizeGlobal() const { if ( ! isRootWidget() ) { @@ -2013,7 +2013,7 @@ void FWidget::draw() { } //---------------------------------------------------------------------- -void FWidget::drawWindows() +void FWidget::drawWindows() const { // redraw windows FChar default_char{}; @@ -2111,7 +2111,7 @@ void FWidget::destroyColorTheme() } //---------------------------------------------------------------------- -void FWidget::setStatusbarText (bool enable) +void FWidget::setStatusbarText (bool enable) const { if ( ! isEnabled() || ! getStatusBar() ) return; diff --git a/src/fwindow.cpp b/src/fwindow.cpp index e1153538..865ebf65 100644 --- a/src/fwindow.cpp +++ b/src/fwindow.cpp @@ -156,7 +156,7 @@ bool FWindow::activateWindow (bool enable) } //---------------------------------------------------------------------- -void FWindow::unsetActiveWindow() +void FWindow::unsetActiveWindow() const { // unset the active FWindow object FWidget::setActiveWindow (nullptr); diff --git a/src/include/final/fapplication.h b/src/include/final/fapplication.h index 87d1d729..aab0c61b 100644 --- a/src/include/final/fapplication.h +++ b/src/include/final/fapplication.h @@ -125,13 +125,13 @@ class FApplication : public FWidget // Methods int exec(); // run int enterLoop(); - void exitLoop(); + void exitLoop() const; static void exit (int = EXIT_SUCCESS); - void quit(); + void quit() const; static bool sendEvent (FObject*, FEvent*); void queueEvent (FObject*, FEvent*); void sendQueuedEvents(); - bool eventInQueue(); + bool eventInQueue() const; bool removeQueuedEvent (const FObject*); void initTerminal() override; static void setDefaultTheme(); @@ -157,44 +157,44 @@ class FApplication : public FWidget static FStartOptions& getStartOptions(); static void showParameterUsage(); void destroyLog(); - void findKeyboardWidget(); + void findKeyboardWidget() const; bool isKeyPressed() const; void keyPressed(); void keyReleased(); void escapeKeyPressed(); void performKeyboardAction(); - void sendEscapeKeyPressEvent(); - bool sendKeyDownEvent (FWidget*); - bool sendKeyPressEvent (FWidget*); - bool sendKeyUpEvent (FWidget*); + void sendEscapeKeyPressEvent() const; + bool sendKeyDownEvent (FWidget*) const; + bool sendKeyPressEvent (FWidget*) const; + bool sendKeyUpEvent (FWidget*) const; void sendKeyboardAccelerator(); void processKeyboardEvent(); - bool processDialogSwitchAccelerator(); - bool processAccelerator (const FWidget* const&); - bool getMouseEvent(); + bool processDialogSwitchAccelerator() const; + bool processAccelerator (const FWidget* const&) const; + bool getMouseEvent() const; FWidget*& determineClickedWidget(); - void unsetMoveSizeMode(); + void unsetMoveSizeMode() const; void closeDropDown(); void unselectMenubarItems(); void sendMouseEvent(); void sendMouseMoveEvent ( const FPoint& , const FPoint& - , int ); + , int ) const; void sendMouseLeftClickEvent ( const FPoint& , const FPoint& - , int ); + , int ) const; void sendMouseRightClickEvent ( const FPoint& , const FPoint& - , int ); + , int ) const; void sendMouseMiddleClickEvent ( const FPoint& , const FPoint& - , int ); - void sendWheelEvent (const FPoint&, const FPoint&); + , int ) const; + void sendWheelEvent (const FPoint&, const FPoint&) const; static FWidget* processParameters (const int&, char*[]); void processMouseEvent(); void processResizeEvent(); void processCloseWidget(); - void processLogger(); + void processLogger() const; bool processNextEvent(); void performTimerAction (FObject*, FEvent*) override; static bool isEventProcessable (const FObject*, const FEvent*); diff --git a/src/include/final/fbutton.h b/src/include/final/fbutton.h index cfe0145b..d454d7ee 100644 --- a/src/include/final/fbutton.h +++ b/src/include/final/fbutton.h @@ -147,7 +147,7 @@ class FButton : public FWidget void drawTopBottomBackground(); void drawButtonTextLine (const FString&); void draw() override; - void updateStatusBar(); + void updateStatusBar() const; void updateButtonColor(); void processClick(); diff --git a/src/include/final/fbuttongroup.h b/src/include/final/fbuttongroup.h index 1b544692..eb904cd9 100644 --- a/src/include/final/fbuttongroup.h +++ b/src/include/final/fbuttongroup.h @@ -130,7 +130,7 @@ class FButtonGroup : public FScrollView void directFocus(); // Callback method - void cb_buttonToggled (FWidget*, const FDataPtr); + void cb_buttonToggled (FWidget*, const FDataPtr) const; // Data members FString text{}; diff --git a/src/include/final/fcolorpalette.h b/src/include/final/fcolorpalette.h index 38130f0e..860c40b4 100644 --- a/src/include/final/fcolorpalette.h +++ b/src/include/final/fcolorpalette.h @@ -66,7 +66,7 @@ class FColorPalette virtual void resetColorPalette() = 0; protected: - void setPalette (FColor, int, int, int); + void setPalette (FColor, int, int, int) const; void setVGAdefaultPalette(); private: diff --git a/src/include/final/fdata.h b/src/include/final/fdata.h index 473e9484..e2749c76 100644 --- a/src/include/final/fdata.h +++ b/src/include/final/fdata.h @@ -27,13 +27,10 @@ #error "Only can be included directly." #endif -namespace -{ - template struct FData { - FData (T v) + explicit FData (T v) : value(v) { } @@ -48,15 +45,35 @@ struct FData return value(args...); } - operator T () const + explicit operator T () const { - return value; + return value; + } + + T& get() + { + return value; + } + + void set (const T& v) + { + value = v; + } + + FData& operator << (const T& v) + { + value = v; + return *this; + } + + friend std::ostream& operator << (std::ostream &os, const FData& data) + { + os << data.value; + return os; } T value; }; -} // namespace - #endif // FDATA_H diff --git a/src/include/final/fdialog.h b/src/include/final/fdialog.h index 1fea5066..3af946f2 100644 --- a/src/include/final/fdialog.h +++ b/src/include/final/fdialog.h @@ -188,7 +188,7 @@ class FDialog : public FWindow void openMenu(); void selectFirstMenuItem(); void setZoomItem(); - std::size_t getZoomButtonWidth(); + std::size_t getZoomButtonWidth() const; void activateZoomButton (const mouseStates&); void deactivateZoomButton(); void leaveZoomButton (const mouseStates&); diff --git a/src/include/final/ffiledialog.h b/src/include/final/ffiledialog.h index f9a10a73..82c48b19 100644 --- a/src/include/final/ffiledialog.h +++ b/src/include/final/ffiledialog.h @@ -116,7 +116,7 @@ class FFileDialog : public FDialog const FString getPath() const; const FString getFilter() const; const FString getSelectedFile() const; - bool getShowHiddenFiles(); + bool getShowHiddenFiles() const; // Mutators void setPath (const FString&); @@ -192,13 +192,13 @@ class FFileDialog : public FDialog void init(); void widgetSettings (const FPoint&); void initCallbacks(); - bool pattern_match (const char* const, const char[]); + bool patternMatch (const char* const, const char[]) const; void clear(); sInt64 numOfDirs(); void sortDir(); int readDir(); void getEntry (const char* const, const struct dirent*); - void followSymLink (const char* const, FDirEntry&); + void followSymLink (const char* const, FDirEntry&) const; void dirEntriesToList(); void selectDirectoryEntry (const char* const); int changeDir (const FString&); @@ -260,7 +260,7 @@ inline bool FFileDialog::unsetShowHiddenFiles() { return setShowHiddenFiles(false); } //---------------------------------------------------------------------- -inline bool FFileDialog::getShowHiddenFiles() +inline bool FFileDialog::getShowHiddenFiles() const { return show_hidden; } } // namespace finalcut diff --git a/src/include/final/fkeyboard.h b/src/include/final/fkeyboard.h index 7dd344e7..7b4535f6 100644 --- a/src/include/final/fkeyboard.h +++ b/src/include/final/fkeyboard.h @@ -62,7 +62,7 @@ class FKeyboardCommand final { } // Method - void execute() + void execute() const { handler(); } @@ -100,8 +100,8 @@ class FKeyboard final // Accessors const FString getClassName() const; - FKey getKey(); - const FString getKeyName (const FKey); + FKey getKey() const; + const FString getKeyName (const FKey) const; keybuffer& getKeyBuffer(); timeval* getKeyPressedTime(); static uInt64 getKeypressTimeout(); @@ -136,7 +136,7 @@ class FKeyboard final static constexpr FKey NOT_SET = static_cast(-1); // Accessors - FKey getMouseProtocolKey(); + FKey getMouseProtocolKey() const; FKey getTermcapKey(); FKey getMetaKey(); FKey getSingleKey(); @@ -150,11 +150,11 @@ class FKeyboard final static bool isKeypressTimeout(); // Methods - FKey UTF8decode (const char[]); + FKey UTF8decode (const char[]) const; ssize_t readKey(); void parseKeyBuffer(); FKey parseKeyString(); - FKey keyCorrection (const FKey&); + FKey keyCorrection (const FKey&) const; void substringKeyHandling(); void keyPressed(); void keyReleased(); @@ -192,7 +192,7 @@ inline const FString FKeyboard::getClassName() const { return "FKeyboard"; } //---------------------------------------------------------------------- -inline FKey FKeyboard::getKey() +inline FKey FKeyboard::getKey() const { return key; } //---------------------------------------------------------------------- diff --git a/src/include/final/flabel.h b/src/include/final/flabel.h index d73d0a06..c07b36db 100644 --- a/src/include/final/flabel.h +++ b/src/include/final/flabel.h @@ -84,12 +84,12 @@ class FLabel : public FWidget FLabel& operator << (const typeT&); FLabel& operator << (fc::SpecialCharacter); FLabel& operator << (const wchar_t); - const FLabel& operator >> (FString&); + const FLabel& operator >> (FString&) const; // Accessors const FString getClassName() const override; FWidget* getAccelWidget(); - fc::text_alignment getAlignment(); + fc::text_alignment getAlignment() const; FString& getText(); // Mutators @@ -132,7 +132,7 @@ class FLabel : public FWidget // Methods void init(); void setHotkeyAccelerator(); - std::size_t getAlignOffset (const std::size_t); + std::size_t getAlignOffset (const std::size_t) const; void draw() override; void drawMultiLine(); void drawSingleLine(); @@ -173,7 +173,7 @@ inline FWidget* FLabel::getAccelWidget () { return accel_widget; } //---------------------------------------------------------------------- -inline fc::text_alignment FLabel::getAlignment() +inline fc::text_alignment FLabel::getAlignment() const { return alignment; } //---------------------------------------------------------------------- diff --git a/src/include/final/flineedit.h b/src/include/final/flineedit.h index 59bac04a..60dee836 100644 --- a/src/include/final/flineedit.h +++ b/src/include/final/flineedit.h @@ -100,7 +100,7 @@ class FLineEdit : public FWidget FLineEdit& operator << (const typeT&); FLineEdit& operator << (fc::SpecialCharacter); FLineEdit& operator << (const wchar_t); - const FLineEdit& operator >> (FString&); + const FLineEdit& operator >> (FString&) const; // Accessors const FString getClassName() const override; @@ -108,7 +108,7 @@ class FLineEdit : public FWidget std::size_t getMaxLength() const; std::size_t getCursorPosition() const; FLabel* getLabelObject() const; - label_o getLabelOrientation(); + label_o getLabelOrientation() const; // Mutators void setText (const FString&); @@ -184,7 +184,7 @@ class FLineEdit : public FWidget void drawInputField(); std::size_t printTextField(); std::size_t printPassword(); - std::size_t getCursorColumnPos(); + std::size_t getCursorColumnPos() const; const FString getPasswordText() const; bool isPasswordField() const; offsetPair endPosToOffset (std::size_t); @@ -199,7 +199,7 @@ class FLineEdit : public FWidget void switchInsertMode(); void acceptInput(); bool keyInput (FKey); - wchar_t characterFilter (const wchar_t); + wchar_t characterFilter (const wchar_t) const; void processActivate(); void processChanged(); @@ -257,7 +257,7 @@ inline FLabel* FLineEdit::getLabelObject() const { return label; } //---------------------------------------------------------------------- -inline FLineEdit::label_o FLineEdit::getLabelOrientation() +inline FLineEdit::label_o FLineEdit::getLabelOrientation() const { return label_orientation; } //---------------------------------------------------------------------- diff --git a/src/include/final/flistbox.h b/src/include/final/flistbox.h index d628cfee..587dadbf 100644 --- a/src/include/final/flistbox.h +++ b/src/include/final/flistbox.h @@ -173,12 +173,12 @@ class FListBox : public FWidget void setCurrentItem (std::size_t); void setCurrentItem (listBoxItems::iterator); void selectItem (std::size_t); - void selectItem (listBoxItems::iterator); + void selectItem (listBoxItems::iterator) const; void unselectItem (std::size_t); - void unselectItem (listBoxItems::iterator); + void unselectItem (listBoxItems::iterator) const; void showInsideBrackets (const std::size_t, fc::brackets_type); void showNoBrackets (std::size_t); - void showNoBrackets (listBoxItems::iterator); + void showNoBrackets (listBoxItems::iterator) const; void setSize (const FSize&, bool = true) override; void setGeometry ( const FPoint&, const FSize& , bool = true ) override; @@ -259,7 +259,7 @@ class FListBox : public FWidget void processKeyAction (FKeyEvent*); void draw() override; void drawBorder() override; - void drawScrollbars(); + void drawScrollbars() const; void drawHeadline(); void drawList(); void drawListLine (int, listBoxItems::iterator, bool); @@ -267,10 +267,10 @@ class FListBox : public FWidget void printRightBracket (fc::brackets_type); void drawListBracketsLine (int, listBoxItems::iterator, bool); void setLineAttributes (int, bool, bool, bool&); - void unsetAttributes(); + void unsetAttributes() const; void updateDrawing (bool, bool); void recalculateHorizontalBar (std::size_t, bool); - void recalculateVerticalBar (std::size_t); + void recalculateVerticalBar (std::size_t) const; void getWidgetFocus(); void multiSelection (std::size_t); void multiSelectionUpTo (std::size_t); @@ -304,7 +304,7 @@ class FListBox : public FWidget void processClick(); void processSelect(); void processChanged(); - void changeOnResize(); + void changeOnResize() const; void lazyConvert (listBoxItems::iterator, int); listBoxItems::iterator index2iterator (std::size_t); listBoxItems::const_iterator index2iterator (std::size_t index) const; @@ -415,7 +415,7 @@ inline void FListBox::selectItem (std::size_t index) { index2iterator(index - 1)->selected = true; } //---------------------------------------------------------------------- -inline void FListBox::selectItem (listBoxItems::iterator iter) +inline void FListBox::selectItem (listBoxItems::iterator iter) const { iter->selected = true; } //---------------------------------------------------------------------- @@ -423,7 +423,7 @@ inline void FListBox::unselectItem (std::size_t index) { index2iterator(index - 1)->selected = false; } //---------------------------------------------------------------------- -inline void FListBox::unselectItem (listBoxItems::iterator iter) +inline void FListBox::unselectItem (listBoxItems::iterator iter) const { iter->selected = false; } //---------------------------------------------------------------------- @@ -431,7 +431,7 @@ inline void FListBox::showNoBrackets (std::size_t index) { index2iterator(index - 1)->brackets = fc::NoBrackets; } //---------------------------------------------------------------------- -inline void FListBox::showNoBrackets (listBoxItems::iterator iter) +inline void FListBox::showNoBrackets (listBoxItems::iterator iter) const { iter->brackets = fc::NoBrackets; } //---------------------------------------------------------------------- diff --git a/src/include/final/flistview.h b/src/include/final/flistview.h index 3e1fec87..79fb11be 100644 --- a/src/include/final/flistview.h +++ b/src/include/final/flistview.h @@ -103,8 +103,8 @@ class FListViewItem : public FObject // Methods iterator insert (FListViewItem*); - iterator insert (FListViewItem*, iterator); - void remove (FListViewItem*); + iterator insert (FListViewItem*, iterator) const; + void remove (FListViewItem*) const; void expand(); void collapse(); @@ -279,7 +279,7 @@ class FListView : public FWidget // Accessors const FString getClassName() const override; - std::size_t getCount(); + std::size_t getCount() const; fc::text_alignment getColumnAlignment (int) const; FString getColumnText (int) const; fc::sorting_type getColumnSortType (int) const; @@ -384,8 +384,8 @@ class FListView : public FWidget static void setNullIterator (const iterator&); // Inquiry - bool isHorizontallyScrollable(); - bool isVerticallyScrollable(); + bool isHorizontallyScrollable() const; + bool isVerticallyScrollable() const; // Methods void init(); @@ -395,7 +395,7 @@ class FListView : public FWidget void sort (Compare); std::size_t getAlignOffset ( const fc::text_alignment , const std::size_t - , const std::size_t ); + , const std::size_t ) const; iterator getListEnd (const FListViewItem*); void draw() override; void drawBorder() override; @@ -404,8 +404,8 @@ class FListView : public FWidget void drawList(); void drawListLine (const FListViewItem*, bool, bool); void clearList(); - void setLineAttributes (bool, bool); - FString getCheckBox (const FListViewItem* item); + void setLineAttributes (bool, bool) const; + FString getCheckBox (const FListViewItem* item) const; FString getLinePrefix (const FListViewItem*, std::size_t); void drawSortIndicator (std::size_t&, std::size_t); void drawHeadlineLabel (const headerItems::const_iterator&); @@ -430,7 +430,7 @@ class FListView : public FWidget iterator appendItem (FListViewItem*); void processClick(); void processChanged(); - void changeOnResize(); + void changeOnResize() const; void toggleCheckbox(); void collapseAndScrollLeft(); void expandAndScrollRight(); @@ -650,11 +650,11 @@ inline FObject::iterator FListView::endOfList() { return itemlist.end(); } //---------------------------------------------------------------------- -inline bool FListView::isHorizontallyScrollable() +inline bool FListView::isHorizontallyScrollable() const { return bool( max_line_width > getClientWidth() ); } //---------------------------------------------------------------------- -inline bool FListView::isVerticallyScrollable() +inline bool FListView::isVerticallyScrollable() const { return bool( getCount() > getClientHeight() ); } //---------------------------------------------------------------------- diff --git a/src/include/final/flog.h b/src/include/final/flog.h index 291bceec..20da08b3 100644 --- a/src/include/final/flog.h +++ b/src/include/final/flog.h @@ -97,9 +97,9 @@ class FLog : public std::stringbuf protected: int sync() override; - const LogLevel& getLevel(); + const LogLevel& getLevel() const; LogLevel& setLevel(); - const LineEnding& getEnding(); + const LineEnding& getEnding() const; LineEnding& setEnding(); private: @@ -131,7 +131,7 @@ inline const FString FLog::getClassName() const { return "FLog"; } //---------------------------------------------------------------------- -inline const FLog::LogLevel& FLog::getLevel() +inline const FLog::LogLevel& FLog::getLevel() const { return level; } //---------------------------------------------------------------------- @@ -139,7 +139,7 @@ inline FLog::LogLevel& FLog::setLevel() { return level; } //---------------------------------------------------------------------- -inline const FLog::LineEnding& FLog::getEnding() +inline const FLog::LineEnding& FLog::getEnding() const { return end_of_line; } //---------------------------------------------------------------------- diff --git a/src/include/final/flogger.h b/src/include/final/flogger.h index cbcc89e4..ea00fe06 100644 --- a/src/include/final/flogger.h +++ b/src/include/final/flogger.h @@ -85,8 +85,8 @@ class FLogger : public FLog private: // Methods - void newlineReplace (std::string&, const std::string&); - const std::string getTimeString(); + void newlineReplace (std::string&, const std::string&) const; + const std::string getTimeString() const; const std::string getEOL(); void printLogLine (const std::string&); diff --git a/src/include/final/fmenu.h b/src/include/final/fmenu.h index 3af7bd7e..69516a11 100644 --- a/src/include/final/fmenu.h +++ b/src/include/final/fmenu.h @@ -127,7 +127,7 @@ class FMenu : public FWindow, public FMenuList // Callback method void cb_menuitemEnabled (const FWidget*, const FDataPtr); void cb_menuitemDisabled (const FWidget*, const FDataPtr); - void cb_menuitemToggled (FWidget*, const FDataPtr); + void cb_menuitemToggled (FWidget*, const FDataPtr) const; private: // Constants @@ -169,13 +169,13 @@ class FMenu : public FWindow, public FMenuList bool isMouseOverMenu (const FPoint&); bool isMouseOverSubMenu (const FPoint&); bool isMouseOverSuperMenu (const FPoint&); - bool isMouseOverMenuBar (const FPoint&); + bool isMouseOverMenuBar (const FPoint&) const; // Methods void init(); void initCallbacks(); void calculateDimensions(); - void adjustItems(); + void adjustItems() const; int adjustX(int); void openSubMenu (FMenu*, bool = false); void closeOpenedSubMenu(); @@ -192,14 +192,14 @@ class FMenu : public FWindow, public FMenuList void mouseMoveOverBorder (mouseStates&); void passEventToSubMenu (FMouseEvent* const&); void passEventToSuperMenu (FMouseEvent* const&); - void passEventToMenuBar (FMouseEvent* const&); + void passEventToMenuBar (FMouseEvent* const&) const; bool containsMenuStructure (const FPoint&); bool containsMenuStructure (int, int); FMenu* superMenuAt (const FPoint&); FMenu* superMenuAt (int, int); bool selectNextItem(); bool selectPrevItem(); - void keypressMenuBar (FKeyEvent*); + void keypressMenuBar (FKeyEvent*) const; bool hotkeyMenu (FKeyEvent*); void draw() override; void drawItems(); @@ -211,7 +211,7 @@ class FMenu : public FWindow, public FMenuList void drawAcceleratorKey (std::size_t&, FKey); void drawTrailingSpaces (std::size_t); void setLineAttributes (const FMenuItem*, int); - void setCursorToHotkeyPosition (FMenuItem*); + void setCursorToHotkeyPosition (FMenuItem*) const; void selectPrevMenu (FKeyEvent*); void selectNextMenu (FKeyEvent*); void acceptSelection(); diff --git a/src/include/final/fmenubar.h b/src/include/final/fmenubar.h index 1cf243fd..6e0cbc73 100644 --- a/src/include/final/fmenubar.h +++ b/src/include/final/fmenubar.h @@ -99,7 +99,7 @@ class FMenuBar : public FWindow, public FMenuList void onAccel (FAccelEvent*) override; // Callback methods - void cb_itemDeactivated (FWidget*, const FDataPtr); + void cb_itemDeactivated (FWidget*, const FDataPtr) const; private: // Constants @@ -119,7 +119,7 @@ class FMenuBar : public FWindow, public FMenuList // Methods void init(); - void calculateDimensions(); + void calculateDimensions() const; bool selectNextItem(); bool selectPrevItem(); bool hotkeyMenu (FKeyEvent*&); @@ -127,12 +127,12 @@ class FMenuBar : public FWindow, public FMenuList void drawItems(); void drawItem (FMenuItem*, std::size_t&); void setLineAttributes (const FMenuItem*); - void setCursorToHotkeyPosition (FMenuItem*, std::size_t); + void setCursorToHotkeyPosition (FMenuItem*, std::size_t) const; void drawMenuText (menuText&); void drawEllipsis (const menuText&, std::size_t); void drawLeadingSpace (std::size_t&); void drawTrailingSpace (std::size_t&); - void adjustItems(); + void adjustItems() const; bool activateMenu (const FMenuItem*); bool clickItem (FMenuItem*); void unselectMenuItem (FMenuItem*); @@ -140,7 +140,7 @@ class FMenuBar : public FWindow, public FMenuList void mouseDownOverList (const FMouseEvent*); void mouseUpOverList (const FMouseEvent*); void mouseMoveOverList (const FMouseEvent*); - void passEventToMenu (const FMouseEvent* const&); + void passEventToMenu (const FMouseEvent* const&) const; void leaveMenuBar(); // Data members diff --git a/src/include/final/fmenuitem.h b/src/include/final/fmenuitem.h index 28fed5ad..eaa29dee 100644 --- a/src/include/final/fmenuitem.h +++ b/src/include/final/fmenuitem.h @@ -160,12 +160,12 @@ class FMenuItem : public FWidget void processDisable(); void processActivate(); void processDeactivate(); - void createDialogList (FMenu*); + void createDialogList (FMenu*) const; template - void passMouseEvent (T, const FMouseEvent*, fc::events); + void passMouseEvent (T, const FMouseEvent*, fc::events) const; // Callback methods - void cb_switchToDialog (const FWidget*, FDataPtr); + void cb_switchToDialog (const FWidget*, FDataPtr) const; void cb_destroyDialog (FWidget*, const FDataPtr); virtual void processClicked(); diff --git a/src/include/final/fmessagebox.h b/src/include/final/fmessagebox.h index 0f0f86ab..67f5692a 100644 --- a/src/include/final/fmessagebox.h +++ b/src/include/final/fmessagebox.h @@ -144,7 +144,7 @@ class FMessageBox : public FDialog void initCallbacks(); void calculateDimensions(); void draw() override; - void resizeButtons(); + void resizeButtons() const; void adjustButtons(); // Data members diff --git a/src/include/final/fmouse.h b/src/include/final/fmouse.h index 21abf106..5a1dc369 100644 --- a/src/include/final/fmouse.h +++ b/src/include/final/fmouse.h @@ -103,7 +103,7 @@ class FMouse // Accessors virtual const FString getClassName() const; - const FPoint& getPos(); + const FPoint& getPos() const; void clearEvent(); // Mutators @@ -113,7 +113,7 @@ class FMouse // Inquiries virtual bool hasData() = 0; - bool hasEvent(); + bool hasEvent() const; bool isLeftButtonPressed(); bool isLeftButtonReleased(); bool isLeftButtonDoubleClick(); @@ -127,7 +127,7 @@ class FMouse bool isWheelUp(); bool isWheelDown(); bool isMoved(); - bool isInputDataPending(); + bool isInputDataPending() const; // Methods template @@ -162,10 +162,10 @@ class FMouse // Accessors FMouseButton& getButtonState(); - const FPoint& getNewPos(); - uInt16 getMaxWidth(); - uInt16 getMaxHeight(); - uInt64 getDblclickInterval(); + const FPoint& getNewPos() const; + uInt16 getMaxWidth() const; + uInt16 getMaxHeight() const; + uInt64 getDblclickInterval() const; timeval* getMousePressedTime(); // Mutator @@ -177,7 +177,7 @@ class FMouse void resetMousePressedTime(); // Inquiry - bool isDblclickTimeout (const timeval*); + bool isDblclickTimeout (const timeval*) const; private: // Data members @@ -222,7 +222,7 @@ class FMouseGPM final : public FMouse // Inquiry bool hasData() override; - bool isGpmMouseEnabled(); + bool isGpmMouseEnabled() const; // Methods void setRawData (FKeyboard::keybuffer&) override; @@ -230,7 +230,7 @@ class FMouseGPM final : public FMouse bool gpmMouse (bool); bool enableGpmMouse(); bool disableGpmMouse(); - bool hasSignificantEvents(); + bool hasSignificantEvents() const; void interpretKeyDown(); void interpretKeyUp(); bool getGpmKeyPressed(bool); @@ -246,7 +246,7 @@ class FMouseGPM final : public FMouse }; // Method - int gpmEvent (bool = true); + int gpmEvent (bool = true) const; // Data member Gpm_Event gpm_ev{}; @@ -264,7 +264,7 @@ inline bool FMouseGPM::disableGpmMouse() { return gpmMouse(false); } //---------------------------------------------------------------------- -inline bool FMouseGPM::isGpmMouseEnabled() +inline bool FMouseGPM::isGpmMouseEnabled() const { return gpm_mouse_enabled; } #endif // F_HAVE_LIBGPM @@ -513,7 +513,7 @@ class FMouseControl // Accessor FMouse* getMouseWithData(); FMouse* getMouseWithEvent(); - void xtermMouse (bool); + void xtermMouse (bool) const; void enableXTermMouse(); void disableXTermMouse(); diff --git a/src/include/final/fobject.h b/src/include/final/fobject.h index 1593287d..39f5d82c 100644 --- a/src/include/final/fobject.h +++ b/src/include/final/fobject.h @@ -124,9 +124,9 @@ class FObject static void getCurrentTime (timeval*); static bool isTimeout (const timeval*, uInt64); int addTimer (int); - bool delTimer (int); - bool delOwnTimer(); - bool delAllTimer(); + bool delTimer (int) const; + bool delOwnTimer() const; + bool delAllTimer() const; protected: struct FTimerData diff --git a/src/include/final/foptiattr.h b/src/include/final/foptiattr.h index dcadbacb..95c38c97 100644 --- a/src/include/final/foptiattr.h +++ b/src/include/final/foptiattr.h @@ -244,7 +244,7 @@ class FOptiAttr final // Methods bool hasColorChanged (const FChar* const&, const FChar* const&) const; - void resetColor (FChar*&); + void resetColor (FChar*&) const; void prevent_no_color_video_attributes (FChar*&, bool = false); void deactivateAttributes (FChar*&, FChar*&); void changeAttributeSGR (FChar*&, FChar*&); @@ -252,14 +252,14 @@ class FOptiAttr final void change_color (FChar*&, FChar*&); void change_to_default_color (FChar*&, FChar*&, FColor&, FColor&); void change_current_color (const FChar* const&, FColor, FColor); - void resetAttribute (FChar*&); + void resetAttribute (FChar*&) const; void reset (FChar*&); - bool caused_reset_attributes (const char[], uChar = all_tests); + bool caused_reset_attributes (const char[], uChar = all_tests) const; bool hasCharsetEquivalence() const; void detectSwitchOn (const FChar* const&, const FChar* const&); void detectSwitchOff (const FChar* const&, const FChar* const&); - bool switchOn(); - bool switchOff(); + bool switchOn() const; + bool switchOff() const; bool append_sequence (const char[]); // Data members diff --git a/src/include/final/foptimove.h b/src/include/final/foptimove.h index 6d66223e..f7068b1f 100644 --- a/src/include/final/foptimove.h +++ b/src/include/final/foptimove.h @@ -143,7 +143,7 @@ class FOptiMove final void set_eat_newline_glitch (bool); // Methods - void check_boundaries (int&, int&, int&, int&); + void check_boundaries (int&, int&, int&, int&) const; const char* moveCursor (int, int, int, int); private: @@ -166,9 +166,9 @@ class FOptiMove final // Methods void calculateCharDuration(); - int capDuration (const char[], int); - int capDurationToLength (int); - int repeatedAppend (const capability&, volatile int, char*); + int capDuration (const char[], int) const; + int capDurationToLength (int) const; + int repeatedAppend (const capability&, volatile int, char*) const; int relativeMove (char[], int, int, int, int); int verticalMove (char[], int, int); void downMove (char[], int&, int, int); diff --git a/src/include/final/fprogressbar.h b/src/include/final/fprogressbar.h index 4d8c5cca..8f6bd4e8 100644 --- a/src/include/final/fprogressbar.h +++ b/src/include/final/fprogressbar.h @@ -70,7 +70,7 @@ class FProgressbar : public FWidget // Accessors const FString getClassName() const override; - std::size_t getPercentage(); + std::size_t getPercentage() const; // Mutators void setPercentage (std::size_t); @@ -112,7 +112,7 @@ inline const FString FProgressbar::getClassName() const { return "FProgressbar"; } //---------------------------------------------------------------------- -inline std::size_t FProgressbar::getPercentage() +inline std::size_t FProgressbar::getPercentage() const { return percentage; } //---------------------------------------------------------------------- diff --git a/src/include/final/fscrollbar.h b/src/include/final/fscrollbar.h index 327f76a1..3578cd70 100644 --- a/src/include/final/fscrollbar.h +++ b/src/include/final/fscrollbar.h @@ -139,9 +139,9 @@ class FScrollbar : public FWidget void drawHorizontalBackgroundColumn(); void drawButtons(); sType getClickedScrollType (int, int); - sType getVerticalClickedScrollType (int); - sType getHorizontalClickedScrollType (int); - int getSliderClickPos (int, int); + sType getVerticalClickedScrollType (int) const; + sType getHorizontalClickedScrollType (int) const; + int getSliderClickPos (int, int) const; void jumpToClickPos (int, int); void jumpToClickPos (int); void avoidScrollOvershoot(); diff --git a/src/include/final/fscrollview.h b/src/include/final/fscrollview.h index 69fcbbe9..e9d3a813 100644 --- a/src/include/final/fscrollview.h +++ b/src/include/final/fscrollview.h @@ -83,7 +83,7 @@ class FScrollView : public FWidget const FString getClassName() const override; std::size_t getViewportWidth() const; std::size_t getViewportHeight() const; - const FSize getViewportSize(); + const FSize getViewportSize() const; std::size_t getScrollWidth() const; std::size_t getScrollHeight() const; const FSize getScrollSize() const; @@ -157,18 +157,18 @@ class FScrollView : public FWidget static constexpr int horizontal_border_spacing = 2; // Accessors - const FPoint getViewportCursorPos(); + const FPoint getViewportCursorPos() const; // Methods void init(); void mapKeyFunctions(); - void calculateScrollbarPos(); + void calculateScrollbarPos() const; template void initScrollbar ( FScrollbarPtr& , fc::orientation , Callback ); - void setHorizontalScrollBarVisibility(); - void setVerticalScrollBarVisibility(); + void setHorizontalScrollBarVisibility() const; + void setVerticalScrollBarVisibility() const; void setViewportCursor(); // Callback methods @@ -203,7 +203,7 @@ inline std::size_t FScrollView::getViewportHeight() const { return getHeight() - horizontal_border_spacing; } //---------------------------------------------------------------------- -inline const FSize FScrollView::getViewportSize() +inline const FSize FScrollView::getViewportSize() const { return FSize(getViewportWidth(), getViewportHeight()); } //---------------------------------------------------------------------- diff --git a/src/include/final/fspinbox.h b/src/include/final/fspinbox.h index 809e51c4..9ed83b74 100644 --- a/src/include/final/fspinbox.h +++ b/src/include/final/fspinbox.h @@ -79,7 +79,7 @@ class FSpinBox : public FWidget // Accessors const FString getClassName() const override; - sInt64 getValue(); + sInt64 getValue() const; FString getPrefix() const; FString getSuffix() const; FLineEdit::label_o getLabelOrientation(); @@ -163,7 +163,7 @@ inline const FString FSpinBox::getClassName() const { return "FSpinBox"; } //---------------------------------------------------------------------- -inline sInt64 FSpinBox::getValue() +inline sInt64 FSpinBox::getValue() const { return value; } //---------------------------------------------------------------------- diff --git a/src/include/final/fstatusbar.h b/src/include/final/fstatusbar.h index a931223b..5a661aca 100644 --- a/src/include/final/fstatusbar.h +++ b/src/include/final/fstatusbar.h @@ -235,8 +235,8 @@ class FStatusBar : public FWindow // Methods void init(); - int getKeyNameWidth (const FStatusKey*); - int getKeyTextWidth (const FStatusKey*); + int getKeyNameWidth (const FStatusKey*) const; + int getKeyTextWidth (const FStatusKey*) const; void draw() override; void drawKeys(); void drawKey (keyList::const_iterator); diff --git a/src/include/final/fstring.h b/src/include/final/fstring.h index c5b9870f..d215f799 100644 --- a/src/include/final/fstring.h +++ b/src/include/final/fstring.h @@ -120,25 +120,26 @@ class FString , int>::type = 0 > FString& operator << (const NumT); - const FString& operator >> (FString&); - const FString& operator >> (std::wstring&); - const FString& operator >> (std::string&); - const FString& operator >> (wchar_t&); - const FString& operator >> (char&); - const FString& operator >> (sInt16&); - const FString& operator >> (uInt16&); - const FString& operator >> (sInt32&); - const FString& operator >> (uInt32&); - const FString& operator >> (sInt64&); - const FString& operator >> (uInt64&); - const FString& operator >> (double&); - const FString& operator >> (float&); + const FString& operator >> (FString&) const; + const FString& operator >> (std::wstring&) const; + const FString& operator >> (std::string&) const; + const FString& operator >> (wchar_t&) const; + const FString& operator >> (char&) const; + const FString& operator >> (sInt16&) const; + const FString& operator >> (uInt16&) const; + const FString& operator >> (sInt32&) const; + const FString& operator >> (uInt32&) const; + const FString& operator >> (sInt64&) const; + const FString& operator >> (uInt64&) const; + const FString& operator >> (double&) const; + const FString& operator >> (float&) const; template wchar_t& operator [] (const IndexT); template const wchar_t& operator [] (const IndexT) const; - const FString& operator () (); + explicit operator bool () const; + const FString& operator () () const; bool operator < (const FString&) const; template @@ -227,7 +228,7 @@ class FString const FString& insert (const FString&, int); const FString& insert (const FString&, std::size_t); - const FString replace (const FString&, const FString&); + const FString replace (const FString&, const FString&) const; const FString replaceControlCodes() const; const FString expandTabs (int = 8) const; @@ -254,7 +255,7 @@ class FString void _remove (std::size_t, std::size_t); const char* _to_cstring (const wchar_t[]) const; const wchar_t* _to_wcstring (const char[]) const; - const wchar_t* _extractToken (wchar_t*[], const wchar_t[], const wchar_t[]); + const wchar_t* _extractToken (wchar_t*[], const wchar_t[], const wchar_t[]) const; // Data members wchar_t* string{nullptr}; diff --git a/src/include/final/fterm.h b/src/include/final/fterm.h index 641c2f0d..0e1f38b5 100644 --- a/src/include/final/fterm.h +++ b/src/include/final/fterm.h @@ -349,16 +349,16 @@ class FTerm final static void enableAlternateCharset(); static void useAlternateScreenBuffer(); static void useNormalScreenBuffer(); - void allocationValues(); + void allocationValues() const; void deallocationValues(); void init(); bool init_terminal(); - void initOSspecifics(); - void initTermspecifics(); - void initBaudRate(); + void initOSspecifics() const; + void initTermspecifics() const; + void initBaudRate() const; void finish(); - void finishOSspecifics(); - void finish_encoding(); + void finishOSspecifics() const; + void finish_encoding() const; void destroyColorPaletteTheme(); static void printExitMessage(); static void terminalSizeChange(); @@ -475,10 +475,6 @@ inline void FTerm::initTerminal() } // namespace finalcut - -namespace -{ - //---------------------------------------------------------------------- inline std::ostream& operator << ( std::ostream& os , finalcut::fc::SpecialCharacter c ) @@ -493,6 +489,4 @@ inline std::wostream& operator << ( std::wostream& os return os << static_cast(c); } -} // namespace - #endif // FTERM_H diff --git a/src/include/final/ftermbuffer.h b/src/include/final/ftermbuffer.h index 2a5e4c41..ffe26694 100644 --- a/src/include/final/ftermbuffer.h +++ b/src/include/final/ftermbuffer.h @@ -98,8 +98,8 @@ class FTermBuffer int writef (const FString&, Args&&...); int write (const FString&); int write (wchar_t); - void write (const FStyle&); - void write (const FColorPair&); + void write (const FStyle&) const; + void write (const FColorPair&) const; FTermBuffer& write (); private: diff --git a/src/include/final/ftermdata.h b/src/include/final/ftermdata.h index 7c6aae50..1ba99f3e 100644 --- a/src/include/final/ftermdata.h +++ b/src/include/final/ftermdata.h @@ -78,8 +78,8 @@ class FTermData final FRect& getTermGeometry(); int getTTYFileDescriptor() const; uInt getBaudrate() const; - const char* getTermType(); - const char* getTermFileName(); + const char* getTermType() const; + const char* getTermFileName() const; const FString& getXtermFont() const; const FString& getXtermTitle() const; const FString& getExitMessage() const; @@ -194,11 +194,11 @@ inline uInt FTermData::getBaudrate() const { return baudrate; } //---------------------------------------------------------------------- -inline const char* FTermData::getTermType() +inline const char* FTermData::getTermType() const { return termtype; } //---------------------------------------------------------------------- -inline const char* FTermData::getTermFileName() +inline const char* FTermData::getTermFileName() const { return termfilename; } //---------------------------------------------------------------------- diff --git a/src/include/final/ftermlinux.h b/src/include/final/ftermlinux.h index 7906fc1e..52e043ee 100644 --- a/src/include/final/ftermlinux.h +++ b/src/include/final/ftermlinux.h @@ -94,14 +94,14 @@ class FTermLinux final // Accessors const FString getClassName() const; - fc::linuxConsoleCursorStyle getCursorStyle(); + fc::linuxConsoleCursorStyle getCursorStyle() const; char* getCursorStyleString(); int getFramebufferBpp() const; // Mutators bool setCursorStyle (CursorStyle); bool setPalette (FColor, int, int, int); - void setUTF8 (bool); + void setUTF8 (bool) const; // Inquiries bool isLinuxConsole(); @@ -117,8 +117,8 @@ class FTermLinux final bool loadOldFont(); bool saveColorMap(); bool resetColorMap(); - void setBeep (int, int); - void resetBeep(); + void setBeep (int, int) const; + void resetBeep() const; FKey modifierKeyCorrection (const FKey&); @@ -155,7 +155,7 @@ class FTermLinux final int setScreenFont ( uChar[], uInt, uInt, uInt , bool = false ); int setUnicodeMap (struct unimapdesc*); - void setLinuxCursorStyle (fc::linuxConsoleCursorStyle); + void setLinuxCursorStyle (fc::linuxConsoleCursorStyle) const; // Methods #if defined(ISA_SYSCTL_SUPPORT) @@ -172,14 +172,14 @@ class FTermLinux final bool saveVGAPalette(); bool resetVGAPalette(); #endif // defined(ISA_SYSCTL_SUPPORT) - FKey shiftKeyCorrection (const FKey&); - FKey ctrlKeyCorrection (const FKey&); - FKey altKeyCorrection (const FKey&); - FKey shiftCtrlKeyCorrection (const FKey&); - FKey shiftAltKeyCorrection (const FKey&); - FKey ctrlAltKeyCorrection (const FKey&); - FKey shiftCtrlAltKeyCorrection (const FKey&); - sInt16 getFontPos (wchar_t ucs); + FKey shiftKeyCorrection (const FKey&) const; + FKey ctrlKeyCorrection (const FKey&) const; + FKey altKeyCorrection (const FKey&) const; + FKey shiftCtrlKeyCorrection (const FKey&) const; + FKey shiftAltKeyCorrection (const FKey&) const; + FKey ctrlAltKeyCorrection (const FKey&) const; + FKey shiftCtrlAltKeyCorrection (const FKey&) const; + sInt16 getFontPos (wchar_t ucs) const; void initSpecialCharacter(); void characterFallback (wchar_t, std::vector); diff --git a/src/include/final/ftermxterminal.h b/src/include/final/ftermxterminal.h index f04fa607..ead250de 100644 --- a/src/include/final/ftermxterminal.h +++ b/src/include/final/ftermxterminal.h @@ -110,7 +110,7 @@ class FTermXTerminal final private: // Methods - void warnNotInitialized(); + void warnNotInitialized() const; void setXTermCursorStyle(); void setXTermFont(); void setXTermTitle(); @@ -132,7 +132,7 @@ class FTermXTerminal final void resetXTermMouseForeground(); void resetXTermMouseBackground(); void resetXTermHighlightBackground(); - bool isInitialized(); + bool isInitialized() const; bool canResetColor(); void oscPrefix(); void oscPostfix(); @@ -225,7 +225,7 @@ inline void FTermXTerminal::unsetMouseSupport() { setMouseSupport (false); } //---------------------------------------------------------------------- -inline bool FTermXTerminal::isInitialized() +inline bool FTermXTerminal::isInitialized() const { return bool(fsystem && term_detection); } } // namespace finalcut diff --git a/src/include/final/ftextview.h b/src/include/final/ftextview.h index aec225d1..f8d6996c 100644 --- a/src/include/final/ftextview.h +++ b/src/include/final/ftextview.h @@ -141,8 +141,8 @@ class FTextView : public FWidget typedef std::unordered_map> keyMap; // Accessors - std::size_t getTextHeight(); - std::size_t getTextWidth(); + std::size_t getTextHeight() const; + std::size_t getTextWidth() const; // Inquiry bool isHorizontallyScrollable(); @@ -155,10 +155,10 @@ class FTextView : public FWidget void drawBorder() override; void drawScrollbars(); void drawText(); - bool useFDialogBorder(); - bool isPrintable (wchar_t); + bool useFDialogBorder() const; + bool isPrintable (wchar_t) const; void processChanged(); - void changeOnResize(); + void changeOnResize() const; // Callback methods void cb_vbarChange (const FWidget*, const FDataPtr); diff --git a/src/include/final/ftogglebutton.h b/src/include/final/ftogglebutton.h index 42707ed9..51ee8a32 100644 --- a/src/include/final/ftogglebutton.h +++ b/src/include/final/ftogglebutton.h @@ -149,7 +149,7 @@ class FToggleButton : public FWidget // Methods void init(); void drawText (const FString&, std::size_t); - void correctSize (FSize&); + void correctSize (FSize&) const; // Data members FButtonGroup* button_group{nullptr}; diff --git a/src/include/final/ftypes.h b/src/include/final/ftypes.h index 8285be69..19862ed2 100644 --- a/src/include/final/ftypes.h +++ b/src/include/final/ftypes.h @@ -47,9 +47,6 @@ << " in " \ << __func__ << std::endl; -namespace -{ - typedef unsigned char uChar; typedef unsigned short uShort; typedef unsigned int uInt; @@ -73,8 +70,6 @@ typedef uInt16 FAttribute; typedef uInt32 FKey; typedef void* FDataPtr; -} // namespace - namespace finalcut { @@ -82,7 +77,7 @@ namespace finalcut template struct is_negative { - inline bool operator () (const T& x) + inline bool operator () (const T& x) const { return x < 0; } @@ -91,7 +86,7 @@ struct is_negative template struct is_negative { - inline bool operator () (const T&) + inline bool operator () (const T&) const { return false; } diff --git a/src/include/final/fvterm.h b/src/include/final/fvterm.h index 0357304f..7b47c9a4 100644 --- a/src/include/final/fvterm.h +++ b/src/include/final/fvterm.h @@ -151,14 +151,14 @@ class FVTerm FTerm& getFTerm(); // Mutators - void setTermXY (int, int); + void setTermXY (int, int) const; void setTerminalUpdates (terminal_update); - void hideCursor (bool); - void hideCursor(); - void showCursor(); + void hideCursor (bool) const; + void hideCursor() const; + void showCursor() const; void setPrintCursor (const FPoint&); - FColor rgb2ColorIndex (uInt8, uInt8, uInt8); + FColor rgb2ColorIndex (uInt8, uInt8, uInt8) const; static void setColor (FColor, FColor); static void setNormal(); @@ -287,7 +287,7 @@ class FVTerm // Mutators void setPrintArea (FTermArea*); void setChildPrintArea (FTermArea*); - void setActiveArea (FTermArea*); + void setActiveArea (FTermArea*) const; // Inquiries bool hasPrintArea() const; @@ -339,7 +339,8 @@ class FVTerm static constexpr uInt TERMINAL_OUTPUT_BUFFER_SIZE = 32768; // Methods - void setTextToDefault (const FTermArea*, const FSize&); + void resetTextAreaToDefault ( const FTermArea* + , const FSize&) const; static bool reallocateTextArea ( FTermArea* , std::size_t , std::size_t ); @@ -366,7 +367,7 @@ class FVTerm void updateVTerm(); static void callPreprocessingHandler (const FTermArea*); bool hasChildAreaChanges (FTermArea*) const; - void clearChildAreaChanges (const FTermArea*); + void clearChildAreaChanges (const FTermArea*) const; static bool isInsideArea (const FPoint&, const FTermArea*); static const FChar generateCharacter (const FPoint&); static const FChar getCharacter ( character_type @@ -390,30 +391,30 @@ class FVTerm static bool canClearTrailingWS (uInt&, uInt); bool skipUnchangedCharacters (uInt&, uInt, uInt); void printRange (uInt, uInt, uInt, bool); - void replaceNonPrintableFullwidth (uInt, FChar*&); + void replaceNonPrintableFullwidth (uInt, FChar*&) const; void printCharacter (uInt&, uInt, bool, FChar*&); void printFullWidthCharacter (uInt&, uInt, FChar*&); void printFullWidthPaddingCharacter (uInt&, uInt, FChar*&); void printHalfCovertFullWidthCharacter (uInt&, uInt, FChar*&); - void skipPaddingCharacter (uInt&, uInt, const FChar* const&); + void skipPaddingCharacter (uInt&, uInt, const FChar* const&) const; exit_state eraseCharacters (uInt&, uInt, uInt, bool); exit_state repeatCharacter (uInt&, uInt, uInt); bool isFullWidthChar (const FChar* const&) const; bool isFullWidthPaddingChar (const FChar* const&) const; static void cursorWrap(); - bool printWrap (FTermArea*); + bool printWrap (FTermArea*) const; void printPaddingCharacter (FTermArea*, const FChar&); void updateTerminalLine (uInt); bool updateTerminalCursor(); - bool isInsideTerminal (const FPoint&); - bool isTermSizeChanged(); + bool isInsideTerminal (const FPoint&) const; + bool isTermSizeChanged() const; static void markAsPrinted (uInt, uInt); static void markAsPrinted (uInt, uInt, uInt); static void newFontChanges (FChar*&); static void charsetChanges (FChar*&); void appendCharacter (FChar*&); void appendChar (FChar*&); - void appendAttributes (FChar*&); + void appendAttributes (FChar*&) const; int appendLowerRight (FChar*&); static void characterFilter (FChar*&); static void appendOutputBuffer (const std::string&); @@ -629,11 +630,11 @@ inline FTerm& FVTerm::getFTerm() { return *fterm; } //---------------------------------------------------------------------- -inline void FVTerm::hideCursor() +inline void FVTerm::hideCursor() const { return hideCursor(true); } //---------------------------------------------------------------------- -inline void FVTerm::showCursor() +inline void FVTerm::showCursor() const { return hideCursor(false); } //---------------------------------------------------------------------- @@ -957,7 +958,7 @@ inline void FVTerm::setChildPrintArea (FTermArea* area) { child_print_area = area; } //---------------------------------------------------------------------- -inline void FVTerm::setActiveArea (FTermArea* area) +inline void FVTerm::setActiveArea (FTermArea* area) const { active_area = area; } //---------------------------------------------------------------------- diff --git a/src/include/final/fwidget.h b/src/include/final/fwidget.h index 63a40618..3f8c0000 100644 --- a/src/include/final/fwidget.h +++ b/src/include/final/fwidget.h @@ -233,10 +233,10 @@ class FWidget : public FVTerm, public FObject const FRect& getGeometryWithShadow(); const FRect& getTermGeometry(); const FRect& getTermGeometryWithShadow(); - std::size_t getDesktopWidth(); - std::size_t getDesktopHeight(); + std::size_t getDesktopWidth() const; + std::size_t getDesktopHeight() const; const FWidgetFlags& getFlags() const; - const FPoint getCursorPos(); + const FPoint getCursorPos() const; const FPoint getPrintPos(); // Mutators @@ -272,7 +272,7 @@ class FWidget : public FVTerm, public FObject virtual void setBackgroundColor (FColor); virtual void resetColors(); void useParentWidgetColor(); - void setColor(); + void setColor() const; FWidgetFlags& setFlags(); // Positioning and sizes mutators... virtual void setX (int, bool = true); @@ -285,7 +285,7 @@ class FWidget : public FVTerm, public FObject void setLeftPadding (int, bool = true); void setBottomPadding (int, bool = true); void setRightPadding (int, bool = true); - void setTermSize (const FSize&); + void setTermSize (const FSize&) const; virtual void setGeometry (const FRect&, bool = true); virtual void setGeometry (const FPoint&, const FSize&, bool = true); virtual void setShadowSize (const FSize&); @@ -344,7 +344,7 @@ class FWidget : public FVTerm, public FObject virtual void hide(); virtual bool focusFirstChild(); // widget focusing virtual bool focusLastChild(); - const FPoint termToWidgetPos (const FPoint&); + const FPoint termToWidgetPos (const FPoint&) const; void print (const FPoint&) override; virtual void move (const FPoint&); virtual void drawBorder(); @@ -368,7 +368,7 @@ class FWidget : public FVTerm, public FObject // Inquiry bool isChildPrintArea() const; - + // Mutators virtual void setStatusBar (FStatusBar*); virtual void setMenuBar (FMenuBar*); @@ -381,7 +381,7 @@ class FWidget : public FVTerm, public FObject void initTerminal() override; void initDesktop(); virtual void adjustSize(); - void adjustSizeGlobal(); + void adjustSizeGlobal() const; void hideArea (const FSize&); virtual bool focusNextChild(); // Change child... virtual bool focusPrevChild(); // ...focus @@ -465,12 +465,12 @@ class FWidget : public FVTerm, public FObject bool changeFocus (FWidget*, FWidget*, fc::FocusTypes); void processDestroy(); virtual void draw(); - void drawWindows(); + void drawWindows() const; void drawChildren(); static bool isDefaultTheme(); static void initColorTheme(); void destroyColorTheme(); - void setStatusbarText (bool); + void setStatusbarText (bool) const; // Data members struct FWidgetFlags flags{}; @@ -817,11 +817,11 @@ inline const FRect& FWidget::getTermGeometryWithShadow() } //---------------------------------------------------------------------- -inline std::size_t FWidget::getDesktopWidth() +inline std::size_t FWidget::getDesktopWidth() const { return FTerm::getColumnNumber(); } //---------------------------------------------------------------------- -inline std::size_t FWidget::getDesktopHeight() +inline std::size_t FWidget::getDesktopHeight() const { return FTerm::getLineNumber(); } //---------------------------------------------------------------------- @@ -829,7 +829,7 @@ inline const FWidget::FWidgetFlags& FWidget::getFlags() const { return flags; } //---------------------------------------------------------------------- -inline const FPoint FWidget::getCursorPos() +inline const FPoint FWidget::getCursorPos() const { return widget_cursor_position; } //---------------------------------------------------------------------- @@ -1071,7 +1071,7 @@ inline void FWidget::delAccelerator() { delAccelerator(this); } //---------------------------------------------------------------------- -inline const FPoint FWidget::termToWidgetPos (const FPoint& tPos) +inline const FPoint FWidget::termToWidgetPos (const FPoint& tPos) const { return { tPos.getX() + 1 - woffset.getX1() - adjust_wsize.getX() , tPos.getY() + 1 - woffset.getY1() - adjust_wsize.getY() }; diff --git a/src/include/final/fwindow.h b/src/include/final/fwindow.h index 34df1509..f73d4c18 100644 --- a/src/include/final/fwindow.h +++ b/src/include/final/fwindow.h @@ -96,7 +96,7 @@ class FWindow : public FWidget void setWindowFocusWidget (FWidget*); bool activateWindow (bool); bool activateWindow(); - void unsetActiveWindow(); + void unsetActiveWindow() const; bool deactivateWindow(); virtual bool setResizeable (bool); virtual bool setResizeable();