From 98f9cd5718314e1ac54027f91234723731f53ace Mon Sep 17 00:00:00 2001 From: Markus Gans Date: Sun, 25 Oct 2020 01:21:45 +0200 Subject: [PATCH] Replace pointers with references --- examples/choice.cpp | 2 +- examples/listbox.cpp | 4 +- examples/mouse.cpp | 20 +- examples/rotozoomer.cpp | 4 +- examples/scrollview.cpp | 4 +- examples/transparent.cpp | 2 +- examples/ui.cpp | 2 +- src/fapplication.cpp | 10 +- src/fbutton.cpp | 4 +- src/fbuttongroup.cpp | 2 +- src/fcombobox.cpp | 8 +- src/fdialog.cpp | 2 +- src/ffiledialog.cpp | 6 +- src/flistbox.cpp | 4 +- src/flistview.cpp | 4 +- src/fmenu.cpp | 26 +- src/fmenubar.cpp | 16 +- src/fmenuitem.cpp | 3 + src/foptiattr.cpp | 548 ++--- src/fscrollbar.cpp | 10 +- src/fscrollview.cpp | 17 +- src/fstatusbar.cpp | 2 +- src/fterm.cpp | 4 +- src/ftermdetection.cpp | 4 +- src/ftextview.cpp | 2 +- src/fvterm.cpp | 214 +- src/fwidget.cpp | 2 +- src/fwidget_functions.cpp | 6 +- src/fwindow.cpp | 2 +- src/include/final/fapplication.h | 2 +- src/include/final/fcombobox.h | 2 +- src/include/final/fmenu.h | 6 +- src/include/final/fmenubar.h | 2 +- src/include/final/foptiattr.h | 98 +- src/include/final/fterm.h | 2 +- src/include/final/fvterm.h | 26 +- test/fobject-test.cpp | 2 +- test/foptiattr-test.cpp | 3211 +++++++++++++++--------------- test/fstring-test.cpp | 5 +- 39 files changed, 2061 insertions(+), 2229 deletions(-) diff --git a/examples/choice.cpp b/examples/choice.cpp index e8a5fb8c..beec8393 100644 --- a/examples/choice.cpp +++ b/examples/choice.cpp @@ -147,7 +147,7 @@ int main (int argc, char* argv[]) dgl.show(); // Get the checked radio button text - for (int n{1}; n <= int(checkButtonGroup.getCount()); n++) + for (auto n{1}; n <= int(checkButtonGroup.getCount()); n++) { if ( checkButtonGroup.isChecked(n) ) { diff --git a/examples/listbox.cpp b/examples/listbox.cpp index 3c5cef26..e1af5c0e 100644 --- a/examples/listbox.cpp +++ b/examples/listbox.cpp @@ -116,12 +116,12 @@ Listbox::Listbox (FWidget* parent) list1.setGeometry(FPoint{2, 1}, FSize{18, 10}); list1.setText ("FListBoxItem"); - for (int i{1}; i < 30; i++) + for (auto i{1}; i < 30; i++) list1.insert (L"----- " + (FString{} << i) + L" -----"); // listbox 2 //---------- - for (int i{1}; i <= 15; i++) + for (auto i{1}; i <= 15; i++) double_list.push_back(2 * double(i) + (double(i) / 100)); list2.setGeometry(FPoint{21, 1}, FSize{10, 10}); diff --git a/examples/mouse.cpp b/examples/mouse.cpp index 5d76c3d3..e876a06e 100644 --- a/examples/mouse.cpp +++ b/examples/mouse.cpp @@ -152,7 +152,7 @@ void ColorChooser::onMouseDown (finalcut::FMouseEvent* ev) if ( ev->getButton() == fc::MiddleButton ) return; - for (int c{0}; c < 16; c++) + for (auto c{0}; c < 16; c++) { const int xmin = 2 + (c / 8) * 3; const int xmax = 4 + (c / 8) * 3; @@ -434,7 +434,7 @@ void MouseDraw::draw() if ( finalcut::FTerm::isNewFont() ) { - for (int y{2}; y < y_max; y++) + for (auto y{2}; y < y_max; y++) { print() << FPoint{10, y} << fc::NF_rev_border_line_right; @@ -448,7 +448,7 @@ void MouseDraw::draw() print() << FPoint{10, 2} << fc::BoxDrawingsDownAndHorizontal; - for (int y{3}; y < y_max; y++) + for (auto y{3}; y < y_max; y++) { print() << FPoint{10, y} << fc::BoxDrawingsVertical; } @@ -503,14 +503,14 @@ void MouseDraw::drawCanvas() const int x_end = canvas->width; const int w_line_len = printarea->width + printarea->right_shadow; - for (int y{0}; y < y_end; y++) // line loop + for (auto y{0}; y < y_end; y++) // line loop { - const finalcut::FChar* canvaschar{}; // canvas character - finalcut::FChar* winchar{}; // window character - canvaschar = &canvas->data[y * x_end]; - winchar = &printarea->data[(ay + y) * w_line_len + ax]; - std::memcpy ( winchar - , canvaschar + // canvas character + const auto& canvaschar = canvas->data[y * x_end]; + // window character + auto& winchar = printarea->data[(ay + y) * w_line_len + ax]; + std::memcpy ( &winchar + , &canvaschar , sizeof(finalcut::FChar) * unsigned(x_end) ); if ( int(printarea->changes[ay + y].xmin) > ax ) diff --git a/examples/rotozoomer.cpp b/examples/rotozoomer.cpp index 9826b86c..8d1d4a34 100644 --- a/examples/rotozoomer.cpp +++ b/examples/rotozoomer.cpp @@ -157,13 +157,13 @@ void RotoZoomer::rotozoomer (double cx, double cy, double r, double a) int dxdy = (Cx - Ax) / 23; int dydy = (Cy - Ay) / 23; - for (int y = 0; y < Lines; y++) + for (auto y = 0; y < Lines; y++) { Cx = Ax; Cy = Ay; print() << FPoint{2, 3 + y}; - for (int x = 0; x < Cols; x++) + for (auto x = 0; x < Cols; x++) { auto ch = data[((Cy >> 14) & 0xf) + ((Cx >> 10) & 0xf0)]; diff --git a/examples/scrollview.cpp b/examples/scrollview.cpp index 6ef8b54f..7453bfbf 100644 --- a/examples/scrollview.cpp +++ b/examples/scrollview.cpp @@ -135,11 +135,11 @@ void Scrollview::draw() setColor (wc->label_inactive_fg, wc->dialog_bg); clearArea(); - for (int y{0}; y < int(getScrollHeight()); y++) + for (auto y{0}; y < int(getScrollHeight()); y++) { print() << FPoint{1, 1 + y}; - for (int x{0}; x < int(getScrollWidth()); x++) + for (auto x{0}; x < int(getScrollWidth()); x++) print (32 + ((x + y) % 0x5f)); } diff --git a/examples/transparent.cpp b/examples/transparent.cpp index 71d3167e..b12392e1 100644 --- a/examples/transparent.cpp +++ b/examples/transparent.cpp @@ -113,7 +113,7 @@ void Transparent::draw() const finalcut::FString line{getClientWidth(), '.'}; // Fill window area - for (int n{1}; n <= int(getClientHeight()); n++) + for (auto n{1}; n <= int(getClientHeight()); n++) { print() << FPoint{2, 2 + n} << line; diff --git a/examples/ui.cpp b/examples/ui.cpp index 721764b0..94f453b3 100644 --- a/examples/ui.cpp +++ b/examples/ui.cpp @@ -597,7 +597,7 @@ void MyDialog::initWidgets() myList.setMultiSelection(); myList.reserve(100); - for (int z{1}; z < 100; z++) + for (auto z{1}; z < 100; z++) myList.insert (finalcut::FString{} << z << L" placeholder"); // Text labels diff --git a/src/fapplication.cpp b/src/fapplication.cpp index f11e6f5e..4421a77d 100644 --- a/src/fapplication.cpp +++ b/src/fapplication.cpp @@ -776,7 +776,7 @@ inline void FApplication::sendKeyboardAccelerator() auto window = static_cast(getActiveWindow()); if ( window ) - accpt = processAccelerator (window); + accpt = processAccelerator(*window); } // Global keyboard accelerator @@ -785,7 +785,7 @@ inline void FApplication::sendKeyboardAccelerator() auto root_widget = getRootWidget(); if ( root_widget ) - processAccelerator (root_widget); + processAccelerator(*root_widget); } } @@ -836,12 +836,12 @@ bool FApplication::processDialogSwitchAccelerator() const } //---------------------------------------------------------------------- -bool FApplication::processAccelerator (const FWidget* const& widget) const +bool FApplication::processAccelerator (const FWidget& widget) const { - if ( ! widget || widget->getAcceleratorList().empty() ) + if ( widget.getAcceleratorList().empty() ) return false; - for (auto&& item : widget->getAcceleratorList()) + for (auto&& item : widget.getAcceleratorList()) { if ( item.key == keyboard->getKey() ) { diff --git a/src/fbutton.cpp b/src/fbutton.cpp index d0134c8b..9316baf9 100644 --- a/src/fbutton.cpp +++ b/src/fbutton.cpp @@ -443,7 +443,7 @@ inline std::size_t FButton::clickAnimationIndent (const FWidget* parent_widget) setColor ( parent_widget->getForegroundColor() , parent_widget->getBackgroundColor() ); - for (int y{1}; y <= int(getHeight()); y++) + for (auto y{1}; y <= int(getHeight()); y++) { print() << FPoint{1, y} << ' '; // clear one left █ } @@ -462,7 +462,7 @@ inline void FButton::clearRightMargin (const FWidget* parent_widget) setColor ( parent_widget->getForegroundColor() , parent_widget->getBackgroundColor() ); - for (int y{1}; y <= int(getHeight()); y++) + for (auto y{1}; y <= int(getHeight()); y++) { if ( FTerm::isMonochron() ) setReverse(true); // Light background diff --git a/src/fbuttongroup.cpp b/src/fbuttongroup.cpp index 67287d5f..41317b3b 100644 --- a/src/fbuttongroup.cpp +++ b/src/fbuttongroup.cpp @@ -210,7 +210,7 @@ void FButtonGroup::hide() // Hide border unsetViewportPrint(); - for (int y{0}; y < int(getHeight()); y++) + for (auto y{0}; y < int(getHeight()); y++) print() << FPoint{1, 1 + y} << FString{size, L' '}; setViewportPrint(); diff --git a/src/fcombobox.cpp b/src/fcombobox.cpp index 46719e50..be66c27d 100644 --- a/src/fcombobox.cpp +++ b/src/fcombobox.cpp @@ -436,7 +436,7 @@ void FComboBox::onMouseMove (FMouseEvent* ev) if ( isMouseOverListWindow(ev->getTermPos()) ) { - passEventToListWindow(ev); // Event handover to window list + passEventToListWindow(*ev); // Event handover to window list return; } } @@ -590,13 +590,13 @@ void FComboBox::onePosDown() } //---------------------------------------------------------------------- -void FComboBox::passEventToListWindow (FMouseEvent* const& ev) +void FComboBox::passEventToListWindow (const FMouseEvent& ev) { // Mouse event handover to list window - const auto& t = ev->getTermPos(); + const auto& t = ev.getTermPos(); const auto& p = list_window.list.termToWidgetPos(t); - const int b = ev->getButton(); + const int b = ev.getButton(); try { diff --git a/src/fdialog.cpp b/src/fdialog.cpp index f4747aa7..2748c88d 100644 --- a/src/fdialog.cpp +++ b/src/fdialog.cpp @@ -960,7 +960,7 @@ void FDialog::drawBorder() { const FRect r{FPoint{1, 1}, getSize()}; - for (int y = r.getY1() + 1; y < r.getY2(); y++) + for (auto y = r.getY1() + 1; y < r.getY2(); y++) { print() << FPoint{r.getX1(), y} << fc::NF_border_line_left // border left ⎸ diff --git a/src/ffiledialog.cpp b/src/ffiledialog.cpp index 7e74f497..0ea6e0de 100644 --- a/src/ffiledialog.cpp +++ b/src/ffiledialog.cpp @@ -179,7 +179,7 @@ FString FFileDialog::getSelectedFile() const //---------------------------------------------------------------------- void FFileDialog::setPath (const FString& dir) { - const char* const dirname = dir.c_str(); + const auto& dirname = dir.c_str(); std::array resolved_path{}; FString r_dir{}; struct stat sb{}; @@ -491,7 +491,7 @@ void FFileDialog::sortDir() //---------------------------------------------------------------------- int FFileDialog::readDir() { - const char* const dir = directory.c_str(); + const auto& dir = directory.c_str(); directory_stream = opendir(dir); if ( ! directory_stream ) @@ -555,7 +555,7 @@ int FFileDialog::readDir() //---------------------------------------------------------------------- void FFileDialog::getEntry (const char* const dir, const struct dirent* d_entry) { - const char* const filter = filter_pattern.c_str(); + const auto& filter = filter_pattern.c_str(); FDirEntry entry{}; entry.name = d_entry->d_name; diff --git a/src/flistbox.cpp b/src/flistbox.cpp index b4835ed6..2764a4ef 100644 --- a/src/flistbox.cpp +++ b/src/flistbox.cpp @@ -280,7 +280,7 @@ void FListBox::clear() if ( size == 0 ) return; - for (int y{0}; y < int(getHeight()) - 2; y++) + for (auto y{0}; y < int(getHeight()) - 2; y++) { print() << FPoint{2, 2 + y} << FString{size, L' '}; } @@ -724,7 +724,7 @@ void FListBox::draw() { setColor(); - for (int y{2}; y < int(getHeight()); y++) + for (auto y{2}; y < int(getHeight()); y++) { print() << FPoint{int(getWidth()) - 1, y} << ' '; // clear right side of the scrollbar diff --git a/src/flistview.cpp b/src/flistview.cpp index ed36d44f..d4c02669 100644 --- a/src/flistview.cpp +++ b/src/flistview.cpp @@ -1601,7 +1601,7 @@ void FListView::draw() { setColor(); - for (int y{2}; y < int(getHeight()); y++) + for (auto y{2}; y < int(getHeight()); y++) { print() << FPoint{int(getWidth()) - 1, y} << ' '; // clear right side of the scrollbar @@ -1838,7 +1838,7 @@ void FListView::clearList() if ( size == 0 ) return; - for (int y{0}; y < int(getHeight()) - 2; y++) + for (auto y{0}; y < int(getHeight()) - 2; y++) { print() << FPoint{2, 2 + y} << FString{size, L' '}; } diff --git a/src/fmenu.cpp b/src/fmenu.cpp index 3f9534e9..73ba4ee8 100644 --- a/src/fmenu.cpp +++ b/src/fmenu.cpp @@ -279,19 +279,19 @@ void FMenu::onMouseMove (FMouseEvent* ev) if ( ms.mouse_over_submenu ) { - passEventToSubMenu(ev); // Event handover to sub-menu + passEventToSubMenu(*ev); // Event handover to sub-menu return; } if ( ! ms.mouse_over_menu && ms.mouse_over_supermenu ) { - passEventToSuperMenu(ev); // Event handover to super-menu + passEventToSuperMenu(*ev); // Event handover to super-menu return; } if ( ms.mouse_over_menubar ) { - passEventToMenuBar(ev); // Event handover to the menu bar + passEventToMenuBar(*ev); // Event handover to the menu bar return; } @@ -909,13 +909,13 @@ void FMenu::mouseMoveOverBorder (MouseStates& ms) const } //---------------------------------------------------------------------- -void FMenu::passEventToSubMenu (FMouseEvent* const& ev) +void FMenu::passEventToSubMenu (const FMouseEvent& ev) { // Mouse event handover to sub-menu - const auto& t = ev->getTermPos(); + const auto& t = ev.getTermPos(); const auto& p = opened_sub_menu->termToWidgetPos(t); - const int b = ev->getButton(); + const int b = ev.getButton(); try { @@ -932,14 +932,14 @@ void FMenu::passEventToSubMenu (FMouseEvent* const& ev) } //---------------------------------------------------------------------- -void FMenu::passEventToSuperMenu (FMouseEvent* const& ev) +void FMenu::passEventToSuperMenu (const FMouseEvent& ev) { // Mouse event handover to super-menu - auto smenu = superMenuAt (ev->getTermPos()); - const auto& t = ev->getTermPos(); + auto smenu = superMenuAt (ev.getTermPos()); + const auto& t = ev.getTermPos(); const auto& p = smenu->termToWidgetPos(t); - const int b = ev->getButton(); + const int b = ev.getButton(); try { @@ -956,14 +956,14 @@ void FMenu::passEventToSuperMenu (FMouseEvent* const& ev) } //---------------------------------------------------------------------- -void FMenu::passEventToMenuBar (FMouseEvent* const& ev) const +void FMenu::passEventToMenuBar (const FMouseEvent& ev) const { // Mouse event handover to the menu bar auto menu_bar = getMenuBar(); - const auto& t = ev->getTermPos(); + const auto& t = ev.getTermPos(); const auto& p = menu_bar->termToWidgetPos(t); - const int b = ev->getButton(); + const int b = ev.getButton(); try { diff --git a/src/fmenubar.cpp b/src/fmenubar.cpp index 0fdc5f62..5875bb31 100644 --- a/src/fmenubar.cpp +++ b/src/fmenubar.cpp @@ -223,6 +223,8 @@ void FMenuBar::onAccel (FAccelEvent* ev) getStatusBar()->drawMessage(); redraw(); + processTerminalUpdate(); + flush(); ev->accept(); } @@ -902,7 +904,7 @@ void FMenuBar::mouseMoveOverList (const FMouseEvent* ev) else { // Event handover to the menu - passEventToMenu(ev); + passEventToMenu(*ev); } } } @@ -916,11 +918,15 @@ void FMenuBar::mouseMoveOverList (const FMouseEvent* ev) } if ( focus_changed ) + { redraw(); + processTerminalUpdate(); + flush(); + } } //---------------------------------------------------------------------- -void FMenuBar::passEventToMenu (const FMouseEvent* const& ev) const +void FMenuBar::passEventToMenu (const FMouseEvent& ev) const { if ( ! hasSelectedItem() || ! getSelectedItem()->hasMenu() ) return; @@ -930,11 +936,11 @@ void FMenuBar::passEventToMenu (const FMouseEvent* const& ev) const const auto& menu_geometry = menu->getTermGeometry(); if ( menu->getCount() > 0 - && menu_geometry.contains(ev->getTermPos()) ) + && menu_geometry.contains(ev.getTermPos()) ) { - const auto& t = ev->getTermPos(); + const auto& t = ev.getTermPos(); const auto& p = menu->termToWidgetPos(t); - const int b = ev->getButton(); + const int b = ev.getButton(); try { diff --git a/src/fmenuitem.cpp b/src/fmenuitem.cpp index 2012f6ec..3c78e4f6 100644 --- a/src/fmenuitem.cpp +++ b/src/fmenuitem.cpp @@ -417,6 +417,7 @@ void FMenuItem::onAccel (FAccelEvent* ev) mbar->redraw(); mbar->drop_down = true; + } else { @@ -427,6 +428,8 @@ void FMenuItem::onAccel (FAccelEvent* ev) mbar->drop_down = false; } + processTerminalUpdate(); + flush(); ev->accept(); } diff --git a/src/foptiattr.cpp b/src/foptiattr.cpp index 4c03b929..df4e54d0 100644 --- a/src/foptiattr.cpp +++ b/src/foptiattr.cpp @@ -453,7 +453,7 @@ void FOptiAttr::set_orig_orig_colors (const char cap[]) } //---------------------------------------------------------------------- -bool FOptiAttr::isNormal (const FChar* const& ch) +bool FOptiAttr::isNormal (const FChar& ch) { return hasNoAttribute(ch) && ! hasColor(ch); } @@ -545,23 +545,19 @@ FColor FOptiAttr::vga2ansi (FColor color) } //---------------------------------------------------------------------- -const char* FOptiAttr::changeAttribute (FChar*& term, FChar*& next) +const char* FOptiAttr::changeAttribute (FChar& term, FChar& next) { const bool next_has_color = hasColor(next); fake_reverse = false; attr_buf[0] = '\0'; - - if ( ! (term && next) ) - return attr_buf.data(); - prevent_no_color_video_attributes (term, next_has_color); prevent_no_color_video_attributes (next); detectSwitchOn (term, next); detectSwitchOff (term, next); // Simulate invisible characters - if ( ! F_enter_secure_mode.cap && next->attr.bit.invisible ) - next->encoded_char = ' '; + if ( ! F_enter_secure_mode.cap && next.attr.bit.invisible ) + next.encoded_char = ' '; // Look for no changes if ( ! (switchOn() || switchOff() || hasColorChanged(term, next)) ) @@ -572,7 +568,7 @@ const char* FOptiAttr::changeAttribute (FChar*& term, FChar*& next) deactivateAttributes (term, next); } else if ( F_set_attributes.cap - && (! term->attr.bit.pc_charset || alt_equal_pc_charset) ) + && (! term.attr.bit.pc_charset || alt_equal_pc_charset) ) { changeAttributeSGR (term, next); } @@ -590,12 +586,9 @@ const char* FOptiAttr::changeAttribute (FChar*& term, FChar*& next) // private methods of FOptiAttr //---------------------------------------------------------------------- -inline bool FOptiAttr::setTermBold (FChar*& term) +inline bool FOptiAttr::setTermBold (FChar& term) { - if ( ! term ) - return false; - - term->attr.bit.bold = true; + term.attr.bit.bold = true; if ( append_sequence(F_enter_bold_mode.cap) ) return true; @@ -604,19 +597,16 @@ inline bool FOptiAttr::setTermBold (FChar*& term) } //---------------------------------------------------------------------- -inline bool FOptiAttr::unsetTermBold (FChar*& term) +inline bool FOptiAttr::unsetTermBold (FChar& term) { // Back to normal intensity (turns off bold + dim) - if ( ! term ) - return false; - if ( F_exit_bold_mode.caused_reset ) reset(term); else { - term->attr.bit.bold = false; - term->attr.bit.dim = false; + term.attr.bit.bold = false; + term.attr.bit.dim = false; } if ( append_sequence(F_exit_bold_mode.cap) ) @@ -626,12 +616,9 @@ inline bool FOptiAttr::unsetTermBold (FChar*& term) } //---------------------------------------------------------------------- -inline bool FOptiAttr::setTermDim (FChar*& term) +inline bool FOptiAttr::setTermDim (FChar& term) { - if ( ! term ) - return false; - - term->attr.bit.dim = true; + term.attr.bit.dim = true; if ( append_sequence(F_enter_dim_mode.cap) ) return true; @@ -640,19 +627,16 @@ inline bool FOptiAttr::setTermDim (FChar*& term) } //---------------------------------------------------------------------- -inline bool FOptiAttr::unsetTermDim (FChar*& term) +inline bool FOptiAttr::unsetTermDim (FChar& term) { // Back to normal intensity (turns off bold + dim) - if ( ! term ) - return false; - if ( F_exit_dim_mode.caused_reset ) reset(term); else { - term->attr.bit.bold = false; - term->attr.bit.dim = false; + term.attr.bit.bold = false; + term.attr.bit.dim = false; } if ( append_sequence(F_exit_dim_mode.cap) ) @@ -662,12 +646,9 @@ inline bool FOptiAttr::unsetTermDim (FChar*& term) } //---------------------------------------------------------------------- -inline bool FOptiAttr::setTermItalic (FChar*& term) +inline bool FOptiAttr::setTermItalic (FChar& term) { - if ( ! term ) - return false; - - term->attr.bit.italic = true; + term.attr.bit.italic = true; if ( append_sequence(F_enter_italics_mode.cap) ) return true; @@ -676,15 +657,12 @@ inline bool FOptiAttr::setTermItalic (FChar*& term) } //---------------------------------------------------------------------- -inline bool FOptiAttr::unsetTermItalic (FChar*& term) +inline bool FOptiAttr::unsetTermItalic (FChar& term) { - if ( ! term ) - return false; - if ( F_exit_italics_mode.caused_reset ) reset(term); else - term->attr.bit.italic = false; + term.attr.bit.italic = false; if ( append_sequence(F_exit_italics_mode.cap) ) return true; @@ -693,12 +671,9 @@ inline bool FOptiAttr::unsetTermItalic (FChar*& term) } //---------------------------------------------------------------------- -inline bool FOptiAttr::setTermUnderline (FChar*& term) +inline bool FOptiAttr::setTermUnderline (FChar& term) { - if ( ! term ) - return false; - - term->attr.bit.underline = true; + term.attr.bit.underline = true; if ( append_sequence(F_enter_underline_mode.cap) ) return true; @@ -707,19 +682,16 @@ inline bool FOptiAttr::setTermUnderline (FChar*& term) } //---------------------------------------------------------------------- -inline bool FOptiAttr::unsetTermUnderline (FChar*& term) +inline bool FOptiAttr::unsetTermUnderline (FChar& term) { // Turns off every underlining - if ( ! term ) - return false; - if ( F_exit_underline_mode.caused_reset ) reset(term); else { - term->attr.bit.underline = false; - term->attr.bit.dbl_underline = false; + term.attr.bit.underline = false; + term.attr.bit.dbl_underline = false; } if ( append_sequence(F_exit_underline_mode.cap) ) @@ -729,12 +701,9 @@ inline bool FOptiAttr::unsetTermUnderline (FChar*& term) } //---------------------------------------------------------------------- -inline bool FOptiAttr::setTermBlink (FChar*& term) +inline bool FOptiAttr::setTermBlink (FChar& term) { - if ( ! term ) - return false; - - term->attr.bit.blink = true; + term.attr.bit.blink = true; if ( append_sequence(F_enter_blink_mode.cap) ) return true; @@ -743,15 +712,12 @@ inline bool FOptiAttr::setTermBlink (FChar*& term) } //---------------------------------------------------------------------- -inline bool FOptiAttr::unsetTermBlink (FChar*& term) +inline bool FOptiAttr::unsetTermBlink (FChar& term) { - if ( ! term ) - return false; - if ( F_exit_blink_mode.caused_reset ) reset(term); else - term->attr.bit.blink = false; + term.attr.bit.blink = false; if ( append_sequence(F_exit_blink_mode.cap) ) return true; @@ -760,12 +726,9 @@ inline bool FOptiAttr::unsetTermBlink (FChar*& term) } //---------------------------------------------------------------------- -inline bool FOptiAttr::setTermReverse (FChar*& term) +inline bool FOptiAttr::setTermReverse (FChar& term) { - if ( ! term ) - return false; - - term->attr.bit.reverse = true; + term.attr.bit.reverse = true; if ( ! fake_reverse && append_sequence(F_enter_reverse_mode.cap) ) return true; @@ -774,15 +737,12 @@ inline bool FOptiAttr::setTermReverse (FChar*& term) } //---------------------------------------------------------------------- -inline bool FOptiAttr::unsetTermReverse (FChar*& term) +inline bool FOptiAttr::unsetTermReverse (FChar& term) { - if ( ! term ) - return false; - if ( F_exit_reverse_mode.caused_reset ) reset(term); else - term->attr.bit.reverse = false; + term.attr.bit.reverse = false; if ( ! fake_reverse && append_sequence(F_exit_reverse_mode.cap) ) return true; @@ -791,12 +751,9 @@ inline bool FOptiAttr::unsetTermReverse (FChar*& term) } //---------------------------------------------------------------------- -inline bool FOptiAttr::setTermStandout (FChar*& term) +inline bool FOptiAttr::setTermStandout (FChar& term) { - if ( ! term ) - return false; - - term->attr.bit.standout = true; + term.attr.bit.standout = true; if ( ! fake_reverse && append_sequence(F_enter_standout_mode.cap) ) return true; @@ -805,15 +762,12 @@ inline bool FOptiAttr::setTermStandout (FChar*& term) } //---------------------------------------------------------------------- -inline bool FOptiAttr::unsetTermStandout (FChar*& term) +inline bool FOptiAttr::unsetTermStandout (FChar& term) { - if ( ! term ) - return false; - if ( F_exit_standout_mode.caused_reset ) reset(term); else - term->attr.bit.standout = false; + term.attr.bit.standout = false; if ( ! fake_reverse && append_sequence(F_exit_standout_mode.cap) ) return true; @@ -822,12 +776,9 @@ inline bool FOptiAttr::unsetTermStandout (FChar*& term) } //---------------------------------------------------------------------- -inline bool FOptiAttr::setTermInvisible (FChar*& term) +inline bool FOptiAttr::setTermInvisible (FChar& term) { - if ( ! term ) - return false; - - term->attr.bit.invisible = true; + term.attr.bit.invisible = true; if ( append_sequence(F_enter_secure_mode.cap) ) return true; @@ -836,15 +787,12 @@ inline bool FOptiAttr::setTermInvisible (FChar*& term) } //---------------------------------------------------------------------- -inline bool FOptiAttr::unsetTermInvisible (FChar*& term) +inline bool FOptiAttr::unsetTermInvisible (FChar& term) { - if ( ! term ) - return false; - if ( F_exit_secure_mode.caused_reset ) reset(term); else - term->attr.bit.invisible = false; + term.attr.bit.invisible = false; if ( append_sequence(F_exit_secure_mode.cap) ) return true; @@ -853,12 +801,9 @@ inline bool FOptiAttr::unsetTermInvisible (FChar*& term) } //---------------------------------------------------------------------- -inline bool FOptiAttr::setTermProtected (FChar*& term) +inline bool FOptiAttr::setTermProtected (FChar& term) { - if ( ! term ) - return false; - - term->attr.bit.protect = true; + term.attr.bit.protect = true; if ( append_sequence(F_enter_protected_mode.cap) ) return true; @@ -867,15 +812,12 @@ inline bool FOptiAttr::setTermProtected (FChar*& term) } //---------------------------------------------------------------------- -inline bool FOptiAttr::unsetTermProtected (FChar*& term) +inline bool FOptiAttr::unsetTermProtected (FChar& term) { - if ( ! term ) - return false; - if ( F_exit_protected_mode.caused_reset ) reset(term); else - term->attr.bit.protect = false; + term.attr.bit.protect = false; if ( append_sequence(F_exit_protected_mode.cap) ) return true; @@ -884,12 +826,9 @@ inline bool FOptiAttr::unsetTermProtected (FChar*& term) } //---------------------------------------------------------------------- -inline bool FOptiAttr::setTermCrossedOut (FChar*& term) +inline bool FOptiAttr::setTermCrossedOut (FChar& term) { - if ( ! term ) - return false; - - term->attr.bit.crossed_out = true; + term.attr.bit.crossed_out = true; if ( append_sequence(F_enter_crossed_out_mode.cap) ) return true; @@ -898,15 +837,12 @@ inline bool FOptiAttr::setTermCrossedOut (FChar*& term) } //---------------------------------------------------------------------- -inline bool FOptiAttr::unsetTermCrossedOut (FChar*& term) +inline bool FOptiAttr::unsetTermCrossedOut (FChar& term) { - if ( ! term ) - return false; - if ( F_exit_crossed_out_mode.caused_reset ) reset(term); else - term->attr.bit.crossed_out = false; + term.attr.bit.crossed_out = false; if ( append_sequence(F_exit_crossed_out_mode.cap) ) return true; @@ -915,12 +851,9 @@ inline bool FOptiAttr::unsetTermCrossedOut (FChar*& term) } //---------------------------------------------------------------------- -inline bool FOptiAttr::setTermDoubleUnderline (FChar*& term) +inline bool FOptiAttr::setTermDoubleUnderline (FChar& term) { - if ( ! term ) - return false; - - term->attr.bit.dbl_underline = true; + term.attr.bit.dbl_underline = true; if ( append_sequence(F_enter_dbl_underline_mode.cap) ) return true; @@ -929,19 +862,16 @@ inline bool FOptiAttr::setTermDoubleUnderline (FChar*& term) } //---------------------------------------------------------------------- -inline bool FOptiAttr::unsetTermDoubleUnderline (FChar*& term) +inline bool FOptiAttr::unsetTermDoubleUnderline (FChar& term) { // Turns off every underlining - if ( ! term ) - return false; - if ( F_exit_dbl_underline_mode.caused_reset ) reset(term); else { - term->attr.bit.underline = false; - term->attr.bit.dbl_underline = false; + term.attr.bit.underline = false; + term.attr.bit.dbl_underline = false; } if ( append_sequence(F_exit_dbl_underline_mode.cap) ) @@ -951,12 +881,12 @@ inline bool FOptiAttr::unsetTermDoubleUnderline (FChar*& term) } //---------------------------------------------------------------------- -bool FOptiAttr::setTermAttributes ( FChar*& term +bool FOptiAttr::setTermAttributes ( FChar& term , bool p1, bool p2, bool p3 , bool p4, bool p5, bool p6 , bool p7, bool p8, bool p9 ) { - if ( term && F_set_attributes.cap ) + if ( F_set_attributes.cap ) { const char* sgr = FTermcap::encodeParameter ( F_set_attributes.cap , p1 && ! fake_reverse @@ -970,19 +900,19 @@ bool FOptiAttr::setTermAttributes ( FChar*& term , p9 ); append_sequence (sgr); resetColor(term); - term->attr.bit.standout = p1; - term->attr.bit.underline = p2; - term->attr.bit.reverse = p3; - term->attr.bit.blink = p4; - term->attr.bit.dim = p5; - term->attr.bit.bold = p6; - term->attr.bit.invisible = p7; - term->attr.bit.protect = p8; - term->attr.bit.alt_charset = p9; - term->attr.bit.pc_charset = false; - term->attr.bit.italic = false; - term->attr.bit.crossed_out = false; - term->attr.bit.dbl_underline = false; + term.attr.bit.standout = p1; + term.attr.bit.underline = p2; + term.attr.bit.reverse = p3; + term.attr.bit.blink = p4; + term.attr.bit.dim = p5; + term.attr.bit.bold = p6; + term.attr.bit.invisible = p7; + term.attr.bit.protect = p8; + term.attr.bit.alt_charset = p9; + term.attr.bit.pc_charset = false; + term.attr.bit.italic = false; + term.attr.bit.crossed_out = false; + term.attr.bit.dbl_underline = false; return true; } @@ -991,11 +921,8 @@ bool FOptiAttr::setTermAttributes ( FChar*& term } //---------------------------------------------------------------------- -inline bool FOptiAttr::unsetTermAttributes (FChar*& term) +inline bool FOptiAttr::unsetTermAttributes (FChar& term) { - if ( ! term ) - return false; - reset(term); if ( append_sequence(F_exit_attribute_mode.cap) ) @@ -1005,14 +932,11 @@ inline bool FOptiAttr::unsetTermAttributes (FChar*& term) } //---------------------------------------------------------------------- -inline bool FOptiAttr::setTermAltCharset (FChar*& term) +inline bool FOptiAttr::setTermAltCharset (FChar& term) { - if ( ! term ) - return false; + term.attr.bit.alt_charset = true; - term->attr.bit.alt_charset = true; - - if ( alt_equal_pc_charset && term->attr.bit.pc_charset ) + if ( alt_equal_pc_charset && term.attr.bit.pc_charset ) return false; if ( append_sequence(F_enter_alt_charset_mode.cap) ) @@ -1022,14 +946,11 @@ inline bool FOptiAttr::setTermAltCharset (FChar*& term) } //---------------------------------------------------------------------- -inline bool FOptiAttr::unsetTermAltCharset (FChar*& term) +inline bool FOptiAttr::unsetTermAltCharset (FChar& term) { - if ( ! term ) - return false; + term.attr.bit.alt_charset = false; - term->attr.bit.alt_charset = false; - - if ( alt_equal_pc_charset && term->attr.bit.pc_charset ) + if ( alt_equal_pc_charset && term.attr.bit.pc_charset ) return false; if ( append_sequence(F_exit_alt_charset_mode.cap) ) @@ -1039,14 +960,11 @@ inline bool FOptiAttr::unsetTermAltCharset (FChar*& term) } //---------------------------------------------------------------------- -inline bool FOptiAttr::setTermPCcharset (FChar*& term) +inline bool FOptiAttr::setTermPCcharset (FChar& term) { - if ( ! term ) - return false; + term.attr.bit.pc_charset = true; - term->attr.bit.pc_charset = true; - - if ( alt_equal_pc_charset && term->attr.bit.alt_charset ) + if ( alt_equal_pc_charset && term.attr.bit.alt_charset ) return false; if ( append_sequence(F_enter_pc_charset_mode.cap) ) @@ -1056,14 +974,11 @@ inline bool FOptiAttr::setTermPCcharset (FChar*& term) } //---------------------------------------------------------------------- -inline bool FOptiAttr::unsetTermPCcharset (FChar*& term) +inline bool FOptiAttr::unsetTermPCcharset (FChar& term) { - if ( ! term ) - return false; + term.attr.bit.pc_charset = false; - term->attr.bit.pc_charset = false; - - if ( alt_equal_pc_charset && term->attr.bit.alt_charset ) + if ( alt_equal_pc_charset && term.attr.bit.alt_charset ) return false; if ( append_sequence(F_exit_pc_charset_mode.cap) ) @@ -1073,13 +988,10 @@ inline bool FOptiAttr::unsetTermPCcharset (FChar*& term) } //---------------------------------------------------------------------- -bool FOptiAttr::setTermDefaultColor (FChar*& term) +bool FOptiAttr::setTermDefaultColor (FChar& term) { - if ( ! term ) - return false; - - term->fg_color = fc::Default; - term->bg_color = fc::Default; + term.fg_color = fc::Default; + term.bg_color = fc::Default; if ( append_sequence(F_orig_pair.cap) ) return true; @@ -1096,7 +1008,7 @@ bool FOptiAttr::setTermDefaultColor (FChar*& term) } //---------------------------------------------------------------------- -void FOptiAttr::setAttributesOn (FChar*& term) +void FOptiAttr::setAttributesOn (FChar& term) { if ( on.attr.bit.alt_charset ) setTermAltCharset(term); @@ -1139,7 +1051,7 @@ void FOptiAttr::setAttributesOn (FChar*& term) } //---------------------------------------------------------------------- -void FOptiAttr::setAttributesOff (FChar*& term) +void FOptiAttr::setAttributesOff (FChar& term) { if ( off.attr.bit.pc_charset ) unsetTermPCcharset(term); @@ -1182,94 +1094,78 @@ void FOptiAttr::setAttributesOff (FChar*& term) } //---------------------------------------------------------------------- -bool FOptiAttr::hasColor (const FChar* const& attr) +bool FOptiAttr::hasColor (const FChar& attr) { - if ( attr - && attr->fg_color == fc::Default - && attr->bg_color == fc::Default ) + if ( attr.fg_color == fc::Default + && attr.bg_color == fc::Default ) return false; else return true; } //---------------------------------------------------------------------- -bool FOptiAttr::hasAttribute (const FChar* const& attr) +bool FOptiAttr::hasAttribute (const FChar& attr) { - if ( attr ) - { - return attr->attr.bit.bold - || attr->attr.bit.dim - || attr->attr.bit.italic - || attr->attr.bit.underline - || attr->attr.bit.blink - || attr->attr.bit.reverse - || attr->attr.bit.standout - || attr->attr.bit.invisible - || attr->attr.bit.protect - || attr->attr.bit.crossed_out - || attr->attr.bit.dbl_underline - || attr->attr.bit.alt_charset - || attr->attr.bit.pc_charset; - } - - return false; + return attr.attr.bit.bold + || attr.attr.bit.dim + || attr.attr.bit.italic + || attr.attr.bit.underline + || attr.attr.bit.blink + || attr.attr.bit.reverse + || attr.attr.bit.standout + || attr.attr.bit.invisible + || attr.attr.bit.protect + || attr.attr.bit.crossed_out + || attr.attr.bit.dbl_underline + || attr.attr.bit.alt_charset + || attr.attr.bit.pc_charset; } //---------------------------------------------------------------------- -bool FOptiAttr::hasNoAttribute (const FChar* const& attr) +bool FOptiAttr::hasNoAttribute (const FChar& attr) { return ! hasAttribute(attr); } //---------------------------------------------------------------------- -inline bool FOptiAttr::hasColorChanged ( const FChar* const& term - , const FChar* const& next ) const +inline bool FOptiAttr::hasColorChanged ( const FChar& term + , const FChar& next ) const { - if ( term && next ) - { - bool frev ( ( on.attr.bit.reverse - || on.attr.bit.standout - || off.attr.bit.reverse - || off.attr.bit.standout ) && fake_reverse ); - return bool ( frev - || term->fg_color != next->fg_color - || term->bg_color != next->bg_color ); - } - - return false; + bool frev ( ( on.attr.bit.reverse + || on.attr.bit.standout + || off.attr.bit.reverse + || off.attr.bit.standout ) && fake_reverse ); + return bool ( frev + || term.fg_color != next.fg_color + || term.bg_color != next.bg_color ); } //---------------------------------------------------------------------- -inline void FOptiAttr::resetColor (FChar*& attr) const +inline void FOptiAttr::resetColor (FChar& attr) const { - if ( attr ) - { - attr->fg_color = fc::Default; - attr->bg_color = fc::Default; - } + attr.fg_color = fc::Default; + attr.bg_color = fc::Default; } //---------------------------------------------------------------------- -inline void FOptiAttr::prevent_no_color_video_attributes ( FChar*& attr +inline void FOptiAttr::prevent_no_color_video_attributes ( FChar& attr , bool next_has_color ) { // Ignore attributes which can not combined with a color - if ( ! attr - || ! (hasColor(attr) || next_has_color) - || attr_without_color <= 0 ) + if ( ! (hasColor(attr) || next_has_color) || attr_without_color <= 0 ) return; - for (int bit{1}; bit < no_mode; bit <<= 1) + for (auto bit{1}; bit < no_mode; bit <<= 1) { switch ( bit & attr_without_color ) { case standout_mode: - attr->attr.bit.standout = false; + attr.attr.bit.standout = false; break; case underline_mode: - attr->attr.bit.underline = false; + attr.attr.bit.underline = false; break; case reverse_mode: @@ -1277,31 +1173,31 @@ inline void FOptiAttr::prevent_no_color_video_attributes ( FChar*& attr break; case blink_mode: - attr->attr.bit.blink = false; + attr.attr.bit.blink = false; break; case dim_mode: - attr->attr.bit.dim = false; + attr.attr.bit.dim = false; break; case bold_mode: - attr->attr.bit.bold = false; + attr.attr.bit.bold = false; break; case invisible_mode: - attr->attr.bit.invisible = false; + attr.attr.bit.invisible = false; break; case protected_mode: - attr->attr.bit.protect = false; + attr.attr.bit.protect = false; break; case alt_charset_mode: - attr->attr.bit.alt_charset = false; + attr.attr.bit.alt_charset = false; break; case italic_mode: - attr->attr.bit.italic = false; + attr.attr.bit.italic = false; break; default: @@ -1311,8 +1207,7 @@ inline void FOptiAttr::prevent_no_color_video_attributes ( FChar*& attr } //---------------------------------------------------------------------- -inline void FOptiAttr::deactivateAttributes ( FChar*& term - , FChar*& next ) +inline void FOptiAttr::deactivateAttributes (FChar& term, FChar& next) { if ( hasAttribute(term) ) { @@ -1335,31 +1230,27 @@ inline void FOptiAttr::deactivateAttributes ( FChar*& term } //---------------------------------------------------------------------- -inline void FOptiAttr::changeAttributeSGR ( FChar*& term - , FChar*& next ) +inline void FOptiAttr::changeAttributeSGR (FChar& term, FChar& next) { bool pc_charset_usable{true}; - if ( ! (term && next) ) - return; - if ( switchOn() || switchOff() ) setTermAttributes ( term - , next->attr.bit.standout - , next->attr.bit.underline - , next->attr.bit.reverse - , next->attr.bit.blink - , next->attr.bit.dim - , next->attr.bit.bold - , next->attr.bit.invisible - , next->attr.bit.protect - , next->attr.bit.alt_charset ); + , next.attr.bit.standout + , next.attr.bit.underline + , next.attr.bit.reverse + , next.attr.bit.blink + , next.attr.bit.dim + , next.attr.bit.bold + , next.attr.bit.invisible + , next.attr.bit.protect + , next.attr.bit.alt_charset ); if ( alt_equal_pc_charset && F_enter_pc_charset_mode.cap - && next->attr.bit.alt_charset ) + && next.attr.bit.alt_charset ) { - term->attr.bit.pc_charset = next->attr.bit.pc_charset; + term.attr.bit.pc_charset = next.attr.bit.pc_charset; off.attr.bit.pc_charset = false; pc_charset_usable = false; } @@ -1367,16 +1258,16 @@ inline void FOptiAttr::changeAttributeSGR ( FChar*& term if ( off.attr.bit.pc_charset ) unsetTermPCcharset(term); - if ( ! term->attr.bit.italic && next->attr.bit.italic ) + if ( ! term.attr.bit.italic && next.attr.bit.italic ) setTermItalic(term); - if ( ! term->attr.bit.crossed_out && next->attr.bit.crossed_out ) + if ( ! term.attr.bit.crossed_out && next.attr.bit.crossed_out ) setTermCrossedOut(term); - if ( ! term->attr.bit.dbl_underline && next->attr.bit.dbl_underline ) + if ( ! term.attr.bit.dbl_underline && next.attr.bit.dbl_underline ) setTermDoubleUnderline(term); - if ( ! term->attr.bit.pc_charset && next->attr.bit.pc_charset + if ( ! term.attr.bit.pc_charset && next.attr.bit.pc_charset && pc_charset_usable ) setTermPCcharset(term); @@ -1385,8 +1276,7 @@ inline void FOptiAttr::changeAttributeSGR ( FChar*& term } //---------------------------------------------------------------------- -inline void FOptiAttr::changeAttributeSeparately ( FChar*& term - , FChar*& next ) +inline void FOptiAttr::changeAttributeSeparately (FChar& term, FChar& next) { setAttributesOff(term); @@ -1398,26 +1288,23 @@ inline void FOptiAttr::changeAttributeSeparately ( FChar*& term } //---------------------------------------------------------------------- -void FOptiAttr::change_color (FChar*& term, FChar*& next) +void FOptiAttr::change_color (FChar& term, FChar& next) { - if ( ! (term && next) ) - return; - if ( monochron ) { - next->fg_color = fc::Default; - next->bg_color = fc::Default; + next.fg_color = fc::Default; + next.bg_color = fc::Default; return; } - if ( next->fg_color != fc::Default ) - next->fg_color %= max_color; + if ( next.fg_color != fc::Default ) + next.fg_color %= max_color; - if ( next->bg_color != fc::Default ) - next->bg_color %= max_color; + if ( next.bg_color != fc::Default ) + next.bg_color %= max_color; - FColor fg = next->fg_color; - FColor bg = next->bg_color; + FColor fg = next.fg_color; + FColor bg = next.bg_color; if ( fg == fc::Default || bg == fc::Default ) change_to_default_color (term, next, fg, bg); @@ -1426,7 +1313,7 @@ void FOptiAttr::change_color (FChar*& term, FChar*& next) return; if ( fake_reverse - && (next->attr.bit.reverse || next->attr.bit.standout) ) + && (next.attr.bit.reverse || next.attr.bit.standout) ) { std::swap (fg, bg); @@ -1436,29 +1323,28 @@ void FOptiAttr::change_color (FChar*& term, FChar*& next) change_current_color (term, fg, bg); - term->fg_color = next->fg_color; - term->bg_color = next->bg_color; + term.fg_color = next.fg_color; + term.bg_color = next.bg_color; } //---------------------------------------------------------------------- -inline void FOptiAttr::change_to_default_color ( FChar*& term - , FChar*& next +inline void FOptiAttr::change_to_default_color ( FChar& term, FChar& next , FColor& fg, FColor& bg ) { if ( ansi_default_color ) { - if ( fg == fc::Default && term->fg_color != fc::Default - && bg == fc::Default && term->bg_color != fc::Default ) + if ( fg == fc::Default && term.fg_color != fc::Default + && bg == fc::Default && term.bg_color != fc::Default ) { setTermDefaultColor(term); } - else if ( fg == fc::Default && term->fg_color != fc::Default ) + else if ( fg == fc::Default && term.fg_color != fc::Default ) { std::string sgr_39{CSI "39m"}; append_sequence (sgr_39.c_str()); - term->fg_color = fc::Default; + term.fg_color = fc::Default; } - else if ( bg == fc::Default && term->bg_color != fc::Default ) + else if ( bg == fc::Default && term.bg_color != fc::Default ) { const char* sgr_49; const auto& op = F_orig_pair.cap; @@ -1469,19 +1355,19 @@ inline void FOptiAttr::change_to_default_color ( FChar*& term sgr_49 = CSI "49m"; append_sequence (sgr_49); - term->bg_color = fc::Default; + term.bg_color = fc::Default; } } else if ( ! setTermDefaultColor(term) ) { // Fallback to gray on black - fg = next->fg_color = fc::LightGray; - bg = next->bg_color = fc::Black; + fg = next.fg_color = fc::LightGray; + bg = next.bg_color = fc::Black; } } //---------------------------------------------------------------------- -inline void FOptiAttr::change_current_color ( const FChar* const& term +inline void FOptiAttr::change_current_color ( const FChar& term , FColor fg, FColor bg ) { const char* color_str{}; @@ -1492,21 +1378,21 @@ inline void FOptiAttr::change_current_color ( const FChar* const& term const auto& sp = F_set_color_pair.cap; const bool frev ( ( off.attr.bit.reverse || off.attr.bit.standout - || term->attr.bit.reverse - || term->attr.bit.standout ) && fake_reverse ); + || term.attr.bit.reverse + || term.attr.bit.standout ) && fake_reverse ); if ( AF && AB ) { const auto ansi_fg = vga2ansi(fg); const auto ansi_bg = vga2ansi(bg); - if ( term->fg_color != fg || frev ) + if ( term.fg_color != fg || frev ) { color_str = FTermcap::encodeParameter(AF, ansi_fg, 0, 0, 0, 0, 0, 0, 0, 0); append_sequence (color_str); } - if ( term->bg_color != bg || frev ) + if ( term.bg_color != bg || frev ) { color_str = FTermcap::encodeParameter(AB, ansi_bg, 0, 0, 0, 0, 0, 0, 0, 0); append_sequence (color_str); @@ -1514,13 +1400,13 @@ inline void FOptiAttr::change_current_color ( const FChar* const& term } else if ( Sf && Sb ) { - if ( term->fg_color != fg || frev ) + if ( term.fg_color != fg || frev ) { color_str = FTermcap::encodeParameter(Sf, fg, 0, 0, 0, 0, 0, 0, 0, 0); append_sequence (color_str); } - if ( term->bg_color != bg || frev ) + if ( term.bg_color != bg || frev ) { color_str = FTermcap::encodeParameter(Sb, bg, 0, 0, 0, 0, 0, 0, 0, 0); append_sequence (color_str); @@ -1536,23 +1422,17 @@ inline void FOptiAttr::change_current_color ( const FChar* const& term } //---------------------------------------------------------------------- -inline void FOptiAttr::resetAttribute (FChar*& attr) const +inline void FOptiAttr::resetAttribute (FChar& attr) const { - if ( attr ) - { - attr->attr.byte[0] = 0; - attr->attr.byte[1] &= reset_byte_mask.attr.byte[1]; - } + attr.attr.byte[0] = 0; + attr.attr.byte[1] &= reset_byte_mask.attr.byte[1]; } //---------------------------------------------------------------------- -inline void FOptiAttr::reset (FChar*& attr) const +inline void FOptiAttr::reset (FChar& attr) const { - if ( attr ) - { - resetAttribute(attr); - resetColor(attr); - } + resetAttribute(attr); + resetColor(attr); } //---------------------------------------------------------------------- @@ -1607,59 +1487,51 @@ inline bool FOptiAttr::hasCharsetEquivalence() const } //---------------------------------------------------------------------- -inline void FOptiAttr::detectSwitchOn (const FChar* const& term, const FChar* const& next) +inline void FOptiAttr::detectSwitchOn (const FChar& term, const FChar& next) { - if ( ! (term && next) ) - return; - - on.attr.bit.bold = ! term->attr.bit.bold && next->attr.bit.bold; - on.attr.bit.dim = ! term->attr.bit.dim && next->attr.bit.dim; - on.attr.bit.italic = ! term->attr.bit.italic && next->attr.bit.italic; - on.attr.bit.underline = ! term->attr.bit.underline && next->attr.bit.underline; - on.attr.bit.blink = ! term->attr.bit.blink && next->attr.bit.blink; - on.attr.bit.reverse = ! term->attr.bit.reverse && next->attr.bit.reverse; - on.attr.bit.standout = ! term->attr.bit.standout && next->attr.bit.standout; - on.attr.bit.invisible = ! term->attr.bit.invisible && next->attr.bit.invisible; - on.attr.bit.protect = ! term->attr.bit.protect && next->attr.bit.protect; - on.attr.bit.crossed_out = ! term->attr.bit.crossed_out && next->attr.bit.crossed_out; - on.attr.bit.dbl_underline = ! term->attr.bit.dbl_underline && next->attr.bit.dbl_underline; - on.attr.bit.alt_charset = ! term->attr.bit.alt_charset && next->attr.bit.alt_charset; - on.attr.bit.pc_charset = ! term->attr.bit.pc_charset && next->attr.bit.pc_charset; + on.attr.bit.bold = ! term.attr.bit.bold && next.attr.bit.bold; + on.attr.bit.dim = ! term.attr.bit.dim && next.attr.bit.dim; + on.attr.bit.italic = ! term.attr.bit.italic && next.attr.bit.italic; + on.attr.bit.underline = ! term.attr.bit.underline && next.attr.bit.underline; + on.attr.bit.blink = ! term.attr.bit.blink && next.attr.bit.blink; + on.attr.bit.reverse = ! term.attr.bit.reverse && next.attr.bit.reverse; + on.attr.bit.standout = ! term.attr.bit.standout && next.attr.bit.standout; + on.attr.bit.invisible = ! term.attr.bit.invisible && next.attr.bit.invisible; + on.attr.bit.protect = ! term.attr.bit.protect && next.attr.bit.protect; + on.attr.bit.crossed_out = ! term.attr.bit.crossed_out && next.attr.bit.crossed_out; + on.attr.bit.dbl_underline = ! term.attr.bit.dbl_underline && next.attr.bit.dbl_underline; + on.attr.bit.alt_charset = ! term.attr.bit.alt_charset && next.attr.bit.alt_charset; + on.attr.bit.pc_charset = ! term.attr.bit.pc_charset && next.attr.bit.pc_charset; } //---------------------------------------------------------------------- -inline void FOptiAttr::detectSwitchOff (const FChar* const& term, const FChar* const& next) +inline void FOptiAttr::detectSwitchOff (const FChar& term, const FChar& next) { - if ( ! (term && next) ) - return; - - off.attr.bit.bold = term->attr.bit.bold && ! next->attr.bit.bold; - off.attr.bit.dim = term->attr.bit.dim && ! next->attr.bit.dim; - off.attr.bit.italic = term->attr.bit.italic && ! next->attr.bit.italic; - off.attr.bit.underline = term->attr.bit.underline && ! next->attr.bit.underline; - off.attr.bit.blink = term->attr.bit.blink && ! next->attr.bit.blink; - off.attr.bit.reverse = term->attr.bit.reverse && ! next->attr.bit.reverse; - off.attr.bit.standout = term->attr.bit.standout && ! next->attr.bit.standout; - off.attr.bit.invisible = term->attr.bit.invisible && ! next->attr.bit.invisible; - off.attr.bit.protect = term->attr.bit.protect && ! next->attr.bit.protect; - off.attr.bit.crossed_out = term->attr.bit.crossed_out && ! next->attr.bit.crossed_out; - off.attr.bit.dbl_underline = term->attr.bit.dbl_underline && ! next->attr.bit.dbl_underline; - off.attr.bit.alt_charset = term->attr.bit.alt_charset && ! next->attr.bit.alt_charset; - off.attr.bit.pc_charset = term->attr.bit.pc_charset && ! next->attr.bit.pc_charset; + off.attr.bit.bold = term.attr.bit.bold && ! next.attr.bit.bold; + off.attr.bit.dim = term.attr.bit.dim && ! next.attr.bit.dim; + off.attr.bit.italic = term.attr.bit.italic && ! next.attr.bit.italic; + off.attr.bit.underline = term.attr.bit.underline && ! next.attr.bit.underline; + off.attr.bit.blink = term.attr.bit.blink && ! next.attr.bit.blink; + off.attr.bit.reverse = term.attr.bit.reverse && ! next.attr.bit.reverse; + off.attr.bit.standout = term.attr.bit.standout && ! next.attr.bit.standout; + off.attr.bit.invisible = term.attr.bit.invisible && ! next.attr.bit.invisible; + off.attr.bit.protect = term.attr.bit.protect && ! next.attr.bit.protect; + off.attr.bit.crossed_out = term.attr.bit.crossed_out && ! next.attr.bit.crossed_out; + off.attr.bit.dbl_underline = term.attr.bit.dbl_underline && ! next.attr.bit.dbl_underline; + off.attr.bit.alt_charset = term.attr.bit.alt_charset && ! next.attr.bit.alt_charset; + off.attr.bit.pc_charset = term.attr.bit.pc_charset && ! next.attr.bit.pc_charset; } //---------------------------------------------------------------------- inline bool FOptiAttr::switchOn() const { - auto on_ptr = &on; - return hasAttribute(on_ptr); + return hasAttribute(on); } //---------------------------------------------------------------------- inline bool FOptiAttr::switchOff() const { - auto off_ptr = &off; - return hasAttribute(off_ptr); + return hasAttribute(off); } //---------------------------------------------------------------------- diff --git a/src/fscrollbar.cpp b/src/fscrollbar.cpp index 397957d9..2d025df7 100644 --- a/src/fscrollbar.cpp +++ b/src/fscrollbar.cpp @@ -463,7 +463,7 @@ void FScrollbar::drawVerticalBar() const auto& wc = getColorTheme(); setColor (wc->scrollbar_fg, wc->scrollbar_bg); - for (int z{1}; z <= slider_pos; z++) + for (auto z{1}; z <= slider_pos; z++) { print() << FPoint{1, 1 + z}; drawVerticalBackgroundLine(); @@ -474,7 +474,7 @@ void FScrollbar::drawVerticalBar() if ( FTerm::isMonochron() ) setReverse(false); - for (int z{1}; z <= int(slider_length); z++) // Draw slider + for (auto z{1}; z <= int(slider_length); z++) // Draw slider { print() << FPoint{1, 1 + slider_pos + z}; @@ -489,7 +489,7 @@ void FScrollbar::drawVerticalBar() setColor (wc->scrollbar_fg, wc->scrollbar_bg); - for (int z = slider_pos + int(slider_length) + 1; z <= int(bar_length); z++) + for (auto z = slider_pos + int(slider_length) + 1; z <= int(bar_length); z++) { print() << FPoint{1, 1 + z}; drawVerticalBackgroundLine(); @@ -529,7 +529,7 @@ void FScrollbar::drawHorizontalBar() else print() << FPoint{2, 1}; - for (int z{0}; z < slider_pos; z++) + for (auto z{0}; z < slider_pos; z++) drawHorizontalBackgroundColumn(); setColor (wc->scrollbar_bg, wc->scrollbar_fg); @@ -537,7 +537,7 @@ void FScrollbar::drawHorizontalBar() if ( FTerm::isMonochron() ) setReverse(false); - for (int z{0}; z < int(slider_length); z++) // Draw slider + for (auto z{0}; z < int(slider_length); z++) // Draw slider print (' '); if ( FTerm::isMonochron() ) diff --git a/src/fscrollview.cpp b/src/fscrollview.cpp index 073ed127..a2027d74 100644 --- a/src/fscrollview.cpp +++ b/src/fscrollview.cpp @@ -647,10 +647,7 @@ void FScrollView::copy2area() if ( ! hasPrintArea() ) FWidget::getPrintArea(); - if ( ! (hasPrintArea() && viewport) ) - return; - - if ( ! viewport->has_changes ) + if ( ! (hasPrintArea() && viewport && viewport->has_changes) ) return; auto printarea = getCurrentPrintArea(); @@ -669,15 +666,15 @@ void FScrollView::copy2area() if ( printarea->height <= ay + y_end ) y_end = printarea->height - ay; - for (int y{0}; y < y_end; y++) // line loop + for (auto y{0}; y < y_end; y++) // line loop { - const FChar* vc{}; // viewport character - FChar* ac{}; // area character const int v_line_len = viewport->width; const int a_line_len = printarea->width + printarea->right_shadow; - vc = &viewport->data[(dy + y) * v_line_len + dx]; - ac = &printarea->data[(ay + y) * a_line_len + ax]; - std::memcpy (ac, vc, sizeof(FChar) * unsigned(x_end)); + // viewport character + const auto& vc = viewport->data[(dy + y) * v_line_len + dx]; + // area character + auto& ac = printarea->data[(ay + y) * a_line_len + ax]; + std::memcpy (&ac, &vc, sizeof(FChar) * unsigned(x_end)); if ( int(printarea->changes[ay + y].xmin) > ax ) printarea->changes[ay + y].xmin = uInt(ax); diff --git a/src/fstatusbar.cpp b/src/fstatusbar.cpp index 3149bc92..fac517cf 100644 --- a/src/fstatusbar.cpp +++ b/src/fstatusbar.cpp @@ -255,7 +255,7 @@ void FStatusBar::drawMessage() } } - for (int i = x; i <= int(termWidth); i++) + for (auto i = x; i <= int(termWidth); i++) print (' '); if ( FTerm::isMonochron() ) diff --git a/src/fterm.cpp b/src/fterm.cpp index b298d2e0..d15cd562 100644 --- a/src/fterm.cpp +++ b/src/fterm.cpp @@ -444,7 +444,7 @@ FTermDebugData& FTerm::getFTermDebugData() //---------------------------------------------------------------------- bool FTerm::isNormal (const FChar& ch) { - return FOptiAttr::isNormal(&ch); + return FOptiAttr::isNormal(ch); } //---------------------------------------------------------------------- @@ -1319,7 +1319,7 @@ void FTerm::initScreenSettings() } //---------------------------------------------------------------------- -const char* FTerm::changeAttribute (FChar*& term_attr, FChar*& next_attr) +const char* FTerm::changeAttribute (FChar& term_attr, FChar& next_attr) { return opti_attr->changeAttribute (term_attr, next_attr); } diff --git a/src/ftermdetection.cpp b/src/ftermdetection.cpp index eca5aa73..077e04b2 100644 --- a/src/ftermdetection.cpp +++ b/src/ftermdetection.cpp @@ -163,8 +163,8 @@ void FTermDetection::deallocation() void FTermDetection::getSystemTermType() { // Import the untrusted environment variable TERM - const char* const& term_env = std::getenv("TERM"); - const char* termfilename = fterm_data->getTermFileName(); + const auto& term_env = std::getenv("TERM"); + const auto& termfilename = fterm_data->getTermFileName(); if ( term_env ) { diff --git a/src/ftextview.cpp b/src/ftextview.cpp index 4caa8b62..c8fe6598 100644 --- a/src/ftextview.cpp +++ b/src/ftextview.cpp @@ -322,7 +322,7 @@ void FTextView::clear() if ( size == 0 ) return; - for (int y{0}; y < int(getTextHeight()); y++) + for (auto y{0}; y < int(getTextHeight()); y++) { print() << FPoint{2, 2 - nf_offset + y} << FString{size, L' '}; diff --git a/src/fvterm.cpp b/src/fvterm.cpp index 6109422f..5352546c 100644 --- a/src/fvterm.cpp +++ b/src/fvterm.cpp @@ -255,7 +255,7 @@ void FVTerm::resizeVTerm (const FSize& size) const //---------------------------------------------------------------------- void FVTerm::putVTerm() const { - for (int i{0}; i < vterm->height; i++) + for (auto i{0}; i < vterm->height; i++) { vterm->changes[i].xmin = 0; vterm->changes[i].xmax = uInt(vterm->width - 1); @@ -799,11 +799,11 @@ void FVTerm::restoreVTerm (const FRect& box) if ( h < 0 ) return; - for (int ty{0}; ty < h; ty++) + for (auto ty{0}; ty < h; ty++) { const int ypos = y + ty; - for (int tx{0}; tx < w; tx++) + for (auto tx{0}; tx < w; tx++) { const int xpos = x + tx; auto& tc = vterm->data[ypos * vterm->width + xpos]; // terminal character @@ -888,7 +888,7 @@ void FVTerm::getArea (const FPoint& pos, const FTermArea* area) else length = area->width; - for (int y{0}; y < y_end; y++) // line loop + for (auto y{0}; y < y_end; y++) // line loop { const auto& tc = vterm->data[(ay + y) * vterm->width + ax]; // terminal character auto& ac = area->data[y * area->width]; // area character @@ -935,7 +935,7 @@ void FVTerm::getArea (const FRect& box, const FTermArea* area) if ( length < 1 ) return; - for (int _y = 0; _y < y_end; _y++) // line loop + for (auto _y = 0; _y < y_end; _y++) // line loop { const int line_len = area->width + area->right_shadow; const auto& tc = vterm->data[(y + _y - 1) * vterm->width + x - 1]; // terminal character @@ -979,7 +979,7 @@ void FVTerm::putArea (const FTermArea* area) const else y_end = height; - for (int y{0}; y < y_end; y++) // Line loop + for (auto y{0}; y < y_end; y++) // Line loop { bool modified{false}; auto line_xmin = int(area->changes[y].xmin); @@ -997,7 +997,7 @@ void FVTerm::putArea (const FTermArea* area) const if ( ax + line_xmin >= vterm->width ) continue; - for (int x = line_xmin; x <= line_xmax; x++) // Column loop + for (auto x = line_xmin; x <= line_xmax; x++) // Column loop { // Global terminal positions int tx = ax + x; @@ -1071,7 +1071,7 @@ void FVTerm::putArea (const FPoint& pos, const FTermArea* area) if ( length < 1 ) return; - for (int y{0}; y < y_end; y++) // line loop + for (auto y{0}; y < y_end; y++) // line loop { if ( area->changes[y].trans_count == 0 ) { @@ -1083,7 +1083,7 @@ void FVTerm::putArea (const FPoint& pos, const FTermArea* area) else { // Line has one or more transparent characters - for (int x{0}; x < length; x++) // column loop + for (auto x{0}; x < length; x++) // column loop { const int cx = ax + x; const int cy = ay + y; @@ -1118,7 +1118,7 @@ void FVTerm::scrollAreaForward (FTermArea* area) const const int total_width = area->width + area->right_shadow; const int y_max = area->height - 1; - for (int y{0}; y < y_max; y++) + for (auto y{0}; y < y_max; y++) { const int pos1 = y * total_width; const int pos2 = (y + 1) * total_width; @@ -1148,7 +1148,7 @@ void FVTerm::scrollAreaForward (FTermArea* area) const putArea (FPoint{1, 1}, vdesktop); // avoid update lines from 0 to (y_max - 1) - for (int y{0}; y < y_max; y++) + for (auto y{0}; y < y_max; y++) { area->changes[y].xmin = uInt(area->width - 1); area->changes[y].xmax = 0; @@ -1171,7 +1171,7 @@ void FVTerm::scrollAreaReverse (FTermArea* area) const const int total_width = area->width + area->right_shadow; const int y_max = area->height - 1; - for (int y = y_max; y > 0; y--) + for (auto y = y_max; y > 0; y--) { const int pos1 = (y - 1) * total_width; const int pos2 = y * total_width; @@ -1200,7 +1200,7 @@ void FVTerm::scrollAreaReverse (FTermArea* area) const putArea (FPoint{1, 1}, vdesktop); // avoid update lines from 1 to y_max - for (int y{1}; y <= y_max; y++) + for (auto y{1}; y <= y_max; y++) { area->changes[y].xmin = uInt(area->width - 1); area->changes[y].xmax = 0; @@ -1235,7 +1235,7 @@ void FVTerm::clearArea (FTermArea* area, int fillchar) const else clearAreaWithShadow(area, nc); - for (int i{0}; i < area->height; i++) + for (auto i{0}; i < area->height; i++) { area->changes[i].xmin = 0; area->changes[i].xmax = w - 1; @@ -1250,7 +1250,7 @@ void FVTerm::clearArea (FTermArea* area, int fillchar) const area->changes[i].trans_count = 0; } - for (int i{0}; i < area->bottom_shadow; i++) + for (auto i{0}; i < area->bottom_shadow; i++) { const int y = area->height + i; area->changes[y].xmin = 0; @@ -2033,9 +2033,8 @@ bool FVTerm::clearTerm (int fillchar) const const auto& cd = TCAP(fc::t_clr_eos); const auto& cb = TCAP(fc::t_clr_eol); const bool ut = FTermcap::background_color_erase; - const bool normal = FTerm::isNormal(next_attribute); - auto next = &next_attribute; - appendAttributes(next); + const bool normal = FTerm::isNormal (next_attribute); + appendAttributes (next_attribute); if ( ! ( (cl || cd || cb) && (normal || ut) ) || fillchar != ' ' ) @@ -2058,7 +2057,7 @@ bool FVTerm::clearTerm (int fillchar) const { term_pos->setPoint(-1, -1); - for (int i{0}; i < int(FTerm::getLineNumber()); i++) + for (auto i{0}; i < int(FTerm::getLineNumber()); i++) { setTermXY (0, i); appendOutputBuffer (cb); @@ -2089,7 +2088,7 @@ bool FVTerm::clearFullArea (const FTermArea* area, FChar& nc) const } else { - for (int i{0}; i < vdesktop->height; i++) + for (auto i{0}; i < vdesktop->height; i++) { vdesktop->changes[i].xmin = 0; vdesktop->changes[i].xmax = uInt(vdesktop->width) - 1; @@ -2109,7 +2108,7 @@ void FVTerm::clearAreaWithShadow (const FTermArea* area, const FChar& nc) const int total_width = area->width + area->right_shadow; t_char.attr.bit.transparent = true; - for (int y{0}; y < area->height; y++) + for (auto y{0}; y < area->height; y++) { const int pos = y * total_width; // Clear area @@ -2119,7 +2118,7 @@ void FVTerm::clearAreaWithShadow (const FTermArea* area, const FChar& nc) } // Make bottom shadow transparent - for (int y{0}; y < area->bottom_shadow; y++) + for (auto y{0}; y < area->bottom_shadow; y++) { const int pos = total_width * (y + area->height); std::fill_n (&area->data[pos], total_width, t_char); @@ -2132,7 +2131,7 @@ bool FVTerm::canClearToEOL (uInt xmin, uInt y) // Is the line from xmin to the end of the line blank? // => clear to end of line - FTermArea*& vt = vterm; + auto& vt = vterm; const auto& ce = TCAP(fc::t_clr_eol); const auto& min_char = vt->data[y * uInt(vt->width) + xmin]; @@ -2167,7 +2166,7 @@ bool FVTerm::canClearLeadingWS (uInt& xmin, uInt y) // Line has leading whitespace // => clear from xmin to beginning of line - FTermArea*& vt = vterm; + auto& vt = vterm; const auto& cb = TCAP(fc::t_clr_bol); const auto& first_char = vt->data[y * uInt(vt->width)]; @@ -2205,7 +2204,7 @@ bool FVTerm::canClearTrailingWS (uInt& xmax, uInt y) // Line has trailing whitespace // => clear from xmax to end of line - FTermArea*& vt = vterm; + auto& vt = vterm; const auto& ce = TCAP(fc::t_clr_eol); const auto& last_char = vt->data[(y + 1) * uInt(vt->width) - 1]; @@ -2242,7 +2241,7 @@ bool FVTerm::skipUnchangedCharacters (uInt& x, uInt xmax, uInt y) const { // Skip characters without changes if it is faster than redrawing - FTermArea*& vt = vterm; + auto& vt = vterm; auto print_char = &vt->data[y * uInt(vt->width) + x]; print_char->attr.bit.printed = true; @@ -2277,11 +2276,11 @@ void FVTerm::printRange ( uInt xmin, uInt xmax, uInt y { for (uInt x = xmin; x <= xmax; x++) { - FTermArea*& vt = vterm; + auto& vt = vterm; const auto& ec = TCAP(fc::t_erase_chars); const auto& rp = TCAP(fc::t_repeat_char); - auto print_char = &vt->data[y * uInt(vt->width) + x]; - print_char->attr.bit.printed = true; + auto& print_char = vt->data[y * uInt(vt->width) + x]; + print_char.attr.bit.printed = true; replaceNonPrintableFullwidth (x, print_char); // skip character with no changes @@ -2289,7 +2288,7 @@ void FVTerm::printRange ( uInt xmin, uInt xmax, uInt y continue; // Erase character - if ( ec && print_char->ch == ' ' ) + if ( ec && print_char.ch == ' ' ) { exit_state erase_state = \ eraseCharacters(x, xmax, y, draw_trailing_ws); @@ -2311,36 +2310,36 @@ void FVTerm::printRange ( uInt xmin, uInt xmax, uInt y //---------------------------------------------------------------------- inline void FVTerm::replaceNonPrintableFullwidth ( uInt x - , FChar*& print_char ) const + , FChar& print_char ) const { // Replace non-printable full-width characters that are truncated // from the right or left terminal side - if ( x == 0 && isFullWidthPaddingChar(*print_char) ) + if ( x == 0 && isFullWidthPaddingChar(print_char) ) { - print_char->ch = fc::SingleLeftAngleQuotationMark; // ‹ - print_char->attr.bit.fullwidth_padding = false; + print_char.ch = fc::SingleLeftAngleQuotationMark; // ‹ + print_char.attr.bit.fullwidth_padding = false; } else if ( x == uInt(vterm->width - 1) - && isFullWidthChar(*print_char) ) + && isFullWidthChar(print_char) ) { - print_char->ch = fc::SingleRightAngleQuotationMark; // › - print_char->attr.bit.char_width = 1; + print_char.ch = fc::SingleRightAngleQuotationMark; // › + print_char.attr.bit.char_width = 1; } } //---------------------------------------------------------------------- void FVTerm::printCharacter ( uInt& x, uInt y, bool min_and_not_max - , FChar*& print_char) const + , FChar& print_char) const { // General character output on terminal - if ( x < uInt(vterm->width - 1) && isFullWidthChar(*print_char) ) + if ( x < uInt(vterm->width - 1) && isFullWidthChar(print_char) ) { printFullWidthCharacter (x, y, print_char); } else if ( x > 0 && x < uInt(vterm->width - 1) - && isFullWidthPaddingChar(*print_char) ) + && isFullWidthPaddingChar(print_char) ) { printFullWidthPaddingCharacter (x, y, print_char); } @@ -2358,17 +2357,17 @@ void FVTerm::printCharacter ( uInt& x, uInt y, bool min_and_not_max //---------------------------------------------------------------------- void FVTerm::printFullWidthCharacter ( uInt& x, uInt y - , FChar*& print_char ) const + , FChar& print_char ) const { const auto vt = vterm; - auto next_char = &vt->data[y * uInt(vt->width) + x + 1]; + auto& next_char = vt->data[y * uInt(vt->width) + x + 1]; - if ( print_char->attr.byte[0] == next_char->attr.byte[0] - && print_char->attr.byte[1] == next_char->attr.byte[1] - && print_char->fg_color == next_char->fg_color - && print_char->bg_color == next_char->bg_color - && isFullWidthChar(*print_char) - && isFullWidthPaddingChar(*next_char) ) + if ( print_char.attr.byte[0] == next_char.attr.byte[0] + && print_char.attr.byte[1] == next_char.attr.byte[1] + && print_char.fg_color == next_char.fg_color + && print_char.bg_color == next_char.bg_color + && isFullWidthChar(print_char) + && isFullWidthPaddingChar(next_char) ) { // Print a full-width character appendCharacter (print_char); @@ -2383,7 +2382,7 @@ void FVTerm::printFullWidthCharacter ( uInt& x, uInt y term_pos->x_ref()++; markAsPrinted (x, y); - if ( isFullWidthPaddingChar(*next_char) ) + if ( isFullWidthPaddingChar(next_char) ) { // Print ellipses for the 2nd full-width character column x++; @@ -2397,17 +2396,17 @@ void FVTerm::printFullWidthCharacter ( uInt& x, uInt y //---------------------------------------------------------------------- void FVTerm::printFullWidthPaddingCharacter ( uInt& x, uInt y - , FChar*& print_char) const + , FChar& print_char) const { const auto vt = vterm; - auto prev_char = &vt->data[y * uInt(vt->width) + x - 1]; + auto& prev_char = vt->data[y * uInt(vt->width) + x - 1]; - if ( print_char->attr.byte[0] == prev_char->attr.byte[0] - && print_char->attr.byte[1] == prev_char->attr.byte[1] - && print_char->fg_color == prev_char->fg_color - && print_char->bg_color == prev_char->bg_color - && isFullWidthChar(*prev_char) - && isFullWidthPaddingChar(*print_char) ) + if ( print_char.attr.byte[0] == prev_char.attr.byte[0] + && print_char.attr.byte[1] == prev_char.attr.byte[1] + && print_char.fg_color == prev_char.fg_color + && print_char.bg_color == prev_char.bg_color + && isFullWidthChar(prev_char) + && isFullWidthPaddingChar(print_char) ) { // Move cursor one character to the left const auto& le = TCAP(fc::t_cursor_left); @@ -2442,12 +2441,12 @@ void FVTerm::printFullWidthPaddingCharacter ( uInt& x, uInt y //---------------------------------------------------------------------- void FVTerm::printHalfCovertFullWidthCharacter ( uInt& x, uInt y - , FChar*& print_char ) const + , FChar& print_char ) const { const auto vt = vterm; - auto prev_char = &vt->data[y * uInt(vt->width) + x - 1]; + auto& prev_char = vt->data[y * uInt(vt->width) + x - 1]; - if ( isFullWidthChar(*prev_char) && ! isFullWidthPaddingChar(*print_char) ) + if ( isFullWidthChar(prev_char) && ! isFullWidthPaddingChar(print_char) ) { // Move cursor one character to the left const auto& le = TCAP(fc::t_cursor_left); @@ -2478,9 +2477,9 @@ void FVTerm::printHalfCovertFullWidthCharacter ( uInt& x, uInt y //---------------------------------------------------------------------- inline void FVTerm::skipPaddingCharacter ( uInt& x, uInt y - , const FChar* const& print_char ) const + , const FChar& print_char ) const { - if ( isFullWidthChar(*print_char) ) // full-width character + if ( isFullWidthChar(print_char) ) // full-width character { x++; // Skip the following padding character term_pos->x_ref()++; @@ -2497,7 +2496,6 @@ FVTerm::exit_state FVTerm::eraseCharacters ( uInt& x, uInt xmax, uInt y const auto& vt = vterm; const auto& ec = TCAP(fc::t_erase_chars); auto& print_char = vt->data[y * uInt(vt->width) + x]; - auto print_ch = &print_char; if ( ! ec || print_char.ch != ' ' ) return not_used; @@ -2517,7 +2515,7 @@ FVTerm::exit_state FVTerm::eraseCharacters ( uInt& x, uInt xmax, uInt y if ( whitespace == 1 ) { - appendCharacter (print_ch); + appendCharacter (print_char); markAsPrinted (x, y); } else @@ -2528,7 +2526,7 @@ FVTerm::exit_state FVTerm::eraseCharacters ( uInt& x, uInt xmax, uInt y if ( whitespace > erase_char_length + cursor_address_length && (ut || normal) ) { - appendAttributes (print_ch); + appendAttributes (print_char); appendOutputBuffer (FTermcap::encodeParameter(ec, whitespace, 0, 0, 0, 0, 0, 0, 0, 0)); if ( x + whitespace - 1 < xmax || draw_trailing_ws ) @@ -2544,7 +2542,7 @@ FVTerm::exit_state FVTerm::eraseCharacters ( uInt& x, uInt xmax, uInt y for (uInt i{0}; i < whitespace; i++) { - appendCharacter (print_ch); + appendCharacter (print_char); x++; } } @@ -2562,7 +2560,7 @@ FVTerm::exit_state FVTerm::repeatCharacter (uInt& x, uInt xmax, uInt y) const const auto& vt = vterm; const auto& rp = TCAP(fc::t_repeat_char); - auto print_char = &vt->data[y * uInt(vt->width) + x]; + auto& print_char = vt->data[y * uInt(vt->width) + x]; if ( ! rp ) return not_used; @@ -2573,7 +2571,7 @@ FVTerm::exit_state FVTerm::repeatCharacter (uInt& x, uInt xmax, uInt y) const { const auto& ch = vt->data[y * uInt(vt->width) + i]; - if ( *print_char == ch ) + if ( print_char == ch ) repetitions++; else break; @@ -2589,12 +2587,12 @@ FVTerm::exit_state FVTerm::repeatCharacter (uInt& x, uInt xmax, uInt y) const const uInt start_pos = x; if ( repetitions > repeat_char_length - && print_char->ch < 128 ) + && print_char.ch < 128 ) { newFontChanges (print_char); charsetChanges (print_char); appendAttributes (print_char); - appendOutputBuffer (FTermcap::encodeParameter(rp, print_char->ch, repetitions, 0, 0, 0, 0, 0, 0, 0)); + appendOutputBuffer (FTermcap::encodeParameter(rp, print_char.ch, repetitions, 0, 0, 0, 0, 0, 0, 0)); term_pos->x_ref() += int(repetitions); x = x + repetitions - 1; } @@ -2768,9 +2766,9 @@ bool FVTerm::updateTerminalLine (uInt y) const bool draw_leading_ws = false; bool draw_trailing_ws = false; const auto& ce = TCAP(fc::t_clr_eol); - auto first_char = &vt->data[y * uInt(vt->width)]; - auto last_char = &vt->data[(y + 1) * uInt(vt->width) - 1]; - auto min_char = &vt->data[y * uInt(vt->width) + xmin]; + auto& first_char = vt->data[y * uInt(vt->width)]; + auto& last_char = vt->data[(y + 1) * uInt(vt->width) - 1]; + auto& min_char = vt->data[y * uInt(vt->width) + xmin]; // Clear rest of line bool is_eol_clean = canClearToEOL (xmin, y); @@ -2912,26 +2910,26 @@ inline void FVTerm::markAsPrinted (uInt from, uInt to, uInt line) } //---------------------------------------------------------------------- -inline void FVTerm::newFontChanges (FChar*& next_char) +inline void FVTerm::newFontChanges (FChar& next_char) { // NewFont special cases if ( ! FTerm::isNewFont() ) return; - if ( next_char->ch == fc::LowerHalfBlock ) + if ( next_char.ch == fc::LowerHalfBlock ) { - next_char->ch = fc::UpperHalfBlock; - next_char->attr.bit.reverse = true; + next_char.ch = fc::UpperHalfBlock; + next_char.attr.bit.reverse = true; } - else if ( isReverseNewFontchar(next_char->ch) ) - next_char->attr.bit.reverse = true; // Show in reverse video + else if ( isReverseNewFontchar(next_char.ch) ) + next_char.attr.bit.reverse = true; // Show in reverse video } //---------------------------------------------------------------------- -inline void FVTerm::charsetChanges (FChar*& next_char) +inline void FVTerm::charsetChanges (FChar& next_char) { - const wchar_t& ch = next_char->ch; - next_char->encoded_char = ch; + const wchar_t& ch = next_char.ch; + next_char.encoded_char = ch; if ( FTerm::getEncoding() == fc::UTF8 ) return; @@ -2943,17 +2941,17 @@ inline void FVTerm::charsetChanges (FChar*& next_char) if ( ch_enc == 0 ) { - next_char->encoded_char = wchar_t(FTerm::charEncode(ch, fc::ASCII)); + next_char.encoded_char = wchar_t(FTerm::charEncode(ch, fc::ASCII)); return; } - next_char->encoded_char = ch_enc; + next_char.encoded_char = ch_enc; if ( FTerm::getEncoding() == fc::VT100 ) - next_char->attr.bit.alt_charset = true; + next_char.attr.bit.alt_charset = true; else if ( FTerm::getEncoding() == fc::PC ) { - next_char->attr.bit.pc_charset = true; + next_char.attr.bit.pc_charset = true; if ( FTerm::isPuttyTerminal() ) return; @@ -2961,18 +2959,18 @@ inline void FVTerm::charsetChanges (FChar*& next_char) if ( FTerm::isXTerminal() && ch_enc < 0x20 ) // Character 0x00..0x1f { if ( FTerm::hasUTF8() ) - next_char->encoded_char = int(FTerm::charEncode(ch, fc::ASCII)); + next_char.encoded_char = int(FTerm::charEncode(ch, fc::ASCII)); else { - next_char->encoded_char += 0x5f; - next_char->attr.bit.alt_charset = true; + next_char.encoded_char += 0x5f; + next_char.attr.bit.alt_charset = true; } } } } //---------------------------------------------------------------------- -inline void FVTerm::appendCharacter (FChar*& next_char) const +inline void FVTerm::appendCharacter (FChar& next_char) const { const int term_width = vterm->width - 1; const int term_height = vterm->height - 1; @@ -2987,41 +2985,39 @@ inline void FVTerm::appendCharacter (FChar*& next_char) const } //---------------------------------------------------------------------- -inline void FVTerm::appendChar (FChar*& next_char) const +inline void FVTerm::appendChar (FChar& next_char) const { newFontChanges (next_char); charsetChanges (next_char); appendAttributes (next_char); characterFilter (next_char); - appendOutputBuffer (next_char->encoded_char); + appendOutputBuffer (next_char.encoded_char); } //---------------------------------------------------------------------- -inline void FVTerm::appendAttributes (FChar*& next_attr) const +inline void FVTerm::appendAttributes (FChar& next_attr) const { - auto term_attr = &term_attribute; - // generate attribute string for the next character - const char* attr_str = FTerm::changeAttribute (term_attr, next_attr); + const auto attr_str = FTerm::changeAttribute (term_attribute, next_attr); if ( attr_str ) appendOutputBuffer (attr_str); } //---------------------------------------------------------------------- -int FVTerm::appendLowerRight (FChar*& screen_char) const +void FVTerm::appendLowerRight (FChar& last_char) const { const auto& SA = TCAP(fc::t_enter_am_mode); const auto& RA = TCAP(fc::t_exit_am_mode); if ( ! FTermcap::automatic_right_margin ) { - appendChar (screen_char); + appendChar (last_char); } else if ( SA && RA ) { appendOutputBuffer (RA); - appendChar (screen_char); + appendChar (last_char); appendOutputBuffer (SA); } else @@ -3035,21 +3031,21 @@ int FVTerm::appendLowerRight (FChar*& screen_char) const const int x = int(FTerm::getColumnNumber()) - 2; const int y = int(FTerm::getLineNumber()) - 1; setTermXY (x, y); - appendChar (screen_char); + appendChar (last_char); term_pos->x_ref()++; setTermXY (x, y); - screen_char--; + FChar& second_last = *(&last_char - 1); if ( IC ) { appendOutputBuffer (FTermcap::encodeParameter(IC, 1, 0, 0, 0, 0, 0, 0, 0, 0)); - appendChar (screen_char); + appendChar (second_last); } else if ( im && ei ) { appendOutputBuffer (im); - appendChar (screen_char); + appendChar (second_last); if ( ip ) appendOutputBuffer (ip); @@ -3059,29 +3055,27 @@ int FVTerm::appendLowerRight (FChar*& screen_char) const else if ( ic ) { appendOutputBuffer (ic); - appendChar (screen_char); + appendChar (second_last); if ( ip ) appendOutputBuffer (ip); } } - - return screen_char->ch; } //---------------------------------------------------------------------- -inline void FVTerm::characterFilter (FChar*& next_char) +inline void FVTerm::characterFilter (FChar& next_char) { charSubstitution& sub_map = fterm->getCharSubstitutionMap(); - if ( sub_map.find(next_char->encoded_char) != sub_map.end() ) - next_char->encoded_char = sub_map[next_char->encoded_char]; + if ( sub_map.find(next_char.encoded_char) != sub_map.end() ) + next_char.encoded_char = sub_map[next_char.encoded_char]; } //---------------------------------------------------------------------- inline void FVTerm::appendOutputBuffer (const std::string& s) { - const char* const& c_string = s.c_str(); + const auto& c_string = s.c_str(); FTermcap::paddingPrint (c_string, 1, appendOutputBuffer); } diff --git a/src/fwidget.cpp b/src/fwidget.cpp index d3511b30..2b0ae510 100644 --- a/src/fwidget.cpp +++ b/src/fwidget.cpp @@ -1360,7 +1360,7 @@ void FWidget::hideArea (const FSize& size) if ( size.getWidth() == 0 ) return; - for (int y{0}; y < int(size.getHeight()); y++) + for (auto y{0}; y < int(size.getHeight()); y++) { print() << FPoint{1, 1 + y} << FString{size.getWidth(), L' '}; } diff --git a/src/fwidget_functions.cpp b/src/fwidget_functions.cpp index b3d60d80..d8e0526a 100644 --- a/src/fwidget_functions.cpp +++ b/src/fwidget_functions.cpp @@ -451,7 +451,7 @@ inline void drawBox (FWidget* w, const FRect& r) << FString{r.getWidth() - 2, fc::BoxDrawingsHorizontal} // ─ << fc::BoxDrawingsDownAndLeft; // ┐ - for (int y = r.getY1() + 1; y < r.getY2(); y++) + for (auto y = r.getY1() + 1; y < r.getY2(); y++) { w->print() << FPoint{r.getX1(), y} << fc::BoxDrawingsVertical // │ @@ -475,7 +475,7 @@ inline void drawNewFontBox (FWidget* w, const FRect& r) << FString{r.getWidth() - 2, fc::NF_border_line_horizontal} // ─ << fc::NF_border_corner_middle_upper_right; // ┐ - for (int y = r.getY1() + 1; y < r.getY2(); y++) + for (auto y = r.getY1() + 1; y < r.getY2(); y++) { w->print() << FPoint{r.getX1(), y} << fc::NF_border_line_vertical // │ @@ -497,7 +497,7 @@ inline void drawNewFontListBox (FWidget* w, const FRect& r) << FString{r.getWidth() - 2, fc::NF_border_line_horizontal} // ─ << fc::NF_border_line_left_down; // ╷ - for (int y = r.getY1() + 1; y < r.getY2(); y++) + for (auto y = r.getY1() + 1; y < r.getY2(); y++) { w->print() << FPoint{r.getX1(), y} << fc::NF_border_line_left // border left ⎸ diff --git a/src/fwindow.cpp b/src/fwindow.cpp index 986571ff..e1012e9a 100644 --- a/src/fwindow.cpp +++ b/src/fwindow.cpp @@ -247,7 +247,7 @@ void FWindow::drawBorder() << FString{r.getWidth() - 2, fc::NF_border_line_upper} // ¯ << fc::NF_rev_border_corner_upper_right; // ⎤ - for (int y = r.getY1() + 1; y < r.getY2(); y++) + for (auto y = r.getY1() + 1; y < r.getY2(); y++) { print() << FPoint{r.getX1(), y} << fc::NF_border_line_left // border left ⎸ diff --git a/src/include/final/fapplication.h b/src/include/final/fapplication.h index ab8d3e42..c57bd424 100644 --- a/src/include/final/fapplication.h +++ b/src/include/final/fapplication.h @@ -189,7 +189,7 @@ class FApplication : public FWidget void sendKeyboardAccelerator(); void processKeyboardEvent() const; bool processDialogSwitchAccelerator() const; - bool processAccelerator (const FWidget* const&) const; + bool processAccelerator (const FWidget&) const; bool getMouseEvent() const; FWidget*& determineClickedWidget(); void unsetMoveSizeMode() const; diff --git a/src/include/final/fcombobox.h b/src/include/final/fcombobox.h index ec23e70f..4c2f6af1 100644 --- a/src/include/final/fcombobox.h +++ b/src/include/final/fcombobox.h @@ -216,7 +216,7 @@ class FComboBox : public FWidget void draw() override; void onePosUp(); void onePosDown(); - void passEventToListWindow (FMouseEvent* const&); + void passEventToListWindow (const FMouseEvent&); void processClick() const; void processChanged() const; diff --git a/src/include/final/fmenu.h b/src/include/final/fmenu.h index a20e0544..81bd4cb1 100644 --- a/src/include/final/fmenu.h +++ b/src/include/final/fmenu.h @@ -192,9 +192,9 @@ class FMenu : public FWindow, public FMenuList void mouseMoveDeselection (FMenuItem*, MouseStates&); void mouseUpOverBorder(); void mouseMoveOverBorder (MouseStates&) const; - void passEventToSubMenu (FMouseEvent* const&); - void passEventToSuperMenu (FMouseEvent* const&); - void passEventToMenuBar (FMouseEvent* const&) const; + void passEventToSubMenu (const FMouseEvent&); + void passEventToSuperMenu (const FMouseEvent&); + void passEventToMenuBar (const FMouseEvent&) const; bool containsMenuStructure (const FPoint&); bool containsMenuStructure (int, int); FMenu* superMenuAt (const FPoint&); diff --git a/src/include/final/fmenubar.h b/src/include/final/fmenubar.h index ec51b27f..1760cab5 100644 --- a/src/include/final/fmenubar.h +++ b/src/include/final/fmenubar.h @@ -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&) const; + void passEventToMenu (const FMouseEvent&) const; void leaveMenuBar(); // Data members diff --git a/src/include/final/foptiattr.h b/src/include/final/foptiattr.h index c38e1ede..a9103174 100644 --- a/src/include/final/foptiattr.h +++ b/src/include/final/foptiattr.h @@ -152,12 +152,12 @@ class FOptiAttr final void set_orig_orig_colors (const char[]); // Inquiry - static bool isNormal (const FChar* const&); + static bool isNormal (const FChar&); // Methods void initialize(); static FColor vga2ansi (FColor); - const char* changeAttribute (FChar*&, FChar*&); + const char* changeAttribute (FChar&, FChar&); private: // Typedefs and Enumerations @@ -202,62 +202,62 @@ class FOptiAttr final }; // Mutators - bool setTermBold (FChar*&); - bool unsetTermBold (FChar*&); - bool setTermDim (FChar*&); - bool unsetTermDim (FChar*&); - bool setTermItalic (FChar*&); - bool unsetTermItalic (FChar*&); - bool setTermUnderline (FChar*&); - bool unsetTermUnderline (FChar*&); - bool setTermBlink (FChar*&); - bool unsetTermBlink (FChar*&); - bool setTermReverse (FChar*&); - bool unsetTermReverse (FChar*&); - bool setTermStandout (FChar*&); - bool unsetTermStandout (FChar*&); - bool setTermInvisible (FChar*&); - bool unsetTermInvisible (FChar*&); - bool setTermProtected (FChar*&); - bool unsetTermProtected (FChar*&); - bool setTermCrossedOut (FChar*&); - bool unsetTermCrossedOut (FChar*&); - bool setTermDoubleUnderline (FChar*&); - bool unsetTermDoubleUnderline (FChar*&); - bool setTermAttributes ( FChar*& + bool setTermBold (FChar&); + bool unsetTermBold (FChar&); + bool setTermDim (FChar&); + bool unsetTermDim (FChar&); + bool setTermItalic (FChar&); + bool unsetTermItalic (FChar&); + bool setTermUnderline (FChar&); + bool unsetTermUnderline (FChar&); + bool setTermBlink (FChar&); + bool unsetTermBlink (FChar&); + bool setTermReverse (FChar&); + bool unsetTermReverse (FChar&); + bool setTermStandout (FChar&); + bool unsetTermStandout (FChar&); + bool setTermInvisible (FChar&); + bool unsetTermInvisible (FChar&); + bool setTermProtected (FChar&); + bool unsetTermProtected (FChar&); + bool setTermCrossedOut (FChar&); + bool unsetTermCrossedOut (FChar&); + bool setTermDoubleUnderline (FChar&); + bool unsetTermDoubleUnderline (FChar&); + bool setTermAttributes ( FChar& , bool, bool, bool , bool, bool, bool , bool, bool, bool ); - bool unsetTermAttributes (FChar*&); - bool setTermAltCharset (FChar*&); - bool unsetTermAltCharset (FChar*&); - bool setTermPCcharset (FChar*&); - bool unsetTermPCcharset (FChar*&); - bool setTermDefaultColor (FChar*&); - void setAttributesOn (FChar*&); - void setAttributesOff (FChar*&); + bool unsetTermAttributes (FChar&); + bool setTermAltCharset (FChar&); + bool unsetTermAltCharset (FChar&); + bool setTermPCcharset (FChar&); + bool unsetTermPCcharset (FChar&); + bool setTermDefaultColor (FChar&); + void setAttributesOn (FChar&); + void setAttributesOff (FChar&); // Inquiries - static bool hasColor (const FChar* const&); - static bool hasAttribute (const FChar* const&); - static bool hasNoAttribute (const FChar* const&); + static bool hasColor (const FChar&); + static bool hasAttribute (const FChar&); + static bool hasNoAttribute (const FChar&); // Methods - bool hasColorChanged (const FChar* const&, const FChar* const&) const; - void resetColor (FChar*&) const; - void prevent_no_color_video_attributes (FChar*&, bool = false); - void deactivateAttributes (FChar*&, FChar*&); - void changeAttributeSGR (FChar*&, FChar*&); - void changeAttributeSeparately (FChar*&, FChar*&); - 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*&) const; - void reset (FChar*&) const; + bool hasColorChanged (const FChar&, const FChar&) const; + void resetColor (FChar&) const; + void prevent_no_color_video_attributes (FChar&, bool = false); + void deactivateAttributes (FChar&, FChar&); + void changeAttributeSGR (FChar&, FChar&); + void changeAttributeSeparately (FChar&, FChar&); + void change_color (FChar&, FChar&); + void change_to_default_color (FChar&, FChar&, FColor&, FColor&); + void change_current_color (const FChar&, FColor, FColor); + void resetAttribute (FChar&) const; + void reset (FChar&) const; 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&); + void detectSwitchOn (const FChar&, const FChar&); + void detectSwitchOff (const FChar&, const FChar&); bool switchOn() const; bool switchOff() const; bool append_sequence (const char[]); diff --git a/src/include/final/fterm.h b/src/include/final/fterm.h index b8f1f845..aefaf4ba 100644 --- a/src/include/final/fterm.h +++ b/src/include/final/fterm.h @@ -304,7 +304,7 @@ class FTerm final void initTerminal(); static void initScreenSettings(); - static const char* changeAttribute (FChar*&, FChar*&); + static const char* changeAttribute (FChar&, FChar&); static void changeTermSizeFinished(); private: diff --git a/src/include/final/fvterm.h b/src/include/final/fvterm.h index 31f91cc1..f5bacd49 100644 --- a/src/include/final/fvterm.h +++ b/src/include/final/fvterm.h @@ -387,12 +387,12 @@ class FVTerm static bool canClearTrailingWS (uInt&, uInt); bool skipUnchangedCharacters (uInt&, uInt, uInt) const; void printRange (uInt, uInt, uInt, bool) const; - void replaceNonPrintableFullwidth (uInt, FChar*&) const; - void printCharacter (uInt&, uInt, bool, FChar*&) const; - void printFullWidthCharacter (uInt&, uInt, FChar*&) const; - void printFullWidthPaddingCharacter (uInt&, uInt, FChar*&) const; - void printHalfCovertFullWidthCharacter (uInt&, uInt, FChar*&) const; - void skipPaddingCharacter (uInt&, uInt, const FChar* const&) const; + void replaceNonPrintableFullwidth (uInt, FChar&) const; + void printCharacter (uInt&, uInt, bool, FChar&) const; + void printFullWidthCharacter (uInt&, uInt, FChar&) const; + void printFullWidthPaddingCharacter (uInt&, uInt, FChar&) const; + void printHalfCovertFullWidthCharacter (uInt&, uInt, FChar&) const; + void skipPaddingCharacter (uInt&, uInt, const FChar&) const; exit_state eraseCharacters (uInt&, uInt, uInt, bool) const; exit_state repeatCharacter (uInt&, uInt, uInt) const; bool isFullWidthChar (const FChar&) const; @@ -412,13 +412,13 @@ class FVTerm static bool hasPendingUpdates (const FTermArea*); static void markAsPrinted (uInt, uInt); static void markAsPrinted (uInt, uInt, uInt); - static void newFontChanges (FChar*&); - static void charsetChanges (FChar*&); - void appendCharacter (FChar*&) const; - void appendChar (FChar*&) const; - void appendAttributes (FChar*&) const; - int appendLowerRight (FChar*&) const; - static void characterFilter (FChar*&); + static void newFontChanges (FChar&); + static void charsetChanges (FChar&); + void appendCharacter (FChar&) const; + void appendChar (FChar&) const; + void appendAttributes (FChar&) const; + void appendLowerRight (FChar&) const; + static void characterFilter (FChar&); static void appendOutputBuffer (const std::string&); static void appendOutputBuffer (const char[]); static int appendOutputBuffer (int); diff --git a/test/fobject-test.cpp b/test/fobject-test.cpp index 9bc88980..64a1b35c 100644 --- a/test/fobject-test.cpp +++ b/test/fobject-test.cpp @@ -695,7 +695,7 @@ void FObjectTest::performTimerActionTest() CPPUNIT_ASSERT ( t2.getValue() == 0 ); finalcut::FTimerEvent timer_ev (finalcut::fc::Timer_Event, 1); - for (int x = 0; x < 10; x++) + for (auto x = 0; x < 10; x++) finalcut::FApplication::sendEvent (&t2, &timer_ev); CPPUNIT_ASSERT ( t2.getValue() == 10 ); diff --git a/test/foptiattr-test.cpp b/test/foptiattr-test.cpp index 81c6fcbe..36ff9613 100644 --- a/test/foptiattr-test.cpp +++ b/test/foptiattr-test.cpp @@ -120,24 +120,16 @@ void FOptiAttrTest::classNameTest() //---------------------------------------------------------------------- void FOptiAttrTest::noArgumentTest() { - finalcut::FChar* ch = new finalcut::FChar(); + finalcut::FChar ch{}; finalcut::FOptiAttr oa; oa.initialize(); // isNormal test CPPUNIT_ASSERT ( ! oa.isNormal(ch) ); - ch->fg_color = finalcut::fc::Default; + ch.fg_color = finalcut::fc::Default; CPPUNIT_ASSERT ( ! oa.isNormal(ch) ); - ch->bg_color = finalcut::fc::Default; + ch.bg_color = finalcut::fc::Default; CPPUNIT_ASSERT ( oa.isNormal(ch) ); - - // Null test - finalcut::FChar* ch_null = nullptr; - CPPUNIT_ASSERT ( oa.changeAttribute(ch, ch) == 0 ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(ch, ch_null), "" ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(ch_null, ch), "" ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(ch_null, ch_null), "" ); - delete ch; } //---------------------------------------------------------------------- @@ -193,32 +185,32 @@ void FOptiAttrTest::sgrOptimizerTest() oa.set_orig_orig_colors (0); oa.initialize(); - finalcut::FChar* from = new finalcut::FChar(); - finalcut::FChar* to = new finalcut::FChar(); + finalcut::FChar from{}; + finalcut::FChar to{}; CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Blue text on white background + bold + dim + italic - to->fg_color = finalcut::fc::Blue; - to->bg_color = finalcut::fc::White; - to->attr.bit.bold = true; - to->attr.bit.dim = true; - to->attr.bit.italic = true; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::Blue; + to.bg_color = finalcut::fc::White; + to.attr.bit.bold = true; + to.attr.bit.dim = true; + to.attr.bit.italic = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;10;2;1;3;34;47m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Yellow text on Black Yellow + bold - to->fg_color = finalcut::fc::Yellow; - to->bg_color = finalcut::fc::Black; - to->attr.bit.bold = true; - to->attr.bit.dim = false; - to->attr.bit.italic = false; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::Yellow; + to.bg_color = finalcut::fc::Black; + to.attr.bit.bold = true; + to.attr.bit.dim = false; + to.attr.bit.italic = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;10;1;33;40m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); @@ -298,9 +290,6 @@ void FOptiAttrTest::sgrOptimizerTest() std::strcpy(buffer.data(), CSI "m" CSI "38;2;0;139;139m" CSI "48;2;240;255;240m"); sgr_optimizer.optimize(); CPPUNIT_ASSERT_CSTRING ( buffer.data(), CSI "0;38;2;0;139;139;48;2;240;255;240m" ); - - delete to; - delete from; } //---------------------------------------------------------------------- @@ -370,46 +359,43 @@ void FOptiAttrTest::fakeReverseTest() oa.set_orig_orig_colors (0); oa.initialize(); - finalcut::FChar* from = new finalcut::FChar(); - finalcut::FChar* to = new finalcut::FChar(); + finalcut::FChar from{}; + finalcut::FChar to{}; CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Gray text on blue background - to->fg_color = finalcut::fc::LightGray; - to->bg_color = finalcut::fc::Blue; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::LightGray; + to.bg_color = finalcut::fc::Blue; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "37m" CSI "44m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Reverse on - to->attr.bit.reverse = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.reverse = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "34m" CSI "47m" ); - CPPUNIT_ASSERT ( from->fg_color == finalcut::fc::LightGray ); - CPPUNIT_ASSERT ( from->bg_color == finalcut::fc::Blue ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from.fg_color == finalcut::fc::LightGray ); + CPPUNIT_ASSERT ( from.bg_color == finalcut::fc::Blue ); + CPPUNIT_ASSERT ( from == to ); // Gray text on red background - to->bg_color = finalcut::fc::Red; - CPPUNIT_ASSERT ( *from != *to ); + to.bg_color = finalcut::fc::Red; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "31m" CSI "47m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Reverse off - to->attr.bit.reverse = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.reverse = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "37m" CSI "41m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); - - delete to; - delete from; } //---------------------------------------------------------------------- @@ -466,418 +452,415 @@ void FOptiAttrTest::ansiTest() oa.set_orig_orig_colors (0); oa.initialize(); - finalcut::FChar* from = new finalcut::FChar(); - finalcut::FChar* to = new finalcut::FChar(); + finalcut::FChar from{}; + finalcut::FChar to{}; CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Default color + bold - from->fg_color = finalcut::fc::Default; - from->bg_color = finalcut::fc::Default; - to->attr.bit.bold = true; - to->fg_color = finalcut::fc::Default; - to->bg_color = finalcut::fc::Default; - CPPUNIT_ASSERT ( *from != *to ); + from.fg_color = finalcut::fc::Default; + from.bg_color = finalcut::fc::Default; + to.attr.bit.bold = true; + to.fg_color = finalcut::fc::Default; + to.bg_color = finalcut::fc::Default; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;10;1m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Blue text on white background + dim + italic - to->fg_color = finalcut::fc::Blue; - to->bg_color = finalcut::fc::White; - to->attr.bit.dim = true; - to->attr.bit.italic = true; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::Blue; + to.bg_color = finalcut::fc::White; + to.attr.bit.dim = true; + to.attr.bit.italic = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;10;1m" CSI "34m" CSI "47m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Reset attributes + default background - to->attr.bit.bold = false; - to->attr.bit.dim = false; - to->attr.bit.italic = false; - to->bg_color = finalcut::fc::Default; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.bold = false; + to.attr.bit.dim = false; + to.attr.bit.italic = false; + to.bg_color = finalcut::fc::Default; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m" CSI "34m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Red text on black background - to->fg_color = finalcut::fc::Red; - to->bg_color = finalcut::fc::Black; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::Red; + to.bg_color = finalcut::fc::Black; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "31m" CSI "40m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // 256 color text and background - to->fg_color = finalcut::fc::SpringGreen3; - to->bg_color = finalcut::fc::NavyBlue; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::SpringGreen3; + to.bg_color = finalcut::fc::NavyBlue; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "32m" CSI "44m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Bold on (with default colors) - to->fg_color = finalcut::fc::Default; - to->bg_color = finalcut::fc::Default; - to->attr.bit.bold = true; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::Default; + to.bg_color = finalcut::fc::Default; + to.attr.bit.bold = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;10;1m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Bold off (with default colors) - to->attr.bit.bold = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.bold = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Dim on (with default colors) - to->attr.bit.dim = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.dim = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;10m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Dim off (with default colors) - to->attr.bit.dim = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.dim = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Italic on (with default colors) - to->attr.bit.italic = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.italic = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;10m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Italic off (with default colors) - to->attr.bit.italic = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.italic = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Underline on (with default colors) - to->attr.bit.underline = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.underline = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;10;4m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Underline off (with default colors) - to->attr.bit.underline = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.underline = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Blink on (with default colors) - to->attr.bit.blink = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.blink = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;10;5m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Blink off (with default colors) - to->attr.bit.blink = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.blink = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Reverse on (with default colors) - to->attr.bit.reverse = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.reverse = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;10;7m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Reverse off (with default colors) - to->attr.bit.reverse = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.reverse = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Standout on (with default colors) - to->attr.bit.standout = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.standout = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;10;7m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Standout off (with default colors) - to->attr.bit.standout = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.standout = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Invisible on (with default colors) - to->attr.bit.invisible = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.invisible = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;10;8m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Invisible off (with default colors) - to->attr.bit.invisible = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.invisible = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Protect on (with default colors) - to->attr.bit.protect = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.protect = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;10m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Protect off (with default colors) - to->attr.bit.protect = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.protect = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Crossed out on (with default colors) - to->attr.bit.crossed_out = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.crossed_out = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;10m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Crossed out off (with default colors) - to->attr.bit.crossed_out = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.crossed_out = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Double underline on (with default colors) - to->attr.bit.dbl_underline = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.dbl_underline = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;10m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Double underline off (with default colors) - to->attr.bit.dbl_underline = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.dbl_underline = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Alternate character set on (with default colors) - to->attr.bit.alt_charset = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.alt_charset = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;10;11m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Alternate character set off (with default colors) - to->attr.bit.alt_charset = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.alt_charset = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "10m" CSI "0m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // PC character set on (with default colors) - to->attr.bit.pc_charset = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.pc_charset = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;10m" CSI "11m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // PC character set off (with default colors) - to->attr.bit.pc_charset = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.pc_charset = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m" CSI "10m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Turn on all attributes (with default colors) - to->attr.bit.pc_charset = true; - to->attr.bit.bold = true; - to->attr.bit.dim = true; - to->attr.bit.italic = true; - to->attr.bit.underline = true; - to->attr.bit.blink = true; - to->attr.bit.reverse = true; - to->attr.bit.standout = true; - to->attr.bit.invisible = true; - to->attr.bit.protect = true; - to->attr.bit.crossed_out = true; - to->attr.bit.dbl_underline = true; - to->attr.bit.alt_charset = true; - to->attr.bit.pc_charset = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.pc_charset = true; + to.attr.bit.bold = true; + to.attr.bit.dim = true; + to.attr.bit.italic = true; + to.attr.bit.underline = true; + to.attr.bit.blink = true; + to.attr.bit.reverse = true; + to.attr.bit.standout = true; + to.attr.bit.invisible = true; + to.attr.bit.protect = true; + to.attr.bit.crossed_out = true; + to.attr.bit.dbl_underline = true; + to.attr.bit.alt_charset = true; + to.attr.bit.pc_charset = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;10;7;4;7;5;1;8;11m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Cyan text on blue background - to->fg_color = finalcut::fc::Cyan; - to->bg_color = finalcut::fc::Blue; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::Cyan; + to.bg_color = finalcut::fc::Blue; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "36m" CSI "44m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Bold off - to->attr.bit.bold = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.bold = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;10;7;5;8;11m" CSI "36m" CSI "44m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Dim off - to->attr.bit.dim = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.dim = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;10;7;5;8;11m" CSI "36m" CSI "44m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Italic off - to->attr.bit.italic = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.italic = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;10;7;5;8;11m" CSI "36m" CSI "44m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Underline off - to->attr.bit.underline = false; - CPPUNIT_ASSERT ( *from == *to ); // because of noColorVideo = 3 + to.attr.bit.underline = false; + CPPUNIT_ASSERT ( from == to ); // because of noColorVideo = 3 CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Blink off - to->attr.bit.blink = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.blink = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;10;7;8;11m" CSI "36m" CSI "44m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Reverse off - to->attr.bit.reverse = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.reverse = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;10;8;11m" CSI "36m" CSI "44m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Standout off - to->attr.bit.standout = false; - CPPUNIT_ASSERT ( *from == *to ); // because of noColorVideo = 3 + to.attr.bit.standout = false; + CPPUNIT_ASSERT ( from == to ); // because of noColorVideo = 3 CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Invisible off - to->attr.bit.invisible = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.invisible = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;10;11m" CSI "36m" CSI "44m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Protect off - to->attr.bit.protect = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.protect = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;10;11m" CSI "36m" CSI "44m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Crossed out off - to->attr.bit.crossed_out = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.crossed_out = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;10;11m" CSI "36m" CSI "44m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Double underline off - to->attr.bit.dbl_underline = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.dbl_underline = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;10;11m" CSI "36m" CSI "44m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Alternate character set off - to->attr.bit.alt_charset = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.alt_charset = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;10m" CSI "11m" CSI "36m" CSI "44m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // PC character set off - to->attr.bit.pc_charset = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.pc_charset = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m" CSI "10m" CSI "36m" CSI "44m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Green text color - to->fg_color = finalcut::fc::Green; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::Green; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), CSI "32m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Default text color - to->fg_color = finalcut::fc::Default; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::Default; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( printSequence(oa.changeAttribute(from, to)).c_str() , "Esc [ 3 9 m " ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); - - delete to; - delete from; } //---------------------------------------------------------------------- @@ -932,413 +915,410 @@ void FOptiAttrTest::vt100Test() oa.set_orig_orig_colors (0); oa.initialize(); - finalcut::FChar* from = new finalcut::FChar(); - finalcut::FChar* to = new finalcut::FChar(); + finalcut::FChar from{}; + finalcut::FChar to{}; CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Default color + bold - from->fg_color = finalcut::fc::Default; - from->bg_color = finalcut::fc::Default; - to->attr.bit.bold = true; - to->fg_color = finalcut::fc::Default; - to->bg_color = finalcut::fc::Default; - CPPUNIT_ASSERT ( *from != *to ); + from.fg_color = finalcut::fc::Default; + from.bg_color = finalcut::fc::Default; + to.attr.bit.bold = true; + to.fg_color = finalcut::fc::Default; + to.bg_color = finalcut::fc::Default; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;1m\017$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Blue text on white background + dim + italic - to->fg_color = finalcut::fc::Blue; - to->bg_color = finalcut::fc::White; - to->attr.bit.dim = true; - to->attr.bit.italic = true; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::Blue; + to.bg_color = finalcut::fc::White; + to.attr.bit.dim = true; + to.attr.bit.italic = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;1m\017$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Reset attributes + default background - to->attr.bit.bold = false; - to->attr.bit.dim = false; - to->attr.bit.italic = false; - to->bg_color = finalcut::fc::Default; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.bold = false; + to.attr.bit.dim = false; + to.attr.bit.italic = false; + to.bg_color = finalcut::fc::Default; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m$<2>" ); // Red text on black background - to->fg_color = finalcut::fc::Red; - to->bg_color = finalcut::fc::Black; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::Red; + to.bg_color = finalcut::fc::Black; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , "" ); // 256 color text and background - to->fg_color = finalcut::fc::SpringGreen3; - to->bg_color = finalcut::fc::NavyBlue; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::SpringGreen3; + to.bg_color = finalcut::fc::NavyBlue; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); // Bold on (with default colors) - to->fg_color = finalcut::fc::Default; - to->bg_color = finalcut::fc::Default; - to->attr.bit.bold = true; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::Default; + to.bg_color = finalcut::fc::Default; + to.attr.bit.bold = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;1m\017$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Bold off (with default colors) - to->attr.bit.bold = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.bold = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Dim on (with default colors) - to->attr.bit.dim = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.dim = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m\017$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Dim off (with default colors) - to->attr.bit.dim = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.dim = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Italic on (with default colors) - to->attr.bit.italic = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.italic = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m\017$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Italic off (with default colors) - to->attr.bit.italic = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.italic = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Underline on (with default colors) - to->attr.bit.underline = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.underline = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;4m\017$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Underline off (with default colors) - to->attr.bit.underline = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.underline = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Blink on (with default colors) - to->attr.bit.blink = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.blink = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;5m\017$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Blink off (with default colors) - to->attr.bit.blink = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.blink = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Reverse on (with default colors) - to->attr.bit.reverse = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.reverse = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;7m\017$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Reverse off (with default colors) - to->attr.bit.reverse = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.reverse = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Standout on (with default colors) - to->attr.bit.standout = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.standout = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;1;7m\017$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Standout off (with default colors) - to->attr.bit.standout = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.standout = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Invisible on (with default colors) - to->attr.bit.invisible = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.invisible = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m\017$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); - CPPUNIT_ASSERT ( to->encoded_char == ' ' ); + CPPUNIT_ASSERT ( from == to ); + CPPUNIT_ASSERT ( to.encoded_char == ' ' ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Invisible off (with default colors) - to->attr.bit.invisible = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.invisible = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Protect on (with default colors) - to->attr.bit.protect = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.protect = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m\017$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Protect off (with default colors) - to->attr.bit.protect = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.protect = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Crossed out on (with default colors) - to->attr.bit.crossed_out = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.crossed_out = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m\017$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Crossed out off (with default colors) - to->attr.bit.crossed_out = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.crossed_out = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Double underline on (with default colors) - to->attr.bit.dbl_underline = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.dbl_underline = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m\017$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Double underline off (with default colors) - to->attr.bit.dbl_underline = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.dbl_underline = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Alternate character set on (with default colors) - to->attr.bit.alt_charset = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.alt_charset = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m\016$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Alternate character set off (with default colors) - to->attr.bit.alt_charset = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.alt_charset = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , "\017" CSI "0m$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // PC character set on (with default colors) - to->attr.bit.pc_charset = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.pc_charset = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m\017$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // PC character set off (with default colors) - to->attr.bit.pc_charset = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.pc_charset = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Turn on all attributes (with default colors) - to->attr.bit.pc_charset = true; - to->attr.bit.bold = true; - to->attr.bit.dim = true; - to->attr.bit.italic = true; - to->attr.bit.underline = true; - to->attr.bit.blink = true; - to->attr.bit.reverse = true; - to->attr.bit.standout = true; - to->attr.bit.invisible = true; - to->attr.bit.protect = true; - to->attr.bit.crossed_out = true; - to->attr.bit.dbl_underline = true; - to->attr.bit.alt_charset = true; - to->attr.bit.pc_charset = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.pc_charset = true; + to.attr.bit.bold = true; + to.attr.bit.dim = true; + to.attr.bit.italic = true; + to.attr.bit.underline = true; + to.attr.bit.blink = true; + to.attr.bit.reverse = true; + to.attr.bit.standout = true; + to.attr.bit.invisible = true; + to.attr.bit.protect = true; + to.attr.bit.crossed_out = true; + to.attr.bit.dbl_underline = true; + to.attr.bit.alt_charset = true; + to.attr.bit.pc_charset = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;1;4;7;5m\016$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Cyan text on blue background - to->fg_color = finalcut::fc::Cyan; - to->bg_color = finalcut::fc::Blue; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::Cyan; + to.bg_color = finalcut::fc::Blue; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); // Bold off - to->attr.bit.bold = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.bold = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m$<2>\016" CSI "4m$<2>" CSI "5m$<2>" CSI "7m$<2>" CSI "7m$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Dim off - to->attr.bit.dim = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.dim = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m$<2>\016" CSI "4m$<2>" CSI "5m$<2>" CSI "7m$<2>" CSI "7m$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Italic off - to->attr.bit.italic = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.italic = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Underline off - to->attr.bit.underline = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.underline = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "m$<2>\016" CSI "5m$<2>" CSI "7m$<2>" CSI "7m$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Blink off - to->attr.bit.blink = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.blink = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m$<2>\016" CSI "7m$<2>" CSI "7m$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Reverse off - to->attr.bit.reverse = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.reverse = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m$<2>\016" CSI "7m$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Standout off - to->attr.bit.standout = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.standout = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "m$<2>\016" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Invisible off - to->attr.bit.invisible = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.invisible = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m$<2>\016" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Protect off - to->attr.bit.protect = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.protect = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m$<2>\016" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Crossed out off - to->attr.bit.crossed_out = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.crossed_out = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m$<2>\016" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Double underline off - to->attr.bit.dbl_underline = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.dbl_underline = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Alternate character set off - to->attr.bit.alt_charset = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.alt_charset = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "\017" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // PC character set off - to->attr.bit.pc_charset = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.pc_charset = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Green text color - to->fg_color = finalcut::fc::Green; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::Green; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Default text color - to->fg_color = finalcut::fc::Default; - CPPUNIT_ASSERT ( *from == *to ); + to.fg_color = finalcut::fc::Default; + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); - - delete to; - delete from; } //---------------------------------------------------------------------- @@ -1403,424 +1383,421 @@ void FOptiAttrTest::xtermTest() oa.set_orig_orig_colors (0); oa.initialize(); - finalcut::FChar* from = new finalcut::FChar(); - finalcut::FChar* to = new finalcut::FChar(); + finalcut::FChar from{}; + finalcut::FChar to{}; CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Default color + bold - from->fg_color = finalcut::fc::Default; - from->bg_color = finalcut::fc::Default; - to->attr.bit.bold = true; - to->fg_color = finalcut::fc::Default; - to->bg_color = finalcut::fc::Default; - CPPUNIT_ASSERT ( *from != *to ); + from.fg_color = finalcut::fc::Default; + from.bg_color = finalcut::fc::Default; + to.attr.bit.bold = true; + to.fg_color = finalcut::fc::Default; + to.bg_color = finalcut::fc::Default; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , ESC "(B" CSI "0;1m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Blue text on white background + dim + italic - to->fg_color = finalcut::fc::Blue; - to->bg_color = finalcut::fc::White; - to->attr.bit.dim = true; - to->attr.bit.italic = true; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::Blue; + to.bg_color = finalcut::fc::White; + to.attr.bit.dim = true; + to.attr.bit.italic = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , ESC "(B" CSI "0;1;2m" CSI "3m" CSI "34m" CSI "107m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Reset attributes + default background - to->attr.bit.bold = false; - to->attr.bit.dim = false; - to->attr.bit.italic = false; - to->bg_color = finalcut::fc::Default; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.bold = false; + to.attr.bit.dim = false; + to.attr.bit.italic = false; + to.bg_color = finalcut::fc::Default; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m" CSI "34m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Red text on black background - to->fg_color = finalcut::fc::Red; - to->bg_color = finalcut::fc::Black; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::Red; + to.bg_color = finalcut::fc::Black; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "31m" CSI "40m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // 256 color text and background - to->fg_color = finalcut::fc::SpringGreen3; - to->bg_color = finalcut::fc::NavyBlue; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::SpringGreen3; + to.bg_color = finalcut::fc::NavyBlue; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "38;5;42m" CSI "48;5;17m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Bold on (with default colors) - to->fg_color = finalcut::fc::Default; - to->bg_color = finalcut::fc::Default; - to->attr.bit.bold = true; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::Default; + to.bg_color = finalcut::fc::Default; + to.attr.bit.bold = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , ESC "(B" CSI "0;1m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Bold off (with default colors) - to->attr.bit.bold = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.bold = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Dim on (with default colors) - to->attr.bit.dim = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.dim = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , ESC "(B" CSI "0;2m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Dim off (with default colors) - to->attr.bit.dim = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.dim = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Italic on (with default colors) - to->attr.bit.italic = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.italic = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , ESC "(B" CSI "0m" CSI "3m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Italic off (with default colors) - to->attr.bit.italic = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.italic = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Underline on (with default colors) - to->attr.bit.underline = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.underline = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , ESC "(B" CSI "0;4m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Underline off (with default colors) - to->attr.bit.underline = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.underline = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Blink on (with default colors) - to->attr.bit.blink = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.blink = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , ESC "(B" CSI "0;5m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Blink off (with default colors) - to->attr.bit.blink = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.blink = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Reverse on (with default colors) - to->attr.bit.reverse = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.reverse = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , ESC "(B" CSI "0;7m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Reverse off (with default colors) - to->attr.bit.reverse = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.reverse = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Standout on (with default colors) - to->attr.bit.standout = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.standout = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , ESC "(B" CSI "0;7m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Standout off (with default colors) - to->attr.bit.standout = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.standout = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Invisible on (with default colors) - to->attr.bit.invisible = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.invisible = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , ESC "(B" CSI "0;8m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Invisible off (with default colors) - to->attr.bit.invisible = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.invisible = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Protect on (with default colors) - to->attr.bit.protect = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.protect = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , ESC "(B" CSI "0m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Protect off (with default colors) - to->attr.bit.protect = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.protect = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Crossed out on (with default colors) - to->attr.bit.crossed_out = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.crossed_out = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , ESC "(B" CSI "0m" CSI "9m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Crossed out off (with default colors) - to->attr.bit.crossed_out = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.crossed_out = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Double underline on (with default colors) - to->attr.bit.dbl_underline = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.dbl_underline = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , ESC "(B" CSI "0m" CSI "21m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Double underline off (with default colors) - to->attr.bit.dbl_underline = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.dbl_underline = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Alternate character set on (with default colors) - to->attr.bit.alt_charset = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.alt_charset = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , ESC "(0" CSI "0m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Alternate character set off (with default colors) - to->attr.bit.alt_charset = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.alt_charset = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , ESC "(B" CSI "0m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // PC character set on (with default colors) - to->attr.bit.pc_charset = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.pc_charset = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , ESC "(B" CSI "0m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // PC character set off (with default colors) - to->attr.bit.pc_charset = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.pc_charset = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Turn on all attributes (with default colors) - to->attr.bit.pc_charset = true; - to->attr.bit.bold = true; - to->attr.bit.dim = true; - to->attr.bit.italic = true; - to->attr.bit.underline = true; - to->attr.bit.blink = true; - to->attr.bit.reverse = true; - to->attr.bit.standout = true; - to->attr.bit.invisible = true; - to->attr.bit.protect = true; - to->attr.bit.crossed_out = true; - to->attr.bit.dbl_underline = true; - to->attr.bit.alt_charset = true; - to->attr.bit.pc_charset = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.pc_charset = true; + to.attr.bit.bold = true; + to.attr.bit.dim = true; + to.attr.bit.italic = true; + to.attr.bit.underline = true; + to.attr.bit.blink = true; + to.attr.bit.reverse = true; + to.attr.bit.standout = true; + to.attr.bit.invisible = true; + to.attr.bit.protect = true; + to.attr.bit.crossed_out = true; + to.attr.bit.dbl_underline = true; + to.attr.bit.alt_charset = true; + to.attr.bit.pc_charset = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , ESC "(0" CSI "0;1;2;4;7;5;8m" CSI "3m" CSI "9m" CSI "21m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Cyan text on blue background - to->fg_color = finalcut::fc::Cyan; - to->bg_color = finalcut::fc::Blue; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::Cyan; + to.bg_color = finalcut::fc::Blue; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "36m" CSI "44m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Bold off - to->attr.bit.bold = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.bold = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "22m" CSI "2m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Dim off - to->attr.bit.dim = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.dim = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "22m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Italic off - to->attr.bit.italic = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.italic = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "23m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Underline off - to->attr.bit.underline = false; + to.attr.bit.underline = false; CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "24m" CSI "21m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Blink off - to->attr.bit.blink = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.blink = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "25m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Reverse off - to->attr.bit.reverse = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.reverse = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "27m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Standout off - to->attr.bit.standout = false; + to.attr.bit.standout = false; CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "27m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Invisible off - to->attr.bit.invisible = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.invisible = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "28m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Protect off - to->attr.bit.protect = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.protect = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m" CSI "36m" CSI "44m" ESC "(0" CSI "9m" CSI "21m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Crossed out off - to->attr.bit.crossed_out = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.crossed_out = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "29m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Double underline off - to->attr.bit.dbl_underline = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.dbl_underline = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "24m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Alternate character set off - to->attr.bit.alt_charset = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.alt_charset = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , ESC "(B" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // PC character set off - to->attr.bit.pc_charset = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.pc_charset = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m" CSI "36m" CSI "44m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Green text color - to->fg_color = finalcut::fc::Green; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::Green; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), CSI "32m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Default text color - to->fg_color = finalcut::fc::Default; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::Default; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( printSequence(oa.changeAttribute(from, to)).c_str() , "Esc [ 3 9 m " ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); - - delete to; - delete from; } //---------------------------------------------------------------------- @@ -1875,424 +1852,421 @@ void FOptiAttrTest::rxvtTest() oa.set_orig_orig_colors (0); oa.initialize(); - finalcut::FChar* from = new finalcut::FChar(); - finalcut::FChar* to = new finalcut::FChar(); + finalcut::FChar from{}; + finalcut::FChar to{}; CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Default color + bold - from->fg_color = finalcut::fc::Default; - from->bg_color = finalcut::fc::Default; - to->attr.bit.bold = true; - to->fg_color = finalcut::fc::Default; - to->bg_color = finalcut::fc::Default; - CPPUNIT_ASSERT ( *from != *to ); + from.fg_color = finalcut::fc::Default; + from.bg_color = finalcut::fc::Default; + to.attr.bit.bold = true; + to.fg_color = finalcut::fc::Default; + to.bg_color = finalcut::fc::Default; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;1m\017" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Blue text on white background + dim + italic - to->fg_color = finalcut::fc::Blue; - to->bg_color = finalcut::fc::White; - to->attr.bit.dim = true; - to->attr.bit.italic = true; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::Blue; + to.bg_color = finalcut::fc::White; + to.attr.bit.dim = true; + to.attr.bit.italic = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;1m\017" CSI "34m" CSI "47m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Reset attributes + default background - to->attr.bit.bold = false; - to->attr.bit.dim = false; - to->attr.bit.italic = false; - to->bg_color = finalcut::fc::Default; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.bold = false; + to.attr.bit.dim = false; + to.attr.bit.italic = false; + to.bg_color = finalcut::fc::Default; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m" CSI "34m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Red text on black background - to->fg_color = finalcut::fc::Red; - to->bg_color = finalcut::fc::Black; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::Red; + to.bg_color = finalcut::fc::Black; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "31m" CSI "40m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // 256 color text and background - to->fg_color = finalcut::fc::SpringGreen3; - to->bg_color = finalcut::fc::NavyBlue; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::SpringGreen3; + to.bg_color = finalcut::fc::NavyBlue; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "32m" CSI "44m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Bold on (with default colors) - to->fg_color = finalcut::fc::Default; - to->bg_color = finalcut::fc::Default; - to->attr.bit.bold = true; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::Default; + to.bg_color = finalcut::fc::Default; + to.attr.bit.bold = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;1m\017" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Bold off (with default colors) - to->attr.bit.bold = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.bold = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Dim on (with default colors) - to->attr.bit.dim = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.dim = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m\017" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Dim off (with default colors) - to->attr.bit.dim = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.dim = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Italic on (with default colors) - to->attr.bit.italic = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.italic = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m\017" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Italic off (with default colors) - to->attr.bit.italic = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.italic = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Underline on (with default colors) - to->attr.bit.underline = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.underline = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;4m\017" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Underline off (with default colors) - to->attr.bit.underline = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.underline = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Blink on (with default colors) - to->attr.bit.blink = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.blink = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;5m\017" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Blink off (with default colors) - to->attr.bit.blink = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.blink = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Reverse on (with default colors) - to->attr.bit.reverse = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.reverse = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;7m\017" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Reverse off (with default colors) - to->attr.bit.reverse = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.reverse = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Standout on (with default colors) - to->attr.bit.standout = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.standout = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;7m\017" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Standout off (with default colors) - to->attr.bit.standout = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.standout = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Invisible on (with default colors) - to->attr.bit.invisible = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.invisible = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m\017" ); - CPPUNIT_ASSERT ( *from == *to ); - CPPUNIT_ASSERT ( to->encoded_char == ' ' ); + CPPUNIT_ASSERT ( from == to ); + CPPUNIT_ASSERT ( to.encoded_char == ' ' ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Invisible off (with default colors) - to->attr.bit.invisible = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.invisible = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Protect on (with default colors) - to->attr.bit.protect = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.protect = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m\017" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Protect off (with default colors) - to->attr.bit.protect = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.protect = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Crossed out on (with default colors) - to->attr.bit.crossed_out = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.crossed_out = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m\017" CSI "9m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Crossed out off (with default colors) - to->attr.bit.crossed_out = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.crossed_out = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Double underline on (with default colors) - to->attr.bit.dbl_underline = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.dbl_underline = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m\017" CSI "21m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Double underline off (with default colors) - to->attr.bit.dbl_underline = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.dbl_underline = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Alternate character set on (with default colors) - to->attr.bit.alt_charset = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.alt_charset = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m\016" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Alternate character set off (with default colors) - to->attr.bit.alt_charset = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.alt_charset = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , "\017" CSI "0m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // PC character set on (with default colors) - to->attr.bit.pc_charset = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.pc_charset = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m\017" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // PC character set off (with default colors) - to->attr.bit.pc_charset = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.pc_charset = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Turn on all attributes (with default colors) - to->attr.bit.pc_charset = true; - to->attr.bit.bold = true; - to->attr.bit.dim = true; - to->attr.bit.italic = true; - to->attr.bit.underline = true; - to->attr.bit.blink = true; - to->attr.bit.reverse = true; - to->attr.bit.standout = true; - to->attr.bit.invisible = true; - to->attr.bit.protect = true; - to->attr.bit.crossed_out = true; - to->attr.bit.dbl_underline = true; - to->attr.bit.alt_charset = true; - to->attr.bit.pc_charset = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.pc_charset = true; + to.attr.bit.bold = true; + to.attr.bit.dim = true; + to.attr.bit.italic = true; + to.attr.bit.underline = true; + to.attr.bit.blink = true; + to.attr.bit.reverse = true; + to.attr.bit.standout = true; + to.attr.bit.invisible = true; + to.attr.bit.protect = true; + to.attr.bit.crossed_out = true; + to.attr.bit.dbl_underline = true; + to.attr.bit.alt_charset = true; + to.attr.bit.pc_charset = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;1;4;7;5m\016" CSI "9m" CSI "21m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Cyan text on blue background - to->fg_color = finalcut::fc::Cyan; - to->bg_color = finalcut::fc::Blue; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::Cyan; + to.bg_color = finalcut::fc::Blue; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "36m" CSI "44m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Bold off - to->attr.bit.bold = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.bold = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "22m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Dim off - to->attr.bit.dim = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.dim = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "22m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Italic off - to->attr.bit.italic = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.italic = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , "" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Underline off - to->attr.bit.underline = false; + to.attr.bit.underline = false; CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "24m" CSI "21m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Blink off - to->attr.bit.blink = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.blink = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "25m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Reverse off - to->attr.bit.reverse = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.reverse = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "27m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Standout off - to->attr.bit.standout = false; + to.attr.bit.standout = false; CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "27m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Invisible off - to->attr.bit.invisible = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.invisible = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "28m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Protect off - to->attr.bit.protect = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.protect = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m" CSI "36m" CSI "44m\016" CSI "9m" CSI "21m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Crossed out off - to->attr.bit.crossed_out = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.crossed_out = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "29m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Double underline off - to->attr.bit.dbl_underline = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.dbl_underline = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "24m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Alternate character set off - to->attr.bit.alt_charset = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.alt_charset = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , "\017" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // PC character set off - to->attr.bit.pc_charset = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.pc_charset = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m" CSI "36m" CSI "44m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Green text color - to->fg_color = finalcut::fc::Green; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::Green; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), CSI "32m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Default text color - to->fg_color = finalcut::fc::Default; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::Default; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( printSequence(oa.changeAttribute(from, to)).c_str() , "Esc [ 3 9 m " ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); - - delete to; - delete from; } //---------------------------------------------------------------------- @@ -2348,418 +2322,415 @@ void FOptiAttrTest::linuxTest() oa.set_orig_orig_colors (OSC "R"); oa.initialize(); - finalcut::FChar* from = new finalcut::FChar(); - finalcut::FChar* to = new finalcut::FChar(); + finalcut::FChar from{}; + finalcut::FChar to{}; CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Default color + bold - from->fg_color = finalcut::fc::Default; - from->bg_color = finalcut::fc::Default; - to->attr.bit.bold = true; - to->fg_color = finalcut::fc::Default; - to->bg_color = finalcut::fc::Default; - CPPUNIT_ASSERT ( *from != *to ); + from.fg_color = finalcut::fc::Default; + from.bg_color = finalcut::fc::Default; + to.attr.bit.bold = true; + to.fg_color = finalcut::fc::Default; + to.bg_color = finalcut::fc::Default; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;1m\017" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Blue text on white background + dim + italic - to->fg_color = finalcut::fc::Blue; - to->bg_color = finalcut::fc::White; - to->attr.bit.dim = true; - to->attr.bit.italic = true; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::Blue; + to.bg_color = finalcut::fc::White; + to.attr.bit.dim = true; + to.attr.bit.italic = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;1m\017" CSI "34;22m" CSI "47;5m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Reset attributes + default background - to->attr.bit.bold = false; - to->attr.bit.dim = false; - to->attr.bit.italic = false; - to->bg_color = finalcut::fc::Default; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.bold = false; + to.attr.bit.dim = false; + to.attr.bit.italic = false; + to.bg_color = finalcut::fc::Default; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m\017" CSI "34;22m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Red text on black background - to->fg_color = finalcut::fc::Red; - to->bg_color = finalcut::fc::Black; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::Red; + to.bg_color = finalcut::fc::Black; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "31;22m" CSI "40;25m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // 256 color text and background - to->fg_color = finalcut::fc::SpringGreen3; - to->bg_color = finalcut::fc::NavyBlue; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::SpringGreen3; + to.bg_color = finalcut::fc::NavyBlue; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "32;1m" CSI "44;25m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Bold on (with default colors) - to->fg_color = finalcut::fc::Default; - to->bg_color = finalcut::fc::Default; - to->attr.bit.bold = true; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::Default; + to.bg_color = finalcut::fc::Default; + to.attr.bit.bold = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;1m\017" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Bold off (with default colors) - to->attr.bit.bold = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.bold = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m\017" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Dim on (with default colors) - to->attr.bit.dim = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.dim = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m\017" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Dim off (with default colors) - to->attr.bit.dim = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.dim = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m\017" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Italic on (with default colors) - to->attr.bit.italic = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.italic = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m\017" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Italic off (with default colors) - to->attr.bit.italic = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.italic = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m\017" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Underline on (with default colors) - to->attr.bit.underline = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.underline = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m\017" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Underline off (with default colors) - to->attr.bit.underline = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.underline = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m\017" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Blink on (with default colors) - to->attr.bit.blink = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.blink = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;5m\017" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Blink off (with default colors) - to->attr.bit.blink = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.blink = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m\017" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Reverse on (with default colors) - to->attr.bit.reverse = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.reverse = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;7m\017" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Reverse off (with default colors) - to->attr.bit.reverse = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.reverse = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m\017" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Standout on (with default colors) - to->attr.bit.standout = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.standout = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;7m\017" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Standout off (with default colors) - to->attr.bit.standout = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.standout = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m\017" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Invisible on (with default colors) - to->attr.bit.invisible = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.invisible = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m\017" ); - CPPUNIT_ASSERT ( *from == *to ); - CPPUNIT_ASSERT ( to->encoded_char == ' ' ); + CPPUNIT_ASSERT ( from == to ); + CPPUNIT_ASSERT ( to.encoded_char == ' ' ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Invisible off (with default colors) - to->attr.bit.invisible = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.invisible = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m\17" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Protect on (with default colors) - to->attr.bit.protect = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.protect = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m\017" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Protect off (with default colors) - to->attr.bit.protect = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.protect = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m\017" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Crossed out on (with default colors) - to->attr.bit.crossed_out = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.crossed_out = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m\017" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Crossed out off (with default colors) - to->attr.bit.crossed_out = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.crossed_out = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m\017" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Double underline on (with default colors) - to->attr.bit.dbl_underline = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.dbl_underline = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m\017" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Double underline off (with default colors) - to->attr.bit.dbl_underline = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.dbl_underline = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m\017" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Alternate character set on (with default colors) - to->attr.bit.alt_charset = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.alt_charset = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m\016" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Alternate character set off (with default colors) - to->attr.bit.alt_charset = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.alt_charset = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , "\017" CSI "0m\017" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // PC character set on (with default colors) - to->attr.bit.pc_charset = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.pc_charset = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m\017" CSI "11m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // PC character set off (with default colors) - to->attr.bit.pc_charset = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.pc_charset = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m\017" CSI "10m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Turn on all attributes (with default colors) - to->attr.bit.pc_charset = true; - to->attr.bit.bold = true; - to->attr.bit.dim = true; - to->attr.bit.italic = true; - to->attr.bit.underline = true; - to->attr.bit.blink = true; - to->attr.bit.reverse = true; - to->attr.bit.standout = true; - to->attr.bit.invisible = true; - to->attr.bit.protect = true; - to->attr.bit.crossed_out = true; - to->attr.bit.dbl_underline = true; - to->attr.bit.alt_charset = true; - to->attr.bit.pc_charset = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.pc_charset = true; + to.attr.bit.bold = true; + to.attr.bit.dim = true; + to.attr.bit.italic = true; + to.attr.bit.underline = true; + to.attr.bit.blink = true; + to.attr.bit.reverse = true; + to.attr.bit.standout = true; + to.attr.bit.invisible = true; + to.attr.bit.protect = true; + to.attr.bit.crossed_out = true; + to.attr.bit.dbl_underline = true; + to.attr.bit.alt_charset = true; + to.attr.bit.pc_charset = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;1;7;5m\016" CSI "11m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Cyan text on blue background - to->fg_color = finalcut::fc::Cyan; - to->bg_color = finalcut::fc::Blue; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::Cyan; + to.bg_color = finalcut::fc::Blue; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "36;22m" CSI "44;25m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Bold off - to->attr.bit.bold = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.bold = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "22m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Dim off - to->attr.bit.dim = false; - CPPUNIT_ASSERT ( *from == *to ); + to.attr.bit.dim = false; + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Italic off - to->attr.bit.italic = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.italic = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , "" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Underline off - to->attr.bit.underline = false; - CPPUNIT_ASSERT ( *from == *to ); + to.attr.bit.underline = false; + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Blink off - to->attr.bit.blink = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.blink = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "25m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Reverse off - to->attr.bit.reverse = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.reverse = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "27m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Standout off - to->attr.bit.standout = false; + to.attr.bit.standout = false; CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "27m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Invisible off - to->attr.bit.invisible = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.invisible = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , "" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Protect off - to->attr.bit.protect = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.protect = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , "" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Crossed out off - to->attr.bit.crossed_out = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.crossed_out = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , "" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Double underline off - to->attr.bit.dbl_underline = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.dbl_underline = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , "" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Alternate character set off - to->attr.bit.alt_charset = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.alt_charset = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , "\017" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // PC character set off - to->attr.bit.pc_charset = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.pc_charset = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m\017" CSI "10m" CSI "36;22m" CSI "44;25m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Green text color - to->fg_color = finalcut::fc::Green; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::Green; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), CSI "32;22m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Default text color - to->fg_color = finalcut::fc::Default; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::Default; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( printSequence(oa.changeAttribute(from, to)).c_str() , "Esc [ 3 9 m " ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); - - delete to; - delete from; } //---------------------------------------------------------------------- @@ -2832,424 +2803,421 @@ void FOptiAttrTest::puttyTest() oa.initialize(); - finalcut::FChar* from = new finalcut::FChar(); - finalcut::FChar* to = new finalcut::FChar(); + finalcut::FChar from{}; + finalcut::FChar to{}; CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Default color + bold - from->fg_color = finalcut::fc::Default; - from->bg_color = finalcut::fc::Default; - to->attr.bit.bold = true; - to->fg_color = finalcut::fc::Default; - to->bg_color = finalcut::fc::Default; - CPPUNIT_ASSERT ( *from != *to ); + from.fg_color = finalcut::fc::Default; + from.bg_color = finalcut::fc::Default; + to.attr.bit.bold = true; + to.fg_color = finalcut::fc::Default; + to.bg_color = finalcut::fc::Default; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;1m\017" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Blue text on white background + dim + italic - to->fg_color = finalcut::fc::Blue; - to->bg_color = finalcut::fc::White; - to->attr.bit.dim = true; - to->attr.bit.italic = true; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::Blue; + to.bg_color = finalcut::fc::White; + to.attr.bit.dim = true; + to.attr.bit.italic = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;1;2m\017" CSI "34m" CSI "107m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Reset attributes + default background - to->attr.bit.bold = false; - to->attr.bit.dim = false; - to->attr.bit.italic = false; - to->bg_color = finalcut::fc::Default; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.bold = false; + to.attr.bit.dim = false; + to.attr.bit.italic = false; + to.bg_color = finalcut::fc::Default; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m" CSI "39;49m" CSI "34m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Red text on black background - to->fg_color = finalcut::fc::Red; - to->bg_color = finalcut::fc::Black; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::Red; + to.bg_color = finalcut::fc::Black; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "31m" CSI "40m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // 256 color text and background - to->fg_color = finalcut::fc::SpringGreen3; - to->bg_color = finalcut::fc::NavyBlue; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::SpringGreen3; + to.bg_color = finalcut::fc::NavyBlue; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "38;5;42m" CSI "48;5;17m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Bold on (with default colors) - to->fg_color = finalcut::fc::Default; - to->bg_color = finalcut::fc::Default; - to->attr.bit.bold = true; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::Default; + to.bg_color = finalcut::fc::Default; + to.attr.bit.bold = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;1m\017" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Bold off (with default colors) - to->attr.bit.bold = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.bold = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Dim on (with default colors) - to->attr.bit.dim = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.dim = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;2m\017" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Dim off (with default colors) - to->attr.bit.dim = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.dim = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Italic on (with default colors) - to->attr.bit.italic = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.italic = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m\017" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Italic off (with default colors) - to->attr.bit.italic = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.italic = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Underline on (with default colors) - to->attr.bit.underline = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.underline = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;4m\017" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Underline off (with default colors) - to->attr.bit.underline = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.underline = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Blink on (with default colors) - to->attr.bit.blink = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.blink = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;5m\017" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Blink off (with default colors) - to->attr.bit.blink = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.blink = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Reverse on (with default colors) - to->attr.bit.reverse = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.reverse = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;7m\017" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Reverse off (with default colors) - to->attr.bit.reverse = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.reverse = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Standout on (with default colors) - to->attr.bit.standout = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.standout = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;1;7m\017" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Standout off (with default colors) - to->attr.bit.standout = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.standout = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Invisible on (with default colors) - to->attr.bit.invisible = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.invisible = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m\017" ); - CPPUNIT_ASSERT ( *from == *to ); - CPPUNIT_ASSERT ( to->encoded_char == ' ' ); + CPPUNIT_ASSERT ( from == to ); + CPPUNIT_ASSERT ( to.encoded_char == ' ' ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Invisible off (with default colors) - to->attr.bit.invisible = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.invisible = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Protect on (with default colors) - to->attr.bit.protect = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.protect = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m\017" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Protect off (with default colors) - to->attr.bit.protect = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.protect = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Crossed out on (with default colors) - to->attr.bit.crossed_out = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.crossed_out = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m\017" CSI "9m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Crossed out off (with default colors) - to->attr.bit.crossed_out = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.crossed_out = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Double underline on (with default colors) - to->attr.bit.dbl_underline = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.dbl_underline = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m\017" CSI "21m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Double underline off (with default colors) - to->attr.bit.dbl_underline = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.dbl_underline = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Alternate character set on (with default colors) - to->attr.bit.alt_charset = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.alt_charset = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m\016" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Alternate character set off (with default colors) - to->attr.bit.alt_charset = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.alt_charset = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , "\017" CSI "0m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // PC character set on (with default colors) - to->attr.bit.pc_charset = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.pc_charset = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m\017" CSI "11m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // PC character set off (with default colors) - to->attr.bit.pc_charset = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.pc_charset = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m" CSI "10m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Turn on all attributes (with default colors) - to->attr.bit.pc_charset = true; - to->attr.bit.bold = true; - to->attr.bit.dim = true; - to->attr.bit.italic = true; - to->attr.bit.underline = true; - to->attr.bit.blink = true; - to->attr.bit.reverse = true; - to->attr.bit.standout = true; - to->attr.bit.invisible = true; - to->attr.bit.protect = true; - to->attr.bit.crossed_out = true; - to->attr.bit.dbl_underline = true; - to->attr.bit.alt_charset = true; - to->attr.bit.pc_charset = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.pc_charset = true; + to.attr.bit.bold = true; + to.attr.bit.dim = true; + to.attr.bit.italic = true; + to.attr.bit.underline = true; + to.attr.bit.blink = true; + to.attr.bit.reverse = true; + to.attr.bit.standout = true; + to.attr.bit.invisible = true; + to.attr.bit.protect = true; + to.attr.bit.crossed_out = true; + to.attr.bit.dbl_underline = true; + to.attr.bit.alt_charset = true; + to.attr.bit.pc_charset = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;1;2;4;7;5m\016" CSI "9m" CSI "21m" CSI "11m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Cyan text on blue background - to->fg_color = finalcut::fc::Cyan; - to->bg_color = finalcut::fc::Blue; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::Cyan; + to.bg_color = finalcut::fc::Blue; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "36m" CSI "44m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Bold off - to->attr.bit.bold = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.bold = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "22m" CSI "2m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Dim off - to->attr.bit.dim = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.dim = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "22m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Italic off - to->attr.bit.italic = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.italic = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Underline off - to->attr.bit.underline = false; + to.attr.bit.underline = false; CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "24m" CSI "21m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Blink off - to->attr.bit.blink = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.blink = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "25m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Reverse off - to->attr.bit.reverse = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.reverse = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "27m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Standout off - to->attr.bit.standout = false; + to.attr.bit.standout = false; CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "27m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Invisible off - to->attr.bit.invisible = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.invisible = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "28m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Protect off - to->attr.bit.protect = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.protect = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m" CSI "36m" CSI "44m" "\016" CSI "11m" CSI "9m" CSI "21m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Crossed out off - to->attr.bit.crossed_out = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.crossed_out = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "29m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Double underline off - to->attr.bit.dbl_underline = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.dbl_underline = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "24m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Alternate character set off - to->attr.bit.alt_charset = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.alt_charset = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , "\017" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // PC character set off - to->attr.bit.pc_charset = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.pc_charset = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m" CSI "10m" CSI "36m" CSI "44m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Green text color - to->fg_color = finalcut::fc::Green; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::Green; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), CSI "32m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Default text color - to->fg_color = finalcut::fc::Default; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::Default; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( printSequence(oa.changeAttribute(from, to)).c_str() , "Esc [ 3 9 ; 4 9 m Esc [ 4 4 m " ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); - - delete to; - delete from; } //---------------------------------------------------------------------- @@ -3305,416 +3273,413 @@ void FOptiAttrTest::teratermTest() oa.initialize(); - finalcut::FChar* from = new finalcut::FChar(); - finalcut::FChar* to = new finalcut::FChar(); + finalcut::FChar from{}; + finalcut::FChar to{}; CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Default color + bold - from->fg_color = finalcut::fc::Default; - from->bg_color = finalcut::fc::Default; - to->attr.bit.bold = true; - to->fg_color = finalcut::fc::Default; - to->bg_color = finalcut::fc::Default; - CPPUNIT_ASSERT ( *from != *to ); + from.fg_color = finalcut::fc::Default; + from.bg_color = finalcut::fc::Default; + to.attr.bit.bold = true; + to.fg_color = finalcut::fc::Default; + to.bg_color = finalcut::fc::Default; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;1m\017$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Blue text on white background + dim + italic - to->fg_color = finalcut::fc::Blue; - to->bg_color = finalcut::fc::White; - to->attr.bit.dim = true; - to->attr.bit.italic = true; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::Blue; + to.bg_color = finalcut::fc::White; + to.attr.bit.dim = true; + to.attr.bit.italic = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m\017$<2>" CSI "38;5;4m" CSI "48;5;15m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Reset attributes + default background - to->attr.bit.bold = false; - to->attr.bit.dim = false; - to->attr.bit.italic = false; - to->bg_color = finalcut::fc::Default; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.bold = false; + to.attr.bit.dim = false; + to.attr.bit.italic = false; + to.bg_color = finalcut::fc::Default; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m$<2>" CSI "39;49m" CSI "38;5;4m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Red text on black background - to->fg_color = finalcut::fc::Red; - to->bg_color = finalcut::fc::Black; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::Red; + to.bg_color = finalcut::fc::Black; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "38;5;1m" CSI "48;5;0m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // 256 color text and background - to->fg_color = finalcut::fc::SpringGreen3; - to->bg_color = finalcut::fc::NavyBlue; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::SpringGreen3; + to.bg_color = finalcut::fc::NavyBlue; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "38;5;10m" CSI "48;5;4m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Bold on (with default colors) - to->fg_color = finalcut::fc::Default; - to->bg_color = finalcut::fc::Default; - to->attr.bit.bold = true; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::Default; + to.bg_color = finalcut::fc::Default; + to.attr.bit.bold = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;1m\017$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Bold off (with default colors) - to->attr.bit.bold = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.bold = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Dim on (with default colors) - to->attr.bit.dim = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.dim = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m\017$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Dim off (with default colors) - to->attr.bit.dim = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.dim = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Italic on (with default colors) - to->attr.bit.italic = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.italic = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m\017$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Italic off (with default colors) - to->attr.bit.italic = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.italic = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Underline on (with default colors) - to->attr.bit.underline = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.underline = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;4m\017$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Underline off (with default colors) - to->attr.bit.underline = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.underline = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Blink on (with default colors) - to->attr.bit.blink = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.blink = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;5m\017$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Blink off (with default colors) - to->attr.bit.blink = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.blink = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Reverse on (with default colors) - to->attr.bit.reverse = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.reverse = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;7m\017$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Reverse off (with default colors) - to->attr.bit.reverse = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.reverse = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Standout on (with default colors) - to->attr.bit.standout = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.standout = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;1;7m\017$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Standout off (with default colors) - to->attr.bit.standout = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.standout = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Invisible on (with default colors) - to->attr.bit.invisible = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.invisible = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m\017$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); - CPPUNIT_ASSERT ( to->encoded_char == ' ' ); + CPPUNIT_ASSERT ( from == to ); + CPPUNIT_ASSERT ( to.encoded_char == ' ' ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Invisible off (with default colors) - to->attr.bit.invisible = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.invisible = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Protect on (with default colors) - to->attr.bit.protect = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.protect = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m\017$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Protect off (with default colors) - to->attr.bit.protect = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.protect = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Crossed out on (with default colors) - to->attr.bit.crossed_out = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.crossed_out = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m\017$<2>" CSI "9m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Crossed out off (with default colors) - to->attr.bit.crossed_out = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.crossed_out = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Double underline on (with default colors) - to->attr.bit.dbl_underline = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.dbl_underline = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m\017$<2>" CSI "21m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Double underline off (with default colors) - to->attr.bit.dbl_underline = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.dbl_underline = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Alternate character set on (with default colors) - to->attr.bit.alt_charset = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.alt_charset = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m\016$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Alternate character set off (with default colors) - to->attr.bit.alt_charset = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.alt_charset = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , "\017" CSI "0m$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // PC character set on (with default colors) - to->attr.bit.pc_charset = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.pc_charset = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m\017$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // PC character set off (with default colors) - to->attr.bit.pc_charset = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.pc_charset = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m$<2>" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Turn on all attributes (with default colors) - to->attr.bit.pc_charset = true; - to->attr.bit.bold = true; - to->attr.bit.dim = true; - to->attr.bit.italic = true; - to->attr.bit.underline = true; - to->attr.bit.blink = true; - to->attr.bit.reverse = true; - to->attr.bit.standout = true; - to->attr.bit.invisible = true; - to->attr.bit.protect = true; - to->attr.bit.crossed_out = true; - to->attr.bit.dbl_underline = true; - to->attr.bit.alt_charset = true; - to->attr.bit.pc_charset = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.pc_charset = true; + to.attr.bit.bold = true; + to.attr.bit.dim = true; + to.attr.bit.italic = true; + to.attr.bit.underline = true; + to.attr.bit.blink = true; + to.attr.bit.reverse = true; + to.attr.bit.standout = true; + to.attr.bit.invisible = true; + to.attr.bit.protect = true; + to.attr.bit.crossed_out = true; + to.attr.bit.dbl_underline = true; + to.attr.bit.alt_charset = true; + to.attr.bit.pc_charset = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0;1;4;7;5m\016$<2>" CSI "9m" CSI "21m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Cyan text on blue background - to->fg_color = finalcut::fc::Cyan; - to->bg_color = finalcut::fc::Blue; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::Cyan; + to.bg_color = finalcut::fc::Blue; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "38;5;6m" CSI "48;5;4m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Bold off - to->attr.bit.bold = false; - CPPUNIT_ASSERT ( *from == *to ); // because of noColorVideo = 41 + to.attr.bit.bold = false; + CPPUNIT_ASSERT ( from == to ); // because of noColorVideo = 41 CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Dim off - to->attr.bit.dim = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.dim = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "22m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Italic off - to->attr.bit.italic = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.italic = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Underline off - to->attr.bit.underline = false; + to.attr.bit.underline = false; CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "24m" CSI "21m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Blink off - to->attr.bit.blink = false; - CPPUNIT_ASSERT ( *from == *to ); // because of noColorVideo = 41 + to.attr.bit.blink = false; + CPPUNIT_ASSERT ( from == to ); // because of noColorVideo = 41 CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Reverse off - to->attr.bit.reverse = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.reverse = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "27m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Standout off - to->attr.bit.standout = false; - CPPUNIT_ASSERT ( *from == *to ); // because of noColorVideo = 41 + to.attr.bit.standout = false; + CPPUNIT_ASSERT ( from == to ); // because of noColorVideo = 41 CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Invisible off - to->attr.bit.invisible = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.invisible = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "28m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Protect off - to->attr.bit.protect = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.protect = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m$<2>" CSI "38;5;6m" CSI "48;5;4m" "\016" CSI "9m" CSI "21m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Crossed out off - to->attr.bit.crossed_out = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.crossed_out = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "29m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Double underline off - to->attr.bit.dbl_underline = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.dbl_underline = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "24m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Alternate character set off - to->attr.bit.alt_charset = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.alt_charset = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , "\017" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // PC character set off - to->attr.bit.pc_charset = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.pc_charset = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "0m$<2>" CSI "38;5;6m" CSI "48;5;4m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Green text color - to->fg_color = finalcut::fc::Green; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::Green; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), CSI "38;5;2m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Default text color - to->fg_color = finalcut::fc::Default; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::Default; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( printSequence(oa.changeAttribute(from, to)).c_str() , "Esc [ 3 9 ; 4 9 m Esc [ 4 8 ; 5 ; 4 m " ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); - - delete to; - delete from; } //---------------------------------------------------------------------- @@ -3779,381 +3744,378 @@ void FOptiAttrTest::ibmColorTest() oa.initialize(); - finalcut::FChar* from = new finalcut::FChar(); - finalcut::FChar* to = new finalcut::FChar(); + finalcut::FChar from{}; + finalcut::FChar to{}; CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Default color + bold - from->fg_color = finalcut::fc::Default; - from->bg_color = finalcut::fc::Default; - to->attr.bit.bold = true; - to->fg_color = finalcut::fc::Default; - to->bg_color = finalcut::fc::Default; - CPPUNIT_ASSERT ( *from != *to ); + from.fg_color = finalcut::fc::Default; + from.bg_color = finalcut::fc::Default; + to.attr.bit.bold = true; + to.fg_color = finalcut::fc::Default; + to.bg_color = finalcut::fc::Default; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Blue text on white background + dim + italic - to->fg_color = finalcut::fc::Blue; - to->bg_color = finalcut::fc::White; - to->attr.bit.dim = true; - to->attr.bit.italic = true; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::Blue; + to.bg_color = finalcut::fc::White; + to.attr.bit.dim = true; + to.attr.bit.italic = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "31m" CSI "107m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Reset attributes + default background - to->attr.bit.bold = false; - to->attr.bit.dim = false; - to->attr.bit.italic = false; - to->bg_color = finalcut::fc::Default; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.bold = false; + to.attr.bit.dim = false; + to.attr.bit.italic = false; + to.bg_color = finalcut::fc::Default; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "32;40m" CSI "31m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Red text on black background - to->fg_color = finalcut::fc::Red; - to->bg_color = finalcut::fc::Black; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::Red; + to.bg_color = finalcut::fc::Black; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "34m" CSI "40m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // 256 color text and background - to->fg_color = finalcut::fc::SpringGreen3; - to->bg_color = finalcut::fc::NavyBlue; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::SpringGreen3; + to.bg_color = finalcut::fc::NavyBlue; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "32m" CSI "41m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Bold on (with default colors) - to->fg_color = finalcut::fc::Default; - to->bg_color = finalcut::fc::Default; - to->attr.bit.bold = true; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::Default; + to.bg_color = finalcut::fc::Default; + to.attr.bit.bold = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "32;40m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Bold off (with default colors) - to->attr.bit.bold = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.bold = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Dim on (with default colors) - to->attr.bit.dim = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.dim = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Dim off (with default colors) - to->attr.bit.dim = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.dim = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Italic on (with default colors) - to->attr.bit.italic = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.italic = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Italic off (with default colors) - to->attr.bit.italic = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.italic = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Underline on (with default colors) - to->attr.bit.underline = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.underline = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Underline off (with default colors) - to->attr.bit.underline = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.underline = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Blink on (with default colors) - to->attr.bit.blink = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.blink = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Blink off (with default colors) - to->attr.bit.blink = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.blink = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Reverse on (with default colors) - to->attr.bit.reverse = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.reverse = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Reverse off (with default colors) - to->attr.bit.reverse = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.reverse = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Standout on (with default colors) - to->attr.bit.standout = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.standout = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Standout off (with default colors) - to->attr.bit.standout = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.standout = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Invisible on (with default colors) - to->attr.bit.invisible = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.invisible = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); - CPPUNIT_ASSERT ( *from == *to ); - CPPUNIT_ASSERT ( to->encoded_char == ' ' ); + CPPUNIT_ASSERT ( from == to ); + CPPUNIT_ASSERT ( to.encoded_char == ' ' ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Invisible off (with default colors) - to->attr.bit.invisible = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.invisible = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Protect on (with default colors) - to->attr.bit.protect = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.protect = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Protect off (with default colors) - to->attr.bit.protect = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.protect = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Crossed out on (with default colors) - to->attr.bit.crossed_out = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.crossed_out = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Crossed out off (with default colors) - to->attr.bit.crossed_out = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.crossed_out = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Double underline on (with default colors) - to->attr.bit.dbl_underline = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.dbl_underline = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Double underline off (with default colors) - to->attr.bit.dbl_underline = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.dbl_underline = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Alternate character set on (with default colors) - to->attr.bit.alt_charset = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.alt_charset = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Alternate character set off (with default colors) - to->attr.bit.alt_charset = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.alt_charset = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // PC character set on (with default colors) - to->attr.bit.pc_charset = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.pc_charset = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // PC character set off (with default colors) - to->attr.bit.pc_charset = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.pc_charset = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Turn on all attributes (with default colors) - to->attr.bit.pc_charset = true; - to->attr.bit.bold = true; - to->attr.bit.dim = true; - to->attr.bit.italic = true; - to->attr.bit.underline = true; - to->attr.bit.blink = true; - to->attr.bit.reverse = true; - to->attr.bit.standout = true; - to->attr.bit.invisible = true; - to->attr.bit.protect = true; - to->attr.bit.crossed_out = true; - to->attr.bit.dbl_underline = true; - to->attr.bit.alt_charset = true; - to->attr.bit.pc_charset = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.pc_charset = true; + to.attr.bit.bold = true; + to.attr.bit.dim = true; + to.attr.bit.italic = true; + to.attr.bit.underline = true; + to.attr.bit.blink = true; + to.attr.bit.reverse = true; + to.attr.bit.standout = true; + to.attr.bit.invisible = true; + to.attr.bit.protect = true; + to.attr.bit.crossed_out = true; + to.attr.bit.dbl_underline = true; + to.attr.bit.alt_charset = true; + to.attr.bit.pc_charset = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Cyan text on blue background - to->fg_color = finalcut::fc::Cyan; - to->bg_color = finalcut::fc::Blue; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::Cyan; + to.bg_color = finalcut::fc::Blue; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "33m" CSI "41m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Bold off - to->attr.bit.bold = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.bold = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Dim off - to->attr.bit.dim = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.dim = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Italic off - to->attr.bit.italic = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.italic = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Underline off - to->attr.bit.underline = false; - CPPUNIT_ASSERT ( *from == *to ); // because of noColorVideo = 3 + to.attr.bit.underline = false; + CPPUNIT_ASSERT ( from == to ); // because of noColorVideo = 3 CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Blink off - to->attr.bit.blink = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.blink = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Reverse off - to->attr.bit.reverse = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.reverse = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Standout off - to->attr.bit.standout = false; - CPPUNIT_ASSERT ( *from == *to ); // because of noColorVideo = 3 + to.attr.bit.standout = false; + CPPUNIT_ASSERT ( from == to ); // because of noColorVideo = 3 CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Invisible off - to->attr.bit.invisible = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.invisible = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Protect off - to->attr.bit.protect = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.protect = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Crossed out off - to->attr.bit.crossed_out = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.crossed_out = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Double underline off - to->attr.bit.dbl_underline = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.dbl_underline = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Alternate character set off - to->attr.bit.alt_charset = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.alt_charset = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // PC character set off - to->attr.bit.pc_charset = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.pc_charset = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Green text color - to->fg_color = finalcut::fc::Green; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::Green; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , CSI "32m" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Default text color - to->fg_color = finalcut::fc::Default; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::Default; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( printSequence(oa.changeAttribute(from, to)).c_str() , "Esc [ 3 2 ; 4 0 m Esc [ 4 1 m " ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); - - delete to; - delete from; } //---------------------------------------------------------------------- @@ -4221,427 +4183,424 @@ void FOptiAttrTest::wyse50Test() oa.setTermEnvironment(optiattr_env); - finalcut::FChar* from = new finalcut::FChar(); - finalcut::FChar* to = new finalcut::FChar(); + finalcut::FChar from{}; + finalcut::FChar to{}; CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Default color + bold - from->fg_color = finalcut::fc::Default; - from->bg_color = finalcut::fc::Default; - to->attr.bit.bold = true; - to->fg_color = finalcut::fc::Default; - to->bg_color = finalcut::fc::Default; - CPPUNIT_ASSERT ( *from != *to ); + from.fg_color = finalcut::fc::Default; + from.bg_color = finalcut::fc::Default; + to.attr.bit.bold = true; + to.fg_color = finalcut::fc::Default; + to.bg_color = finalcut::fc::Default; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , ESC "(" ESC "cD" ESC "G4" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Blue text on white background + dim + italic - to->fg_color = finalcut::fc::Blue; - to->bg_color = finalcut::fc::White; - to->attr.bit.dim = true; - to->attr.bit.italic = true; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::Blue; + to.bg_color = finalcut::fc::White; + to.attr.bit.dim = true; + to.attr.bit.italic = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , ESC "(" ESC "cD" ESC "Gt" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Reset attributes + default background - to->attr.bit.bold = false; - to->attr.bit.dim = false; - to->attr.bit.italic = false; - to->bg_color = finalcut::fc::Default; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.bold = false; + to.attr.bit.dim = false; + to.attr.bit.italic = false; + to.bg_color = finalcut::fc::Default; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , ESC "(" ESC "H\003" ESC "G0" ESC "cD" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Red text on black background - to->fg_color = finalcut::fc::Red; - to->bg_color = finalcut::fc::Black; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::Red; + to.bg_color = finalcut::fc::Black; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // 256 color text and background - to->fg_color = finalcut::fc::SpringGreen3; - to->bg_color = finalcut::fc::NavyBlue; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::SpringGreen3; + to.bg_color = finalcut::fc::NavyBlue; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Bold on (with default colors) - to->fg_color = finalcut::fc::Default; - to->bg_color = finalcut::fc::Default; - to->attr.bit.bold = true; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::Default; + to.bg_color = finalcut::fc::Default; + to.attr.bit.bold = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , ESC "(" ESC "cD" ESC "G4" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Bold off (with default colors) - to->attr.bit.bold = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.bold = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , ESC "(" ESC "H\003" ESC "G0" ESC "cD" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Dim on (with default colors) - to->attr.bit.dim = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.dim = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , ESC "(" ESC "cD" ESC "Gp" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Dim off (with default colors) - to->attr.bit.dim = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.dim = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , ESC "(" ESC "H\003" ESC "G0" ESC "cD" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Italic on (with default colors) - to->attr.bit.italic = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.italic = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , ESC "(" ESC "cD" ESC "G0" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Italic off (with default colors) - to->attr.bit.italic = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.italic = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , ESC "(" ESC "H\003" ESC "G0" ESC "cD" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Underline on (with default colors) - to->attr.bit.underline = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.underline = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , ESC "(" ESC "cD" ESC "G8" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Underline off (with default colors) - to->attr.bit.underline = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.underline = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , ESC "(" ESC "H\003" ESC "G0" ESC "cD" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Blink on (with default colors) - to->attr.bit.blink = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.blink = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , ESC "(" ESC "cD" ESC "G2" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Blink off (with default colors) - to->attr.bit.blink = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.blink = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , ESC "(" ESC "H\003" ESC "G0" ESC "cD" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Reverse on (with default colors) - to->attr.bit.reverse = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.reverse = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , ESC "(" ESC "cD" ESC "G4" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Reverse off (with default colors) - to->attr.bit.reverse = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.reverse = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , ESC "(" ESC "H\003" ESC "G0" ESC "cD" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Standout on (with default colors) - to->attr.bit.standout = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.standout = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , ESC "(" ESC "cD" ESC "Gt" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Standout off (with default colors) - to->attr.bit.standout = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.standout = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , ESC "(" ESC "H\003" ESC "G0" ESC "cD" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Invisible on (with default colors) - to->attr.bit.invisible = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.invisible = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , ESC "(" ESC "cD" ESC "G1" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Invisible off (with default colors) - to->attr.bit.invisible = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.invisible = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , ESC "(" ESC "H\003" ESC "G0" ESC "cD" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Protect on (with default colors) - to->attr.bit.protect = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.protect = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , ESC ")" ESC "cD" ESC "G0" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Protect off (with default colors) - to->attr.bit.protect = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.protect = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , ESC "(" ESC "H\003" ESC "G0" ESC "cD" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Crossed out on (with default colors) - to->attr.bit.crossed_out = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.crossed_out = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , ESC "(" ESC "cD" ESC "G0" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Crossed out off (with default colors) - to->attr.bit.crossed_out = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.crossed_out = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , ESC "(" ESC "H\003" ESC "G0" ESC "cD" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Double underline on (with default colors) - to->attr.bit.dbl_underline = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.dbl_underline = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , ESC "(" ESC "cD" ESC "G0" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Double underline off (with default colors) - to->attr.bit.dbl_underline = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.dbl_underline = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , ESC "(" ESC "H\003" ESC "G0" ESC "cD" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Alternate character set on (with default colors) - to->attr.bit.alt_charset = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.alt_charset = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , ESC "(" ESC "cE" ESC "G0" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Alternate character set off (with default colors) - to->attr.bit.alt_charset = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.alt_charset = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , ESC "cD" ESC "(" ESC "H\003" ESC "G0" ESC "cD" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // PC character set on (with default colors) - to->attr.bit.pc_charset = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.pc_charset = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , ESC "(" ESC "cD" ESC "G0" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // PC character set off (with default colors) - to->attr.bit.pc_charset = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.pc_charset = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , ESC "(" ESC "H\003" ESC "G0" ESC "cD" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Turn on all attributes (with default colors) - to->attr.bit.pc_charset = true; - to->attr.bit.bold = true; - to->attr.bit.dim = true; - to->attr.bit.italic = true; - to->attr.bit.underline = true; - to->attr.bit.blink = true; - to->attr.bit.reverse = true; - to->attr.bit.standout = true; - to->attr.bit.invisible = true; - to->attr.bit.protect = true; - to->attr.bit.crossed_out = true; - to->attr.bit.dbl_underline = true; - to->attr.bit.alt_charset = true; - to->attr.bit.pc_charset = true; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.pc_charset = true; + to.attr.bit.bold = true; + to.attr.bit.dim = true; + to.attr.bit.italic = true; + to.attr.bit.underline = true; + to.attr.bit.blink = true; + to.attr.bit.reverse = true; + to.attr.bit.standout = true; + to.attr.bit.invisible = true; + to.attr.bit.protect = true; + to.attr.bit.crossed_out = true; + to.attr.bit.dbl_underline = true; + to.attr.bit.alt_charset = true; + to.attr.bit.pc_charset = true; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , ESC ")" ESC "cE" ESC "G\177" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Cyan text on blue background - to->fg_color = finalcut::fc::Cyan; - to->bg_color = finalcut::fc::Blue; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::Cyan; + to.bg_color = finalcut::fc::Blue; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Bold off - to->attr.bit.bold = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.bold = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , ESC "(" ESC "H\003" ESC "G0" ESC "cD" ESC "cE" ESC "Gp" ESC "G8" ESC "G2" ESC "G2" ESC "Gt" ESC "G1" ESC ")" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Dim off - to->attr.bit.dim = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.dim = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , ESC "(" ESC "H\003" ESC "G0" ESC "cD" ESC "cE" ESC "G8" ESC "G2" ESC "G2" ESC "Gt" ESC "G1" ESC ")" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Italic off - to->attr.bit.italic = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.italic = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Underline off - to->attr.bit.underline = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.underline = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , ESC "G0" ESC "cE" ESC "G2" ESC "G2" ESC "Gt" ESC "G1" ESC ")" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Blink off - to->attr.bit.blink = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.blink = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , ESC "(" ESC "H\003" ESC "G0" ESC "cD" ESC "cE" ESC "G2" ESC "Gt" ESC "G1" ESC ")" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Reverse off - to->attr.bit.reverse = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.reverse = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , ESC "(" ESC "H\003" ESC "G0" ESC "cD" ESC "cE" ESC "Gt" ESC "G1" ESC ")" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Standout off - to->attr.bit.standout = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.standout = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , ESC "G0" ESC "cE" ESC "G1" ESC ")" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Invisible off - to->attr.bit.invisible = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.invisible = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , ESC "(" ESC "H\003" ESC "G0" ESC "cD" ESC "cE" ESC ")" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Protect off - to->attr.bit.protect = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.protect = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , ESC "(" ESC "H\003" ESC "G0" ESC "cD" ESC "cE" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Crossed out off - to->attr.bit.crossed_out = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.crossed_out = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , ESC "(" ESC "H\003" ESC "G0" ESC "cD" ESC "cE" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Double underline off - to->attr.bit.dbl_underline = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.dbl_underline = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Alternate character set off - to->attr.bit.alt_charset = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.alt_charset = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), ESC "cD" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // PC character set off - to->attr.bit.pc_charset = false; - CPPUNIT_ASSERT ( *from != *to ); + to.attr.bit.pc_charset = false; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) , ESC "(" ESC "H\003" ESC "G0" ESC "cD" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Green text color - to->fg_color = finalcut::fc::Green; - CPPUNIT_ASSERT ( *from != *to ); + to.fg_color = finalcut::fc::Green; + CPPUNIT_ASSERT ( from != to ); CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); - CPPUNIT_ASSERT ( *from == *to ); + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); // Default text color - to->fg_color = finalcut::fc::Default; - CPPUNIT_ASSERT ( *from == *to ); + to.fg_color = finalcut::fc::Default; + CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); - - delete to; - delete from; } //---------------------------------------------------------------------- diff --git a/test/fstring-test.cpp b/test/fstring-test.cpp index 38c63c51..4253081e 100644 --- a/test/fstring-test.cpp +++ b/test/fstring-test.cpp @@ -2196,7 +2196,7 @@ void FStringTest::controlCodesTest() // C0 control codes (0x01 - 0x1f) - without null (0x00) finalcut::FString c0(0x1f); - for (int i = 0; i < 0x1f; i++) + for (auto i = 0; i < 0x1f; i++) c0[i] = i + 1; CPPUNIT_ASSERT ( c0.getLength() == 31 ); @@ -2210,7 +2210,8 @@ void FStringTest::controlCodesTest() // C1 control codes (0x80 - 0x9f) // Used as print characters in some character sets finalcut::FString c1(0x20); - for (int i = 0; i <= 0x1f; i++) + + for (auto i = 0; i <= 0x1f; i++) c1[i] = i + 0x80; CPPUNIT_ASSERT ( c1.replaceControlCodes() == finalcut::FString(32, L' ') );