diff --git a/ChangeLog b/ChangeLog index e9c1575f..de56b965 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2020-10-04 Markus Gans + * Replaces some C-style arrays with std::array + * Now you can use the arrow keys to move a window into the visible area + * Removes FData memory leak in FListBoxItem and FListViewItem + 2020-09-27 Markus Gans * An explanation of the widget tree was added to the document of the first steps diff --git a/doc/final-cut-widget tree.svg b/doc/final-cut-widget tree.svg index 2b911b0b..eeb7eeae 100644 --- a/doc/final-cut-widget tree.svg +++ b/doc/final-cut-widget tree.svg @@ -5,41 +5,13 @@ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" - xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" - xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - id="svg61" - version="1.1" - width="149.86537mm" - viewBox="0 0 149.86537 65.484895" height="65.484894mm" - sodipodi:docname="final-cut-widget tree.svg" - inkscape:version="0.92.1 r15371"> - + viewBox="0 0 149.86537 65.484895" + width="149.86537mm" + version="1.1" + id="svg109"> + id="metadata115"> @@ -51,364 +23,302 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - + id="defs113" /> + + + + + + + + + + + + + + + - - - + + + FApplication - - - - - - + FApplication + + + + + FDialog - - - - - - + FDialog + + + + + FDialog - - - - - - + FDialog + + + + + FLabel - - - - - - + FLabel + + + + + FButton - + id="text53"> + FListBox + + + id="text61"> etc. + y="65.409096" + id="tspan59">etc. + d="m49.251306 9.2100164v5.7870836" + fill="none" + marker-end="url(#a)" + stroke="#000" + stroke-width=".423069" + id="path63" /> + d="m42.679299 24.537976v5.779196" + fill="none" + marker-end="url(#b)" + stroke="#000" + stroke-width=".423069" + id="path65" /> + d="m55.736511 24.537898v5.779196" + fill="none" + marker-end="url(#c)" + stroke="#000" + stroke-width=".423069" + id="path67" /> + d="m62.369882 39.865938v5.548839" + fill="none" + marker-end="url(#d)" + stroke="#000" + stroke-width=".423069" + id="path69" /> + d="m62.369882 55.193909v5.548839" + fill="none" + marker-end="url(#e)" + stroke="#000" + stroke-width=".423069" + id="path71" /> + style="font-size:4.93888903px;font-family:FreeSans, Arial, 'Bitstream Vera Sans', 'DejaVu Sans', 'Open Sans', sans-serif;letter-spacing:0;word-spacing:0;text-anchor:middle;fill:#1a1a1a;stroke-width:0.51097;stroke-opacity:0" + transform="matrix(0.82806766,0,0,0.82760652,25.151866,-0.203308)" + id="g89"> + id="text75"> Parent: + y="8.7182531" + id="tspan73">Parent: + id="text79"> Child: + y="27.239086" + id="tspan77">Child: + id="text83"> Subchild: + y="44.796837" + id="tspan81">Subchild: + id="text87"> Sub-subchild: + y="63.317669" + id="tspan85">Sub-subchild: + style="font-size:4.93888903px;font-family:FreeSans, Arial, 'Bitstream Vera Sans', 'DejaVu Sans', 'Open Sans', sans-serif;letter-spacing:0;word-spacing:0;text-anchor:middle;fill:#1a1a1a;stroke-width:0.51097;stroke-opacity:0" + transform="matrix(0.82806766,0,0,0.82760652,107.7173,-0.203308)" + id="g107"> + id="text93"> Application widget (= 1) + y="8.7182531" + id="tspan91">Application widget (= 1) + id="text97"> Main widget (= 1) + y="27.239086" + id="tspan95">Main widget (= 1) + id="text101"> Widget(s) of the main widget (≥ 0) + y="44.796837" + id="tspan99">Widget(s) of the main widget (≥ 0) + id="text105"> Widget(s) from the parent widget (≥ 0) + y="63.317669" + id="tspan103">Widget(s) from the parent widget (≥ 0) diff --git a/doc/user-theme.md b/doc/user-theme.md index bd05ed97..611a2c23 100644 --- a/doc/user-theme.md +++ b/doc/user-theme.md @@ -27,7 +27,7 @@ class myWidgetColors final : public finalcut::FWidgetColors ~myWidgetColors() override { } - const finalcut::FString getClassName() const override + finalcut::FString getClassName() const override { return "myWidgetColors"; } @@ -68,7 +68,7 @@ class BeeColorTheme final : public finalcut::FWidgetColors ~BeeColorTheme() override { } - const finalcut::FString getClassName() const override + finalcut::FString getClassName() const override { return "BeeColorTheme"; } @@ -216,7 +216,7 @@ class myColorPalette final : public finalcut::FColorPalette ~myColorPalette() { } - const finalcut::FString getClassName() const override + finalcut::FString getClassName() const override { return "myColorPalette"; } @@ -299,7 +299,7 @@ class BeeColorPalette final : public finalcut::FColorPalette ~BeeColorPalette() { } - const finalcut::FString getClassName() const override + finalcut::FString getClassName() const override { return "BeeColorPalette"; } diff --git a/examples/7segment.cpp b/examples/7segment.cpp index 2a6876fd..6a16fd6c 100644 --- a/examples/7segment.cpp +++ b/examples/7segment.cpp @@ -20,6 +20,7 @@ * . * ***********************************************************************/ +#include #include #include @@ -39,9 +40,6 @@ using finalcut::FSize; class SegmentView final : public finalcut::FDialog { public: - // Using-declaration - using FDialog::setGeometry; - // Constructor explicit SegmentView (finalcut::FWidget* = nullptr); @@ -64,10 +62,9 @@ class SegmentView final : public finalcut::FDialog void get7Segment (const wchar_t); void draw() override; - // Data members std::map code{}; - finalcut::FString line[3]{}; + std::array line{}; finalcut::FLineEdit input{"0123", this}; finalcut::FButton exit{"E&xit", this}; }; @@ -140,7 +137,7 @@ void SegmentView::hexEncoding() //---------------------------------------------------------------------- void SegmentView::get7Segment (const wchar_t c) { - for (int i{0}; i < 3; i++) + for (std::size_t i{0}; i < 3; i++) line[i].clear(); switch ( c ) @@ -186,8 +183,8 @@ void SegmentView::get7Segment (const wchar_t c) if ( code.find(c) != code.end() ) { const sevenSegment& s = code[c]; - constexpr char h[2]{' ', '_'}; - constexpr char v[2]{' ', '|'}; + constexpr std::array h{{' ', '_'}}; + constexpr std::array v{{' ', '|'}}; line[0] << ' ' << h[s.a] << ' '; line[1] << v[s.f] << h[s.g] << v[s.b]; diff --git a/examples/background-color.cpp b/examples/background-color.cpp index 186bdd20..e215f7d7 100644 --- a/examples/background-color.cpp +++ b/examples/background-color.cpp @@ -38,9 +38,6 @@ using finalcut::FSize; class Background final : public finalcut::FDialog { public: - // Using-declaration - using FDialog::setGeometry; - // Typedef typedef std::tuple RGB; diff --git a/examples/calculator.cpp b/examples/calculator.cpp index 156a5c96..77e1479b 100644 --- a/examples/calculator.cpp +++ b/examples/calculator.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -231,7 +232,7 @@ class Calc final : public finalcut::FDialog char infix_operator{'\0'}; char last_infix_operator{'\0'}; finalcut::FString input{""}; - button button_no[Calc::NUM_OF_BUTTONS]{}; + std::array button_no{}; struct StackData { @@ -950,8 +951,8 @@ void Calc::draw() bool Calc::isDataEntryKey (int key) const { // Test if key is in {'.', '0'..'9'} - const int data_entry_keys[] = - { + constexpr std::array key_list = + {{ Decimal_point, Zero, One, @@ -963,11 +964,11 @@ bool Calc::isDataEntryKey (int key) const Seven, Eight, Nine - }; + }}; - const int* iter = std::find (data_entry_keys, data_entry_keys + 11, key); + const auto& iter = std::find (key_list.begin(), key_list.end(), key); - if ( iter != data_entry_keys + 11 ) + if ( iter != key_list.end() ) return true; else return false; @@ -977,19 +978,19 @@ bool Calc::isDataEntryKey (int key) const bool Calc::isOperatorKey(int key) const { // Test if key is in {'*', '/', '+', '-', '^', '='} - const int operators[] = - { + constexpr std::array operators = + {{ Multiply, Divide, Add, Subtract, Power, Equals - }; + }}; - const int* iter = std::find (operators, operators + 6, key); + const auto& iter = std::find (operators.begin(), operators.end(), key); - if ( iter != operators + 6 ) + if ( iter != operators.end() ) return true; else return false; @@ -1099,8 +1100,8 @@ void Calc::adjustSize() //---------------------------------------------------------------------- const wchar_t* Calc::getButtonText (const std::size_t key) const { - static const wchar_t* const button_text[Calc::NUM_OF_BUTTONS] = - { + constexpr std::array button_text = + {{ L"&Sin", L"&Cos", L"&Tan", @@ -1135,7 +1136,7 @@ const wchar_t* Calc::getButtonText (const std::size_t key) const L"&.", L"&±", L"&=" - }; + }}; return button_text[key]; } diff --git a/examples/checklist.cpp b/examples/checklist.cpp index 07248adf..46c19675 100644 --- a/examples/checklist.cpp +++ b/examples/checklist.cpp @@ -58,6 +58,7 @@ class CheckList final : public finalcut::FDialog private: // Method void populate(); + void adjustSize() override; // Event handlers void onKeyPress (finalcut::FKeyEvent*) override; @@ -80,8 +81,7 @@ CheckList::CheckList (finalcut::FWidget* parent) // (CERT, OOP50-CPP) FDialog::setText (L"Shopping list"); const std::size_t nf_offset = ( finalcut::FTerm::isNewFont() ) ? 1 : 0; - FDialog::setGeometry ( FPoint{int(1 + (parent->getWidth() - 28) / 2), 5} - , FSize{28 + nf_offset, 13} ); + FDialog::setSize (FSize{28 + nf_offset, 13} ); setShadow(); listview.ignorePadding(); listview.setGeometry ( FPoint{1 + int(nf_offset), 2} @@ -121,29 +121,36 @@ CheckList::~CheckList() // destructor //---------------------------------------------------------------------- void CheckList::populate() { - const std::string list[][2] = - { - { "Milk", "Highest" }, - { "Cheese", "High" }, - { "Yoghurt", "Medium" }, - { "Bread", "Low" }, - { "Eggs", "High" }, - { "Toothpaste", "Medium" }, - { "Apples", "Lowest" }, - { "Bananas", "Medium" }, - { "Fish", "Medium" }, - { "Lemons", "Low" } - }; + constexpr std::array, 10> list = + {{ + {{ "Milk", "Highest" }}, + {{ "Cheese", "High" }}, + {{ "Yoghurt", "Medium" }}, + {{ "Bread", "Low" }}, + {{ "Eggs", "High" }}, + {{ "Toothpaste", "Medium" }}, + {{ "Apples", "Lowest" }}, + {{ "Bananas", "Medium" }}, + {{ "Fish", "Medium" }}, + {{ "Lemons", "Low" }} + }}; for (const auto& line : list) { - const finalcut::FStringList string_line (&line[0], &line[0] + 2); + const finalcut::FStringList string_line (line.begin(), line.end()); auto iter = listview.insert (string_line); auto item = static_cast(*iter); item->setCheckable(true); } } +//---------------------------------------------------------------------- +void CheckList::adjustSize() +{ + finalcut::FDialog::adjustSize(); + setPos(FPoint{int(1 + (getDesktopWidth() - getWidth()) / 2), 5}); +} + //---------------------------------------------------------------------- void CheckList::onKeyPress (finalcut::FKeyEvent* ev) { diff --git a/examples/event-log.cpp b/examples/event-log.cpp index e3b2afa2..a3bd7095 100644 --- a/examples/event-log.cpp +++ b/examples/event-log.cpp @@ -51,7 +51,7 @@ class EventDialog final : public finalcut::FDialog EventDialog (const EventDialog&) = delete; // Destructor - ~EventDialog(); + ~EventDialog() override; // Disable copy assignment operator (=) EventDialog& operator = (const EventDialog&) = delete; @@ -245,7 +245,7 @@ class EventLog final : public finalcut::FDialog, public std::ostringstream EventLog (const EventLog&) = delete; // Destructor - ~EventLog(); + ~EventLog() override; // Disable copy assignment operator (=) EventLog& operator = (const EventLog&) = delete; diff --git a/examples/listview.cpp b/examples/listview.cpp index c2587da4..bdc9eec3 100644 --- a/examples/listview.cpp +++ b/examples/listview.cpp @@ -130,54 +130,54 @@ Listview::~Listview() // destructor //---------------------------------------------------------------------- void Listview::populate() { - const std::string weather[][5] = - { - { "Alexandria", "Sunny", "31°C", "61%", "1006.4 mb" }, - { "Amsterdam", "Cloudy", "21°C", "82%", "1021.3 mb" }, - { "Baghdad", "Fair", "47°C", "9%", "1001.0 mb" }, - { "Bangkok", "Partly Cloudy", "30°C", "69%", "1002.0 mb" }, - { "Beijing", "Fair", "31°C", "68%", "1007.1 mb" }, - { "Berlin", "Cloudy", "22°C", "53%", "1022.0 mb" }, - { "Bogotá", "Fair", "9°C", "95%", "1028.5 mb" }, - { "Budapest", "Partly Cloudy", "23°C", "37%", "1020.7 mb" }, - { "Buenos Aires", "Cloudy", "7°C", "73%", "1019.0 mb" }, - { "Cairo", "Fair", "39°C", "22%", "1006.1 mb" }, - { "Cape Town", "Partly Cloudy", "12°C", "45%", "1030.1 mb" }, - { "Chicago", "Mostly Cloudy", "21°C", "81%", "1014.9 mb" }, - { "Delhi", "Haze", "33°C", "68%", "998.0 mb" }, - { "Dhaka", "Haze", "32°C", "64%", "996.3 mb" }, - { "Houston", "Cloudy", "23°C", "100%", "1014.2 mb" }, - { "Istanbul", "Mostly Cloudy", "27°C", "61%", "1011.2 mb" }, - { "Jakarta", "Fair", "28°C", "71%", "1009.1 mb" }, - { "Jerusalem", "Sunny", "35°C", "17%", "1005.8 mb" }, - { "Johannesburg", "Fair", "18°C", "16%", "1020.0 mb" }, - { "Karachi", "Mostly Cloudy", "29°C", "76%", "998.0 mb" }, - { "Lagos", "Mostly Cloudy", "27°C", "86%", "1014.6 mb" }, - { "Lima", "Cloudy", "17°C", "83%", "1017.3 mb" }, - { "London", "Cloudy", "23°C", "71%", "1023.0 mb" }, - { "Los Angeles", "Fair", "21°C", "78%", "1011.9 mb" }, - { "Madrid", "Fair", "32°C", "35%", "1020.0 mb" }, - { "Mexico City", "Partly Cloudy", "14°C", "79%", "1028.5 mb" }, - { "Moscow", "Partly Cloudy", "24°C", "54%", "1014.2 mb" }, - { "Mumbai", "Haze", "28°C", "77%", "1003.0 mb" }, - { "New York City", "Sunny", "21°C", "80%", "1014.2 mb" }, - { "Paris", "Partly Cloudy", "27°C", "57%", "1024.4 mb" }, - { "Reykjavík", "Mostly Cloudy", "11°C", "76%", "998.6 mb" }, - { "Rio de Janeiro", "Fair", "24°C", "64%", "1022.0 mb" }, - { "Rome", "Fair", "32°C", "18%", "1014.2 mb" }, - { "Saint Petersburg", "Mostly Cloudy", "18°C", "55%", "1014.6 mb" }, - { "São Paulo", "Fair", "19°C", "53%", "1024.0 mb" }, - { "Seoul", "Cloudy", "26°C", "87%", "1012.2 mb" }, - { "Shanghai", "Fair", "32°C", "69%", "1009.1 mb" }, - { "Singapore", "Mostly Cloudy", "29°C", "73%", "1009.1 mb" }, - { "Tehran", "Fair", "36°C", "14%", "1013.2 mb" }, - { "Tokyo", "Mostly Cloudy", "28°C", "67%", "1009.1 mb" }, - { "Zurich", "Mostly Cloudy", "23°C", "44%", "1023.7 mb" } - }; + constexpr std::array, 41> weather = + {{ + {{ "Alexandria", "Sunny", "31°C", "61%", "1006.4 mb" }}, + {{ "Amsterdam", "Cloudy", "21°C", "82%", "1021.3 mb" }}, + {{ "Baghdad", "Fair", "47°C", "9%", "1001.0 mb" }}, + {{ "Bangkok", "Partly Cloudy", "30°C", "69%", "1002.0 mb" }}, + {{ "Beijing", "Fair", "31°C", "68%", "1007.1 mb" }}, + {{ "Berlin", "Cloudy", "22°C", "53%", "1022.0 mb" }}, + {{ "Bogotá", "Fair", "9°C", "95%", "1028.5 mb" }}, + {{ "Budapest", "Partly Cloudy", "23°C", "37%", "1020.7 mb" }}, + {{ "Buenos Aires", "Cloudy", "7°C", "73%", "1019.0 mb" }}, + {{ "Cairo", "Fair", "39°C", "22%", "1006.1 mb" }}, + {{ "Cape Town", "Partly Cloudy", "12°C", "45%", "1030.1 mb" }}, + {{ "Chicago", "Mostly Cloudy", "21°C", "81%", "1014.9 mb" }}, + {{ "Delhi", "Haze", "33°C", "68%", "998.0 mb" }}, + {{ "Dhaka", "Haze", "32°C", "64%", "996.3 mb" }}, + {{ "Houston", "Cloudy", "23°C", "100%", "1014.2 mb" }}, + {{ "Istanbul", "Mostly Cloudy", "27°C", "61%", "1011.2 mb" }}, + {{ "Jakarta", "Fair", "28°C", "71%", "1009.1 mb" }}, + {{ "Jerusalem", "Sunny", "35°C", "17%", "1005.8 mb" }}, + {{ "Johannesburg", "Fair", "18°C", "16%", "1020.0 mb" }}, + {{ "Karachi", "Mostly Cloudy", "29°C", "76%", "998.0 mb" }}, + {{ "Lagos", "Mostly Cloudy", "27°C", "86%", "1014.6 mb" }}, + {{ "Lima", "Cloudy", "17°C", "83%", "1017.3 mb" }}, + {{ "London", "Cloudy", "23°C", "71%", "1023.0 mb" }}, + {{ "Los Angeles", "Fair", "21°C", "78%", "1011.9 mb" }}, + {{ "Madrid", "Fair", "32°C", "35%", "1020.0 mb" }}, + {{ "Mexico City", "Partly Cloudy", "14°C", "79%", "1028.5 mb" }}, + {{ "Moscow", "Partly Cloudy", "24°C", "54%", "1014.2 mb" }}, + {{ "Mumbai", "Haze", "28°C", "77%", "1003.0 mb" }}, + {{ "New York City", "Sunny", "21°C", "80%", "1014.2 mb" }}, + {{ "Paris", "Partly Cloudy", "27°C", "57%", "1024.4 mb" }}, + {{ "Reykjavík", "Mostly Cloudy", "11°C", "76%", "998.6 mb" }}, + {{ "Rio de Janeiro", "Fair", "24°C", "64%", "1022.0 mb" }}, + {{ "Rome", "Fair", "32°C", "18%", "1014.2 mb" }}, + {{ "Saint Petersburg", "Mostly Cloudy", "18°C", "55%", "1014.6 mb" }}, + {{ "São Paulo", "Fair", "19°C", "53%", "1024.0 mb" }}, + {{ "Seoul", "Cloudy", "26°C", "87%", "1012.2 mb" }}, + {{ "Shanghai", "Fair", "32°C", "69%", "1009.1 mb" }}, + {{ "Singapore", "Mostly Cloudy", "29°C", "73%", "1009.1 mb" }}, + {{ "Tehran", "Fair", "36°C", "14%", "1013.2 mb" }}, + {{ "Tokyo", "Mostly Cloudy", "28°C", "67%", "1009.1 mb" }}, + {{ "Zurich", "Mostly Cloudy", "23°C", "44%", "1023.7 mb" }} + }}; for (const auto& place : weather) { - const finalcut::FStringList line (&place[0], &place[0] + 5); + const finalcut::FStringList line (place.begin(), place.end()); listview.insert (line); } } @@ -197,7 +197,10 @@ void Listview::cb_showInMessagebox() "Temperature: " + item->getText(3) + "\n" " Humidity: " + item->getText(4) + "\n" " Pressure: " + item->getText(5) - , finalcut::FMessageBox::Ok, 0, 0, this ); + , finalcut::FMessageBox::Ok + , finalcut::FMessageBox::Reject + , finalcut::FMessageBox::Reject + , this ); info.show(); } diff --git a/examples/mandelbrot.cpp b/examples/mandelbrot.cpp index fe9d1c44..f8c52b96 100644 --- a/examples/mandelbrot.cpp +++ b/examples/mandelbrot.cpp @@ -75,8 +75,8 @@ void Mandelbrot::draw() const int xoffset{2}; const int yoffset{2}; - const int Cols = int(getClientWidth()); - const int Lines = int(getClientHeight()); + const auto Cols = int(getClientWidth()); + const auto Lines = int(getClientHeight()); int current_line{0}; if ( Cols < 2 || Lines < 2 ) diff --git a/examples/menu.cpp b/examples/menu.cpp index 216c630f..66099bf8 100644 --- a/examples/menu.cpp +++ b/examples/menu.cpp @@ -291,8 +291,8 @@ void Menu::defaultCallback (const finalcut::FMenuList* mb) //---------------------------------------------------------------------- void Menu::adjustSize() { - const int pw = int(getDesktopWidth()); - const int ph = int(getDesktopHeight()); + const auto pw = int(getDesktopWidth()); + const auto ph = int(getDesktopHeight()); setX (1 + (pw - int(getWidth())) / 2, false); setY (1 + (ph - int(getHeight())) / 4, false); finalcut::FDialog::adjustSize(); @@ -327,8 +327,7 @@ int main (int argc, char* argv[]) // Create main dialog object Menu main_dlg {&app}; main_dlg.setText ("Menu example"); - main_dlg.setGeometry ( FPoint{int(1 + (app.getWidth() - 40) / 2), 2} - , FSize{40, 6} ); + main_dlg.setSize ({40, 6}); main_dlg.setShadow(); // Set dialog main_dlg as main widget diff --git a/examples/mouse.cpp b/examples/mouse.cpp index e986e937..c59524af 100644 --- a/examples/mouse.cpp +++ b/examples/mouse.cpp @@ -537,8 +537,8 @@ void MouseDraw::adjustSize() { const std::size_t w{60}; const std::size_t h{18}; - const int x = 1 + int((getParentWidget()->getWidth() - w) / 2); - const int y = 1 + int((getParentWidget()->getHeight() - h) / 2); + const int x = 1 + int((getDesktopWidth() - w) / 2); + const int y = 1 + int((getDesktopHeight() - h) / 2); setGeometry (FPoint{x, y}, FSize{w, h}, false); finalcut::FDialog::adjustSize(); } @@ -590,7 +590,6 @@ int main (int argc, char* argv[]) // Create a simple dialog box MouseDraw mouse_draw{&app}; - mouse_draw.setGeometry (FPoint{12, 4}, FSize{60, 18}); // Set dialog object mouse_draw as main widget finalcut::FWidget::setMainWidget(&mouse_draw); diff --git a/examples/opti-move.cpp b/examples/opti-move.cpp index ddb33701..b89bf694 100644 --- a/examples/opti-move.cpp +++ b/examples/opti-move.cpp @@ -20,6 +20,7 @@ * . * ***********************************************************************/ +#include #include #include #include @@ -93,14 +94,15 @@ void move (int xold, int yold, int xnew, int ynew) finalcut::FString from{}; finalcut::FString to{}; finalcut::FString byte{}; - const std::string ctrl_character[] = - { + + constexpr std::array ctrl_character = + {{ "NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL", "BS", "Tab", "LF", "VT", "FF", "CR", "SO", "SI", "DLE", "DC1", "DC2", "DC3", "DC4", "NAK", "SYN", "ETB", "CAN", "EM", "SUB", "Esc", "FS", "GS", "RS", "US", "Space" - }; + }}; term_boundaries(xold, yold); term_boundaries(xnew, ynew); @@ -209,8 +211,11 @@ DirectLogger::~DirectLogger() // destructor //---------------------------------------------------------------------- int main (int argc, char* argv[]) { - // Disable mouse - finalcut::FStartOptions::getFStartOptions().mouse_support = false; + // Disable mouse, color palette changes and terminal data requests + auto& start_options = finalcut::FStartOptions::getFStartOptions(); + start_options.mouse_support = false; + start_options.color_change = false; + start_options.terminal_data_request = false; // Create the application object finalcut::FApplication term_app{argc, argv}; diff --git a/examples/rotozoomer.cpp b/examples/rotozoomer.cpp index 270c3346..12dfec23 100644 --- a/examples/rotozoomer.cpp +++ b/examples/rotozoomer.cpp @@ -226,7 +226,7 @@ void RotoZoomer::onShow (finalcut::FShowEvent*) end = system_clock::now(); generateReport(); flush(); - quit(); + close(); } } @@ -261,7 +261,9 @@ void RotoZoomer::onKeyPress (finalcut::FKeyEvent* ev) //---------------------------------------------------------------------- void RotoZoomer::onClose (finalcut::FCloseEvent* ev) { - if ( ! benchmark ) + if ( benchmark ) + ev->accept(); + else finalcut::FApplication::closeConfirmationDialog (this, ev); } @@ -305,6 +307,9 @@ int main (int argc, char* argv[]) || strcmp(argv[1], "-b") == 0 ) ) { benchmark = true; + // Disable terminal data requests + auto& start_options = finalcut::FStartOptions::getFStartOptions(); + start_options.terminal_data_request = false; } { // Create the application object in this scope @@ -317,8 +322,6 @@ int main (int argc, char* argv[]) if ( benchmark ) roto.setGeometry (FPoint{1, 1}, FSize{80, 24}); - else - roto.setGeometry (FPoint{5, 1}, FSize{72, 23}); roto.setShadow(); diff --git a/examples/term-attributes.cpp b/examples/term-attributes.cpp index 65ec75dd..9eacc4e1 100644 --- a/examples/term-attributes.cpp +++ b/examples/term-attributes.cpp @@ -63,7 +63,7 @@ class AttribDlg final : public finalcut::FDialog private: // Constants - static constexpr FColor UNDEFINED = static_cast(-2); + static constexpr auto UNDEFINED = static_cast(-2); // Method void adjustSize() override; @@ -498,8 +498,7 @@ int main (int argc, char* argv[]) // This object will be automatically deleted by // the parent object "app" (FObject destructor). AttribDlg dialog{&app}; - - dialog.setGeometry (FPoint{6, 2}, FSize{69, 21}); + dialog.setSize (FSize{69, 21}); dialog.setShadow(); // Create the attribute demo widget as a child object from the dialog diff --git a/examples/termcap.cpp b/examples/termcap.cpp index 1c36835c..f93935f7 100644 --- a/examples/termcap.cpp +++ b/examples/termcap.cpp @@ -20,6 +20,7 @@ * . * ***********************************************************************/ +#include #include #include #include @@ -50,14 +51,14 @@ struct Data const fc::termcaps cap; }; - static TermcapString strings[]; + static std::array strings; }; //---------------------------------------------------------------------- // struct data - string data array //---------------------------------------------------------------------- -Data::TermcapString Data::strings[] = -{ +std::array Data::strings = +{{ { "t_bell", fc::t_bell }, { "t_erase_chars", fc::t_erase_chars }, { "t_clear_screen", fc::t_clear_screen }, @@ -99,6 +100,7 @@ Data::TermcapString Data::strings[] = { "t_parm_right_cursor", fc::t_parm_right_cursor }, { "t_save_cursor", fc::t_save_cursor }, { "t_restore_cursor", fc::t_restore_cursor }, + { "t_cursor_style", fc::t_cursor_style }, { "t_scroll_forward", fc::t_scroll_forward }, { "t_scroll_reverse", fc::t_scroll_reverse }, { "t_enter_ca_mode", fc::t_enter_ca_mode }, @@ -140,7 +142,7 @@ Data::TermcapString Data::strings[] = { "t_keypad_xmit", fc::t_keypad_xmit }, { "t_keypad_local", fc::t_keypad_local }, { "t_key_mouse", fc::t_key_mouse } -}; +}}; //---------------------------------------------------------------------- @@ -174,11 +176,11 @@ void tcapString (const std::string& name, const char cap_str[]) return; } - const uInt len = uInt(std::strlen(cap_str)); + const auto len = uInt(std::strlen(cap_str)); for (uInt i{0}; i < len; i++) { - const uChar c = uChar(cap_str[i]); + const auto c = uChar(cap_str[i]); if ( c > 127 ) { @@ -282,8 +284,7 @@ void numeric() void string() { std::cout << "\r\n[String]\r\n"; - const finalcut::FTermcap::tcap_map (&tcap_strings)[] \ - = finalcut::FTermcap::strings; + const auto& tcap_strings = finalcut::FTermcap::strings; for (const auto& entry : Data::strings) { diff --git a/examples/transparent.cpp b/examples/transparent.cpp index 38a9e988..cebba7d9 100644 --- a/examples/transparent.cpp +++ b/examples/transparent.cpp @@ -256,12 +256,11 @@ void MainWindow::onShow (finalcut::FShowEvent*) //---------------------------------------------------------------------- void MainWindow::onTimer (finalcut::FTimerEvent*) { - wchar_t first_char[2]; std::size_t length = line1.getLength(); - first_char[0] = line1[0]; - first_char[1] = line2[0]; - line1 = line1.right(length - 1) + first_char[0]; - line2 = line2.right(length - 1) + first_char[1]; + const wchar_t first_char1 = line1[0]; + const wchar_t first_char2 = line2[0]; + line1 = line1.right(length - 1) + first_char1; + line2 = line2.right(length - 1) + first_char2; redraw(); flush(); } diff --git a/examples/treeview.cpp b/examples/treeview.cpp index a0393b4a..98f53c8a 100644 --- a/examples/treeview.cpp +++ b/examples/treeview.cpp @@ -401,6 +401,8 @@ Treeview::~Treeview() // destructor //---------------------------------------------------------------------- void Treeview::adjustSize() { + finalcut::FDialog::adjustSize(); + std::size_t h = getDesktopHeight() - 4; setHeight (h, false); int x = int((getDesktopWidth() - getWidth()) / 2); @@ -408,15 +410,13 @@ void Treeview::adjustSize() if ( x < 1 ) x = 1; - setX (x, false); + setPos (FPoint{x, 3}, false); if ( initialized ) { - listview.setHeight (getHeight() - 6, false); + listview.setHeight (getHeight() - 6, true); quit.setY(int(getHeight()) - 4); } - - finalcut::FDialog::adjustSize(); } //---------------------------------------------------------------------- @@ -438,8 +438,7 @@ int main (int argc, char* argv[]) // Create main dialog object Treeview d{&app}; d.setText (L"Continents"); - d.setGeometry ( FPoint{int(1 + (app.getWidth() - 57) / 2), 3} - , FSize{57, 20} ); + d.setSize (FSize{57, 20}); d.setShadow(); // Set dialog d as main widget diff --git a/examples/ui.cpp b/examples/ui.cpp index 8f0b8a99..562113ab 100644 --- a/examples/ui.cpp +++ b/examples/ui.cpp @@ -782,19 +782,19 @@ void MyDialog::initWidgetsCallbacks() //---------------------------------------------------------------------- void MyDialog::adjustSize() { - const auto h = getParentWidget()->getHeight() - 4; + finalcut::FDialog::adjustSize(); + + const auto h = getDesktopHeight() - 4; setHeight (h, false); - int x = int((getDesktopWidth() - getWidth()) / 2); + auto x = int((getDesktopWidth() - getWidth()) / 2); if ( x < 1 ) x = 1; - setX (x, false); + setPos (FPoint{x, 2}, false); if ( initialized ) - myList.setHeight (getHeight() - 3, false); - - finalcut::FDialog::adjustSize(); + myList.setHeight (getHeight() - 3, true); } //---------------------------------------------------------------------- @@ -823,7 +823,10 @@ void MyDialog::cb_about() , line + L" FINAL CUT " + line + L"\n\n" L"Version " + libver + L"\n\n" L"(c) 2020 by Markus Gans" - , finalcut::FMessageBox::Ok, 0, 0, this ); + , finalcut::FMessageBox::Ok + , finalcut::FMessageBox::Reject + , finalcut::FMessageBox::Reject + , this ); info.setCenterText(); info.show(); } @@ -843,7 +846,10 @@ void MyDialog::cb_terminfo() << " Size: " << x << fc::Times << y << "\n" << "Colors: " << finalcut::FTerm::getMaxColor() - , finalcut::FMessageBox::Ok, 0, 0, this + , finalcut::FMessageBox::Ok + , finalcut::FMessageBox::Reject + , finalcut::FMessageBox::Reject + , this ); info1.setHeadline("Terminal:"); info1.exec(); @@ -858,7 +864,10 @@ void MyDialog::cb_drives() , "Generic: \n\n" "Network: \n\n" " CD:" - , finalcut::FMessageBox::Ok, 0, 0, this + , finalcut::FMessageBox::Ok + , finalcut::FMessageBox::Reject + , finalcut::FMessageBox::Reject + , this ); if ( finalcut::FTerm::isNewFont() ) @@ -1057,8 +1066,7 @@ int main (int argc, char* argv[]) // Create main dialog object d MyDialog d{&app}; d.setText (title); - d.setGeometry ( FPoint{int((app.getWidth() - 56) / 2), 2} - , FSize{56, app.getHeight() - 4} ); + d.setSize (FSize{56, app.getHeight() - 4}); d.setShadow(); // Set the dialog object d as the main widget of the application. diff --git a/examples/watch.cpp b/examples/watch.cpp index 92359dc6..c607fd61 100644 --- a/examples/watch.cpp +++ b/examples/watch.cpp @@ -79,8 +79,7 @@ Watch::Watch (FWidget* parent) // Avoids calling a virtual function from the constructor // (CERT, OOP50-CPP) FDialog::setText ("Watch"); - const int pw = int(getParentWidget()->getWidth()); - FDialog::setGeometry (FPoint{1 + (pw - 22) / 2, 3}, FSize{22, 13}); + FDialog::setSize ({22, 13}); // Labels time_label.setGeometry(FPoint{5, 2}, FSize{5, 1}); @@ -193,8 +192,9 @@ void Watch::cb_seconds() //---------------------------------------------------------------------- void Watch::adjustSize() { - const int pw = int(getParentWidget()->getWidth()); + const int pw = int(getDesktopWidth()); setX (1 + (pw - 22) / 2, false); + setY (3, false); finalcut::FDialog::adjustSize(); } diff --git a/examples/windows.cpp b/examples/windows.cpp index 526a28f1..d19ec369 100644 --- a/examples/windows.cpp +++ b/examples/windows.cpp @@ -243,6 +243,8 @@ class Window final : public finalcut::FDialog Window::Window (finalcut::FWidget* parent) : finalcut::FDialog{parent} { + setSize ({40, 6}); + // Menu bar item File.setStatusbarMessage ("File management commands"); @@ -349,6 +351,8 @@ void Window::activateWindow (finalcut::FDialog* win) const //---------------------------------------------------------------------- void Window::adjustSize() { + finalcut::FDialog::adjustSize(); + const std::size_t w = getDesktopWidth(); const std::size_t h = getDesktopHeight(); const int X = int(1 + (w - 40) / 2); @@ -375,8 +379,6 @@ void Window::adjustSize() ++iter; } - - finalcut::FDialog::adjustSize(); } //---------------------------------------------------------------------- @@ -574,8 +576,6 @@ int main (int argc, char* argv[]) // Create main dialog object Window main_dlg {&app}; main_dlg.setText ("Main window"); - main_dlg.setGeometry ( FPoint{int(1 + (app.getWidth() - 40) / 2), 2} - , FSize{40, 6} ); // Set dialog main_dlg as main widget finalcut::FWidget::setMainWidget (&main_dlg); diff --git a/fonts/unicodemap.h b/fonts/unicodemap.h index 09f9703d..24d80d69 100644 --- a/fonts/unicodemap.h +++ b/fonts/unicodemap.h @@ -11,14 +11,16 @@ #include #endif +#include + namespace finalcut { namespace fc { -constexpr struct unipair unicode_cp437_pairs[] = -{ +constexpr std::array unicode_cp437_pairs = +{{ // .----------- unicode // | .---- fontpos // | | @@ -304,10 +306,10 @@ constexpr struct unipair unicode_cp437_pairs[] = {0x266a, 0x0d}, {0x266b, 0x0e}, {0x266c, 0x0e} -}; +}}; -constexpr struct unipair unicode_newfont_pairs[] = -{ +constexpr std::array unicode_newfont_pairs = +{{ // .----------- unicode // | .---- fontpos // | | @@ -610,7 +612,7 @@ constexpr struct unipair unicode_newfont_pairs[] = {0xe1f9, 0xf9}, {0xe1fb, 0xfb}, {0xe1fc, 0xfc} -}; +}}; } // namespace fc diff --git a/src/fbusyindicator.cpp b/src/fbusyindicator.cpp index 63f24e66..3aa435ff 100644 --- a/src/fbusyindicator.cpp +++ b/src/fbusyindicator.cpp @@ -20,6 +20,7 @@ * . * ***********************************************************************/ +#include #include "final/fbusyindicator.h" namespace finalcut @@ -75,7 +76,7 @@ void FBusyIndicator::init() //---------------------------------------------------------------------- void FBusyIndicator::createIndicatorText() { - FString line[4]{}; + std::array line{}; if ( FTerm::getEncoding() == fc::UTF8 ) { diff --git a/src/fcharmap.cpp b/src/fcharmap.cpp index 06597bb1..7c6c2097 100644 --- a/src/fcharmap.cpp +++ b/src/fcharmap.cpp @@ -20,6 +20,8 @@ * . * ***********************************************************************/ +#include + #include "final/fc.h" #include "final/ftypes.h" #include "final/fcharmap.h" @@ -30,690 +32,676 @@ namespace finalcut namespace fc { -uInt character[][fc::NUM_OF_ENCODINGS] = -{ +std::array, 115> character = +{{ // .--------------------- Unicode (UTF-8) // | .--------------- VT100 // | | .--------- PC (IBM-437) // | | | .---- ASCII (7-Bit) // | | | | - {0x20ac, 0, 0xee, 'E'}, // € - Euro - {0x00a3, '}', 0x9c, 'P'}, // £ - Pound - {0x00a7, '$', 0x15, '$'}, // § - Section - {0x25d8, '*', 0x08, '*'}, // ◘ - InverseBullet - {0x25d9, '*', 0x0a, '*'}, // ◙ - InverseWhiteCircle - {0x203c, '!', 0x13, '!'}, // ‼ - DoubleExclamationMark - {0x2195, 'I', 0x12, 'I'}, // ↕ - UpDownArrow - {0x2194, '-', 0x1d, '-'}, // ↔ - LeftRightArrow - {0x25ac, '_', 0x16, '_'}, // ▬ - BlackRectangle - {0x2191, '^', 0x18, '^'}, // ↑ - UpwardsArrow - {0x2193, 'v', 0x19, 'v'}, // ↓ - DownwardsArrow - {0x2192, '>', 0x1a, '>'}, // → - RightwardsArrow - {0x2190, '<', 0x1b, '<'}, // ← - LeftwardsArrow - {0x203a, '>', 0xaf, '>'}, // › - SingleRightAngleQuotationMark - {0x2039, '<', 0xae, '<'}, // ‹ - SingleLeftAngleQuotationMark - {0x2026, '.', '.', '.'}, // … - HorizontalEllipsis - {0x03c0, '{', 0xe3, 'n'}, // π - Pi - {0x207F, 'I', 0xfc, ' '}, // ⁿ - SuperscriptLatinSmallLetterN - {0x2265, 'z', 0xf2, '>'}, // ≥ - GreaterThanOrEqualTo - {0x2264, 'y', 0xf3, '<'}, // ≤ - LessThanOrEqualTo - {0x2260, 0, 0xd8, '#'}, // ≠ - NotEqualTo - {0x00b1, 'g', 0xf1, '#'}, // ± - PlusMinus - {0x00f7, '/', 0xf6, '/'}, // ÷ - Division sign - {0x00d7, 0, 'x', 'x'}, // × - Multiplication sign - {0x02e3, '~', 0xfc, '`'}, // ˣ - Modifier letter small x - {0x00b0, 'f', 0xb0, 'o'}, // ° - Degree - {0x2022, '`', 0x04, '*'}, // • - Bullet - {0x00b7, '`', 0xfa, '.'}, // · - small Bullet - {0x25cf, '`', 0x04, '*'}, // ● - BlackCircle - {0x2666, '`', 0x04, '*'}, // ◆ - BlackDiamondSuit - {0x2424, 'h', ' ', ' '}, // ␤ - SymbolForNewline (1) - {0x240b, 'i', ' ', ' '}, // ␋ - SymbolForVerticalTab (1) - {0x2409, 'b', ' ', ' '}, // ␉ - SymbolForHorizontalTab (1) - {0x240c, 'c', ' ', ' '}, // ␌ - SymbolForFormFeed (1) - {0x240d, 'd', ' ', ' '}, // ␍ - SymbolForCarriageReturn (1) - {0x240a, 'e', ' ', ' '}, // ␊ - SymbolForLineFeed (1) - {0x2592, 'a', 0xb0, '#'}, // ▒ - MediumShade - {0x2588, '0', 0xdb, '#'}, // █ - FullBlock - {0x25ae, '_', 0xfe, '#'}, // ▮ - BlackVerticalRectangle (1) - {0x258c, 0, 0xdd, ' '}, // ▌ - LeftHalfBlock - {0x2590, 0, 0xde, ' '}, // ▐ - RightHalfBlock - {0x2584, 0, 0xdc, ' '}, // ▄ - LowerHalfBlock - {0x2580, 0, 0xdf, ' '}, // ▀ - UpperHalfBlock - {0x2500, 'q', 0xc4, '-'}, // ─ - BoxDrawingsHorizontal - {0x2502, 'x', 0xb3, '|'}, // │ - BoxDrawingsVertical - {0x250c, 'l', 0xda, '.'}, // ┌ - BoxDrawingsDownAndRight - {0x2510, 'k', 0xbf, '.'}, // ┐ - BoxDrawingsDownAndLeft - {0x2514, 'm', 0xc0, '`'}, // └ - BoxDrawingsUpAndRight - {0x2518, 'j', 0xd9, '\''}, // ┘ - BoxDrawingsUpAndLeft - {0x253c, 'n', 0xc5, '+'}, // ┼ - BoxDrawingsCross - {0x252c, 'w', 0xc2, '+'}, // ┬ - BoxDrawingsDownAndHorizontal - {0x2524, 'u', 0xb4, '+'}, // ┤ - BoxDrawingsVerticalAndLeft - {0x251c, 't', 0xc3, '+'}, // ├ - BoxDrawingsVerticalAndRight - {0x2534, 'v', 0xc1, '+'}, // ┴ - BoxDrawingsUpAndHorizontal - {0x23ba, 'o', '~', '~'}, // ⎺ - HorizontalScanLine1 (1) - {0x23bb, 'p', 0xc4, '-'}, // ⎻ - HorizontalScanLine3 (1) - {0x23bc, 'r', 0xc4, '-'}, // ⎼ - HorizontalScanLine7 (1) - {0x23bd, 's', '_', '_'}, // ⎽ - HorizontalScanLine9 (1) - {0x25b2, '-', 0x1e, '^'}, // ▲ - BlackUpPointingTriangle - {0x25bc, '.', 0x1f, 'v'}, // ▼ - BlackDownPointingTriangle - {0x25b6, '+', 0x10, '>'}, // ▶ - BlackRightPointingTriangle - {0x25c0, ',', 0x11, '<'}, // ◀ - BlackLeftPointingTriangle (1) - {0x25ba, '+', 0x10, '>'}, // ► - BlackRightPointingPointer (1) - {0x25c4, ',', 0x11, '<'}, // ◄ - BlackLeftPointingPointer - {0xe1b3, 'x', 0xb3, '|'}, // │ - NF_border_line_vertical (2) - {0xe1b4, 0, 0xb4, 0}, // ⊐ - NF_rev_left_arrow2 (2) - {0xe1b5, 0, 0xb5, 0}, // ► - NF_rev_right_arrow2 (2) - {0xe1b6, 0, 0xb6, 0}, // ╵ - NF_border_line_left_up (2) - {0xe1b7, 0, 0xb7, 0}, // ) - NF_radio_button3 (2) - {0xe1b8, 0, 0xb8, 0}, // ⎤ - NF_rev_border_corner_upper_right (2) - {0xe1b9, 0, 0xb9, 0}, // ⎹ - NF_rev_border_line_right (2) - {0xe1ba, 0, 0xba, 0}, // ┤ - NF_rev_border_line_vertical_left (2) - {0xe1bb, 0, 0xbb, 0}, // ⎦ - NF_rev_border_corner_lower_right (2) - {0xe1bc, 0, 0xbc, 0}, // ⎸ - NF_border_line_left (2) - {0xe1bd, 0, 0xbd, 0}, //⎹◣ - NF_rev_up_arrow2 (2) - {0xe1be, 0, 0xbe, 0}, //⎹◤ - NF_rev_down_arrow2 (2) - {0xe1bf, 0, 0xbf, 0}, // ╷ - NF_border_line_left_down (2) - {0xe1c0, 0, 0xc0, 0}, // └ - NF_border_corner_middle_lower_left (2) - {0xe1c1, 0, 0xc1, 0}, // ◢⎸ - NF_rev_up_arrow1 (2) - {0xe1c2, 0, 0xc2, 0}, // ◥⎸ - NF_rev_down_arrow1 (2) - {0xe1c3, 0, 0xc3, 0}, // ├ - NF_border_line_vertical_right (2) - {0xe1c4, 'q', 0xc4, '-'}, // ─ - NF_border_line_horizontal (2) - {0xe1c5, 0, 0xc5, 0}, // = - NF_border_line_up_and_down (2) - {0xe1c6, 0, 0xc6, 0}, // = - NF_shadow_box_middle (2) - {0xe1c7, 0, 0xc7, 0}, // = - NF_shadow_box_hdd (2) - {0xe1c8, 0, 0xc8, 0}, // ◄ - NF_rev_left_arrow1 (2) - {0xe1c9, 0, 0xc9, 0}, // ⊏ - NF_rev_right_arrow1 (2) - {0xe1ca, 0, 0xca, 0}, // [ - NF_rev_menu_button1 (2) - {0xe1cb, 0, 0xcb, 0}, // - - NF_rev_menu_button2 (2) - {0xe1cc, 0, 0xcc, 0}, // ┌ - NF_border_corner_middle_upper_left (2) - {0xe1cd, 0, 0xcd, 0}, // = - NF_shadow_box_cd (2) - {0xe1ce, 0, 0xce, 0}, // [ - NF_shadow_box_left (2) - {0xe1cf, 0, 0xcf, 0}, // ┌ - NF_border_line_middle_left_down (2) - {0xe1d0, 0, 0xd0, 0}, // └ - NF_border_line_middle_right_up (2) - {0xe1d1, 0, 0xd1, 0}, // = - NF_shadow_box_net (2) - {0xe1d2, 0, 0xd2, 0}, // ◢ - NF_rev_up_pointing_triangle1 (2) - {0xe1d3, 0, 0xd3, 0}, // ⎣ - NF_border_corner_lower_left (2) - {0xe1d4, 0, 0xd4, 0}, // _ - NF_border_line_bottom (2) - {0xe1d5, 0, 0xd5, 0}, // O - NF_radio_button2 (2) - {0xe1d6, 0, 0xd6, 0}, // ● - NF_radio_button2_checked (2) - {0xe1d7, 0, 0xd7, 0}, // ◥ - NF_rev_down_pointing_triangle1 (2) - {0xe1d8, 0, 0xd8, 0}, // ¯ - NF_border_line_upper (2) - {0xe1d9, 0, 0xd9, 0}, // ( - NF_radio_button1 (2) - {0xe1da, 0, 0xda, 0}, // ⎡ - NF_border_corner_upper_left (2) - {0xe1dc, 0, 0xdc, 0}, // ✓ - NF_shadow_box_checked (2) - {0xe1e7, 0, 0xe7, 0}, // ║ - NF_rev_border_line_right_and_left (2) - {0xe1e8, 0, 0xe8, 0}, // ◣ - NF_rev_up_pointing_triangle2 (2) - {0xe1e9, 0, 0xe9, 0}, // ◤ - NF_rev_down_pointing_triangle2 (2) - {0xe1ea, 0, 0xea, 0}, // ┘ - NF_border_corner_middle_lower_right (2) - {0xe1eb, 0, 0xeb, 0}, // ┐ - NF_border_corner_middle_upper_right (2) - {0xe1f4, 0, 0xf4, 0}, // ] - NF_rev_menu_button3 (2) - {0xe1f5, 0, 0xf5, 0}, // ] - NF_shadow_box_right (2) - {0xe1fb, 0, 0xfb, 0}, // ✓ - NF_check_mark (2) - {0xe1fc, '~', 0xfc, '`'}, // ˣ - NF_xsuperior (2) - {0x221a, 0, 0xfb, 'x'} // √ - square root -}; + {{0x20ac, 0, 0xee, 'E'}}, // € - Euro + {{0x00a3, '}', 0x9c, 'P'}}, // £ - Pound + {{0x00a7, '$', 0x15, '$'}}, // § - Section + {{0x25d8, '*', 0x08, '*'}}, // ◘ - InverseBullet + {{0x25d9, '*', 0x0a, '*'}}, // ◙ - InverseWhiteCircle + {{0x203c, '!', 0x13, '!'}}, // ‼ - DoubleExclamationMark + {{0x2195, 'I', 0x12, 'I'}}, // ↕ - UpDownArrow + {{0x2194, '-', 0x1d, '-'}}, // ↔ - LeftRightArrow + {{0x25ac, '_', 0x16, '_'}}, // ▬ - BlackRectangle + {{0x2191, '^', 0x18, '^'}}, // ↑ - UpwardsArrow + {{0x2193, 'v', 0x19, 'v'}}, // ↓ - DownwardsArrow + {{0x2192, '>', 0x1a, '>'}}, // → - RightwardsArrow + {{0x2190, '<', 0x1b, '<'}}, // ← - LeftwardsArrow + {{0x203a, '>', 0xaf, '>'}}, // › - SingleRightAngleQuotationMark + {{0x2039, '<', 0xae, '<'}}, // ‹ - SingleLeftAngleQuotationMark + {{0x2026, '.', '.', '.'}}, // … - HorizontalEllipsis + {{0x03c0, '{', 0xe3, 'n'}}, // π - Pi + {{0x207F, 'I', 0xfc, ' '}}, // ⁿ - SuperscriptLatinSmallLetterN + {{0x2265, 'z', 0xf2, '>'}}, // ≥ - GreaterThanOrEqualTo + {{0x2264, 'y', 0xf3, '<'}}, // ≤ - LessThanOrEqualTo + {{0x2260, 0, 0xd8, '#'}}, // ≠ - NotEqualTo + {{0x00b1, 'g', 0xf1, '#'}}, // ± - PlusMinus + {{0x00f7, '/', 0xf6, '/'}}, // ÷ - Division sign + {{0x00d7, 0, 'x', 'x'}}, // × - Multiplication sign + {{0x02e3, '~', 0xfc, '`'}}, // ˣ - Modifier letter small x + {{0x00b0, 'f', 0xb0, 'o'}}, // ° - Degree + {{0x2022, '`', 0x04, '*'}}, // • - Bullet + {{0x00b7, '`', 0xfa, '.'}}, // · - small Bullet + {{0x25cf, '`', 0x04, '*'}}, // ● - BlackCircle + {{0x2666, '`', 0x04, '*'}}, // ◆ - BlackDiamondSuit + {{0x2424, 'h', ' ', ' '}}, // ␤ - SymbolForNewline (1) + {{0x240b, 'i', ' ', ' '}}, // ␋ - SymbolForVerticalTab (1) + {{0x2409, 'b', ' ', ' '}}, // ␉ - SymbolForHorizontalTab (1) + {{0x240c, 'c', ' ', ' '}}, // ␌ - SymbolForFormFeed (1) + {{0x240d, 'd', ' ', ' '}}, // ␍ - SymbolForCarriageReturn (1) + {{0x240a, 'e', ' ', ' '}}, // ␊ - SymbolForLineFeed (1) + {{0x2592, 'a', 0xb0, '#'}}, // ▒ - MediumShade + {{0x2588, '0', 0xdb, '#'}}, // █ - FullBlock + {{0x25ae, '_', 0xfe, '#'}}, // ▮ - BlackVerticalRectangle (1) + {{0x258c, 0, 0xdd, ' '}}, // ▌ - LeftHalfBlock + {{0x2590, 0, 0xde, ' '}}, // ▐ - RightHalfBlock + {{0x2584, 0, 0xdc, ' '}}, // ▄ - LowerHalfBlock + {{0x2580, 0, 0xdf, ' '}}, // ▀ - UpperHalfBlock + {{0x2500, 'q', 0xc4, '-'}}, // ─ - BoxDrawingsHorizontal + {{0x2502, 'x', 0xb3, '|'}}, // │ - BoxDrawingsVertical + {{0x250c, 'l', 0xda, '.'}}, // ┌ - BoxDrawingsDownAndRight + {{0x2510, 'k', 0xbf, '.'}}, // ┐ - BoxDrawingsDownAndLeft + {{0x2514, 'm', 0xc0, '`'}}, // └ - BoxDrawingsUpAndRight + {{0x2518, 'j', 0xd9, '\''}}, // ┘ - BoxDrawingsUpAndLeft + {{0x253c, 'n', 0xc5, '+'}}, // ┼ - BoxDrawingsCross + {{0x252c, 'w', 0xc2, '+'}}, // ┬ - BoxDrawingsDownAndHorizontal + {{0x2524, 'u', 0xb4, '+'}}, // ┤ - BoxDrawingsVerticalAndLeft + {{0x251c, 't', 0xc3, '+'}}, // ├ - BoxDrawingsVerticalAndRight + {{0x2534, 'v', 0xc1, '+'}}, // ┴ - BoxDrawingsUpAndHorizontal + {{0x23ba, 'o', '~', '~'}}, // ⎺ - HorizontalScanLine1 (1) + {{0x23bb, 'p', 0xc4, '-'}}, // ⎻ - HorizontalScanLine3 (1) + {{0x23bc, 'r', 0xc4, '-'}}, // ⎼ - HorizontalScanLine7 (1) + {{0x23bd, 's', '_', '_'}}, // ⎽ - HorizontalScanLine9 (1) + {{0x25b2, '-', 0x1e, '^'}}, // ▲ - BlackUpPointingTriangle + {{0x25bc, '.', 0x1f, 'v'}}, // ▼ - BlackDownPointingTriangle + {{0x25b6, '+', 0x10, '>'}}, // ▶ - BlackRightPointingTriangle + {{0x25c0, ',', 0x11, '<'}}, // ◀ - BlackLeftPointingTriangle (1) + {{0x25ba, '+', 0x10, '>'}}, // ► - BlackRightPointingPointer (1) + {{0x25c4, ',', 0x11, '<'}}, // ◄ - BlackLeftPointingPointer + {{0xe1b3, 'x', 0xb3, '|'}}, // │ - NF_border_line_vertical (2) + {{0xe1b4, 0, 0xb4, 0}}, // ⊐ - NF_rev_left_arrow2 (2) + {{0xe1b5, 0, 0xb5, 0}}, // ► - NF_rev_right_arrow2 (2) + {{0xe1b6, 0, 0xb6, 0}}, // ╵ - NF_border_line_left_up (2) + {{0xe1b7, 0, 0xb7, 0}}, // ) - NF_radio_button3 (2) + {{0xe1b8, 0, 0xb8, 0}}, // ⎤ - NF_rev_border_corner_upper_right (2) + {{0xe1b9, 0, 0xb9, 0}}, // ⎹ - NF_rev_border_line_right (2) + {{0xe1ba, 0, 0xba, 0}}, // ┤ - NF_rev_border_line_vertical_left (2) + {{0xe1bb, 0, 0xbb, 0}}, // ⎦ - NF_rev_border_corner_lower_right (2) + {{0xe1bc, 0, 0xbc, 0}}, // ⎸ - NF_border_line_left (2) + {{0xe1bd, 0, 0xbd, 0}}, //⎹◣ - NF_rev_up_arrow2 (2) + {{0xe1be, 0, 0xbe, 0}}, //⎹◤ - NF_rev_down_arrow2 (2) + {{0xe1bf, 0, 0xbf, 0}}, // ╷ - NF_border_line_left_down (2) + {{0xe1c0, 0, 0xc0, 0}}, // └ - NF_border_corner_middle_lower_left (2) + {{0xe1c1, 0, 0xc1, 0}}, // ◢⎸ - NF_rev_up_arrow1 (2) + {{0xe1c2, 0, 0xc2, 0}}, // ◥⎸ - NF_rev_down_arrow1 (2) + {{0xe1c3, 0, 0xc3, 0}}, // ├ - NF_border_line_vertical_right (2) + {{0xe1c4, 'q', 0xc4, '-'}}, // ─ - NF_border_line_horizontal (2) + {{0xe1c5, 0, 0xc5, 0}}, // = - NF_border_line_up_and_down (2) + {{0xe1c6, 0, 0xc6, 0}}, // = - NF_shadow_box_middle (2) + {{0xe1c7, 0, 0xc7, 0}}, // = - NF_shadow_box_hdd (2) + {{0xe1c8, 0, 0xc8, 0}}, // ◄ - NF_rev_left_arrow1 (2) + {{0xe1c9, 0, 0xc9, 0}}, // ⊏ - NF_rev_right_arrow1 (2) + {{0xe1ca, 0, 0xca, 0}}, // [ - NF_rev_menu_button1 (2) + {{0xe1cb, 0, 0xcb, 0}}, // - - NF_rev_menu_button2 (2) + {{0xe1cc, 0, 0xcc, 0}}, // ┌ - NF_border_corner_middle_upper_left (2) + {{0xe1cd, 0, 0xcd, 0}}, // = - NF_shadow_box_cd (2) + {{0xe1ce, 0, 0xce, 0}}, // [ - NF_shadow_box_left (2) + {{0xe1cf, 0, 0xcf, 0}}, // ┌ - NF_border_line_middle_left_down (2) + {{0xe1d0, 0, 0xd0, 0}}, // └ - NF_border_line_middle_right_up (2) + {{0xe1d1, 0, 0xd1, 0}}, // = - NF_shadow_box_net (2) + {{0xe1d2, 0, 0xd2, 0}}, // ◢ - NF_rev_up_pointing_triangle1 (2) + {{0xe1d3, 0, 0xd3, 0}}, // ⎣ - NF_border_corner_lower_left (2) + {{0xe1d4, 0, 0xd4, 0}}, // _ - NF_border_line_bottom (2) + {{0xe1d5, 0, 0xd5, 0}}, // O - NF_radio_button2 (2) + {{0xe1d6, 0, 0xd6, 0}}, // ● - NF_radio_button2_checked (2) + {{0xe1d7, 0, 0xd7, 0}}, // ◥ - NF_rev_down_pointing_triangle1 (2) + {{0xe1d8, 0, 0xd8, 0}}, // ¯ - NF_border_line_upper (2) + {{0xe1d9, 0, 0xd9, 0}}, // ( - NF_radio_button1 (2) + {{0xe1da, 0, 0xda, 0}}, // ⎡ - NF_border_corner_upper_left (2) + {{0xe1dc, 0, 0xdc, 0}}, // ✓ - NF_shadow_box_checked (2) + {{0xe1e7, 0, 0xe7, 0}}, // ║ - NF_rev_border_line_right_and_left (2) + {{0xe1e8, 0, 0xe8, 0}}, // ◣ - NF_rev_up_pointing_triangle2 (2) + {{0xe1e9, 0, 0xe9, 0}}, // ◤ - NF_rev_down_pointing_triangle2 (2) + {{0xe1ea, 0, 0xea, 0}}, // ┘ - NF_border_corner_middle_lower_right (2) + {{0xe1eb, 0, 0xeb, 0}}, // ┐ - NF_border_corner_middle_upper_right (2) + {{0xe1f4, 0, 0xf4, 0}}, // ] - NF_rev_menu_button3 (2) + {{0xe1f5, 0, 0xf5, 0}}, // ] - NF_shadow_box_right (2) + {{0xe1fb, 0, 0xfb, 0}}, // ✓ - NF_check_mark (2) + {{0xe1fc, '~', 0xfc, '`'}}, // ˣ - NF_xsuperior (2) + {{0x221a, 0, 0xfb, 'x'}} // √ - square root +}}; /* * (1) Not defined in Windows Glyph List 4 (WGL4) * (2) Only supported in use with newfont */ -constexpr std::size_t last_char_item = \ - std::size_t((sizeof(character) / sizeof(character[0])) - 1); +constexpr std::array, 39> vt100_key_to_utf8 = +{{ + {{fc::vt100_key_rarrow , fc::BlackRightPointingPointer}}, // ► + {{fc::vt100_key_larrow , fc::BlackLeftPointingPointer}}, // ◄ + {{fc::vt100_key_uarrow , fc::BlackUpPointingTriangle}}, // ▲ + {{fc::vt100_key_darrow , fc::BlackDownPointingTriangle}}, // ▼ + {{fc::vt100_key_block , fc::FullBlock}}, // █ + {{fc::vt100_key_nsup , fc::SuperscriptLatinSmallLetterN}}, // ⁿ + {{fc::vt100_key_blackrect, fc::BlackVerticalRectangle}}, // ▮ + {{fc::vt100_key_diamond , fc::BlackDiamondSuit}}, // ◆ + {{fc::vt100_key_ckboard , fc::MediumShade}}, // ▒ + {{fc::vt100_key_htab , fc::SymbolForHorizontalTab}}, // ␉ + {{fc::vt100_key_ff , fc::SymbolForFormFeed}}, // ␌ + {{fc::vt100_key_cr , fc::SymbolForCarriageReturn}}, // ␍ + {{fc::vt100_key_lf , fc::SymbolForLineFeed}}, // ␊ + {{fc::vt100_key_degree , fc::Degree}}, // ° + {{fc::vt100_key_plminus , fc::PlusMinus}}, // ± + {{fc::vt100_key_board , fc::SymbolForNewline}}, // ␤ + {{fc::vt100_key_lantern , fc::SymbolForVerticalTab}}, // ␋ + {{fc::vt100_key_lrcorner , fc::BoxDrawingsUpAndLeft}}, // ┘ + {{fc::vt100_key_urcorner , fc::BoxDrawingsDownAndLeft}}, // ┐ + {{fc::vt100_key_ulcorner , fc::BoxDrawingsDownAndRight}}, // ┌ + {{fc::vt100_key_llcorner , fc::BoxDrawingsUpAndRight}}, // └ + {{fc::vt100_key_plus , fc::BoxDrawingsCross}}, // ┼ + {{fc::vt100_key_s1 , fc::HorizontalScanLine1}}, // ⎺ + {{fc::vt100_key_s3 , fc::HorizontalScanLine3}}, // ⎻ + {{fc::vt100_key_hline , fc::BoxDrawingsHorizontal}}, // ─ + {{fc::vt100_key_s7 , fc::HorizontalScanLine7}}, // ⎼ + {{fc::vt100_key_s9 , fc::HorizontalScanLine9}}, // ⎽ + {{fc::vt100_key_ltee , fc::BoxDrawingsVerticalAndRight}}, // ├ + {{fc::vt100_key_rtee , fc::BoxDrawingsVerticalAndLeft}}, // ┤ + {{fc::vt100_key_btee , fc::BoxDrawingsUpAndHorizontal}}, // ┴ + {{fc::vt100_key_ttee , fc::BoxDrawingsDownAndHorizontal}}, // ┬ + {{fc::vt100_key_vline , fc::BoxDrawingsVertical}}, // │ + {{fc::vt100_key_lequal , fc::LessThanOrEqualTo}}, // ≤ + {{fc::vt100_key_gequal , fc::GreaterThanOrEqualTo}}, // ≥ + {{fc::vt100_key_pi , fc::Pi}}, // π + {{fc::vt100_key_nequal , fc::NotEqualTo}}, // ≠ + {{fc::vt100_key_sterling , fc::Pound}}, // £ + {{fc::vt100_key_bullet , fc::SmallBullet}}, // · + {{fc::vt100_key_diamond , fc::Bullet}} // ◆ +}}; - -constexpr int vt100_key_to_utf8[][2] = -{ - {fc::vt100_key_rarrow , fc::BlackRightPointingPointer}, // ► - {fc::vt100_key_larrow , fc::BlackLeftPointingPointer}, // ◄ - {fc::vt100_key_uarrow , fc::BlackUpPointingTriangle}, // ▲ - {fc::vt100_key_darrow , fc::BlackDownPointingTriangle}, // ▼ - {fc::vt100_key_block , fc::FullBlock}, // █ - {fc::vt100_key_nsup , fc::SuperscriptLatinSmallLetterN}, // ⁿ - {fc::vt100_key_blackrect, fc::BlackVerticalRectangle}, // ▮ - {fc::vt100_key_diamond , fc::BlackDiamondSuit}, // ◆ - {fc::vt100_key_ckboard , fc::MediumShade}, // ▒ - {fc::vt100_key_htab , fc::SymbolForHorizontalTab}, // ␉ - {fc::vt100_key_ff , fc::SymbolForFormFeed}, // ␌ - {fc::vt100_key_cr , fc::SymbolForCarriageReturn}, // ␍ - {fc::vt100_key_lf , fc::SymbolForLineFeed}, // ␊ - {fc::vt100_key_degree , fc::Degree}, // ° - {fc::vt100_key_plminus , fc::PlusMinus}, // ± - {fc::vt100_key_board , fc::SymbolForNewline}, // ␤ - {fc::vt100_key_lantern , fc::SymbolForVerticalTab}, // ␋ - {fc::vt100_key_lrcorner , fc::BoxDrawingsUpAndLeft}, // ┘ - {fc::vt100_key_urcorner , fc::BoxDrawingsDownAndLeft}, // ┐ - {fc::vt100_key_ulcorner , fc::BoxDrawingsDownAndRight}, // ┌ - {fc::vt100_key_llcorner , fc::BoxDrawingsUpAndRight}, // └ - {fc::vt100_key_plus , fc::BoxDrawingsCross}, // ┼ - {fc::vt100_key_s1 , fc::HorizontalScanLine1}, // ⎺ - {fc::vt100_key_s3 , fc::HorizontalScanLine3}, // ⎻ - {fc::vt100_key_hline , fc::BoxDrawingsHorizontal}, // ─ - {fc::vt100_key_s7 , fc::HorizontalScanLine7}, // ⎼ - {fc::vt100_key_s9 , fc::HorizontalScanLine9}, // ⎽ - {fc::vt100_key_ltee , fc::BoxDrawingsVerticalAndRight}, // ├ - {fc::vt100_key_rtee , fc::BoxDrawingsVerticalAndLeft}, // ┤ - {fc::vt100_key_btee , fc::BoxDrawingsUpAndHorizontal}, // ┴ - {fc::vt100_key_ttee , fc::BoxDrawingsDownAndHorizontal}, // ┬ - {fc::vt100_key_vline , fc::BoxDrawingsVertical}, // │ - {fc::vt100_key_lequal , fc::LessThanOrEqualTo}, // ≤ - {fc::vt100_key_gequal , fc::GreaterThanOrEqualTo}, // ≥ - {fc::vt100_key_pi , fc::Pi}, // π - {fc::vt100_key_nequal , fc::NotEqualTo}, // ≠ - {fc::vt100_key_sterling , fc::Pound}, // £ - {fc::vt100_key_bullet , fc::SmallBullet}, // · - {fc::vt100_key_diamond , fc::Bullet} // ◆ -}; - -constexpr std::size_t last_key_item = \ - std::size_t((sizeof(vt100_key_to_utf8) / sizeof(vt100_key_to_utf8[0])) - 1); - - -constexpr wchar_t cp437_ucs[][2] = -{ - {0x00, 0x0000}, // null - {0x01, 0x263a}, // white smiling face - {0x02, 0x263b}, // black smiling face - {0x03, 0x2665}, // black heart suit - {0x04, 0x2666}, // black diamond suit - {0x05, 0x2663}, // black club suit - {0x06, 0x2660}, // black spade suit - {0x07, 0x2022}, // bullet - {0x08, 0x25d8}, // inverse bullet - {0x09, 0x25cb}, // white circle - {0x0a, 0x25d9}, // inverse white circle - {0x0b, 0x2642}, // male sign - {0x0c, 0x2640}, // female sign - {0x0d, 0x266a}, // eighth note - {0x0e, 0x266b}, // beamed eighth notes - {0x0f, 0x263c}, // white sun with rays - {0x10, 0x25ba}, // black right-pointing pointer - {0x11, 0x25c4}, // black left-pointing pointer - {0x12, 0x2195}, // up down arrow - {0x13, 0x203c}, // double exclamation mark - {0x14, 0x00b6}, // pilcrow sign - {0x15, 0x00a7}, // section sign - {0x16, 0x25ac}, // black rectangle - {0x17, 0x21a8}, // up down arrow with base - {0x18, 0x2191}, // upwards arrow - {0x19, 0x2193}, // downwards arrow - {0x1a, 0x2192}, // rightwards arrow - {0x1b, 0x2190}, // leftwards arrow - {0x1c, 0x221f}, // right angle - {0x1d, 0x2194}, // left right arrow - {0x1e, 0x25b2}, // black up-pointing triangle - {0x1f, 0x25bc}, // black down-pointing triangle - {0x20, 0x0020}, // space - {0x21, 0x0021}, // exclamation mark - {0x22, 0x0022}, // quotation mark - {0x23, 0x0023}, // number sign - {0x24, 0x0024}, // dollar sign - {0x25, 0x0025}, // percent sign - {0x26, 0x0026}, // ampersand - {0x27, 0x0027}, // apostrophe - {0x28, 0x0028}, // left parenthesis - {0x29, 0x0029}, // right parenthesis - {0x2a, 0x002a}, // asterisk - {0x2b, 0x002b}, // plus sign - {0x2c, 0x002c}, // comma - {0x2d, 0x002d}, // hyphen-minus - {0x2e, 0x002e}, // full stop - {0x2f, 0x002f}, // solidus - {0x30, 0x0030}, // digit zero - {0x31, 0x0031}, // digit one - {0x32, 0x0032}, // digit two - {0x33, 0x0033}, // digit three - {0x34, 0x0034}, // digit four - {0x35, 0x0035}, // digit five - {0x36, 0x0036}, // digit six - {0x37, 0x0037}, // digit seven - {0x38, 0x0038}, // digit eight - {0x39, 0x0039}, // digit nine - {0x3a, 0x003a}, // colon - {0x3b, 0x003b}, // semicolon - {0x3c, 0x003c}, // less-than sign - {0x3d, 0x003d}, // equals sign - {0x3e, 0x003e}, // greater-than sign - {0x3f, 0x003f}, // question mark - {0x40, 0x0040}, // commercial at - {0x41, 0x0041}, // latin capital letter a - {0x42, 0x0042}, // latin capital letter b - {0x43, 0x0043}, // latin capital letter c - {0x44, 0x0044}, // latin capital letter d - {0x45, 0x0045}, // latin capital letter e - {0x46, 0x0046}, // latin capital letter f - {0x47, 0x0047}, // latin capital letter g - {0x48, 0x0048}, // latin capital letter h - {0x49, 0x0049}, // latin capital letter i - {0x4a, 0x004a}, // latin capital letter j - {0x4b, 0x004b}, // latin capital letter k - {0x4c, 0x004c}, // latin capital letter l - {0x4d, 0x004d}, // latin capital letter m - {0x4e, 0x004e}, // latin capital letter n - {0x4f, 0x004f}, // latin capital letter o - {0x50, 0x0050}, // latin capital letter p - {0x51, 0x0051}, // latin capital letter q - {0x52, 0x0052}, // latin capital letter r - {0x53, 0x0053}, // latin capital letter s - {0x54, 0x0054}, // latin capital letter t - {0x55, 0x0055}, // latin capital letter u - {0x56, 0x0056}, // latin capital letter v - {0x57, 0x0057}, // latin capital letter w - {0x58, 0x0058}, // latin capital letter x - {0x59, 0x0059}, // latin capital letter y - {0x5a, 0x005a}, // latin capital letter z - {0x5b, 0x005b}, // left square bracket - {0x5c, 0x005c}, // reverse solidus - {0x5d, 0x005d}, // right square bracket - {0x5e, 0x005e}, // circumflex accent - {0x5f, 0x005f}, // low line - {0x60, 0x0060}, // grave accent - {0x61, 0x0061}, // latin small letter a - {0x62, 0x0062}, // latin small letter b - {0x63, 0x0063}, // latin small letter c - {0x64, 0x0064}, // latin small letter d - {0x65, 0x0065}, // latin small letter e - {0x66, 0x0066}, // latin small letter f - {0x67, 0x0067}, // latin small letter g - {0x68, 0x0068}, // latin small letter h - {0x69, 0x0069}, // latin small letter i - {0x6a, 0x006a}, // latin small letter j - {0x6b, 0x006b}, // latin small letter k - {0x6c, 0x006c}, // latin small letter l - {0x6d, 0x006d}, // latin small letter m - {0x6e, 0x006e}, // latin small letter n - {0x6f, 0x006f}, // latin small letter o - {0x70, 0x0070}, // latin small letter p - {0x71, 0x0071}, // latin small letter q - {0x72, 0x0072}, // latin small letter r - {0x73, 0x0073}, // latin small letter s - {0x74, 0x0074}, // latin small letter t - {0x75, 0x0075}, // latin small letter u - {0x76, 0x0076}, // latin small letter v - {0x77, 0x0077}, // latin small letter w - {0x78, 0x0078}, // latin small letter x - {0x79, 0x0079}, // latin small letter y - {0x7a, 0x007a}, // latin small letter z - {0x7b, 0x007b}, // left curly bracket - {0x7c, 0x007c}, // vertical line - {0x7d, 0x007d}, // right curly bracket - {0x7e, 0x007e}, // tilde - {0x7f, 0x007f}, // house - {0x80, 0x00c7}, // latin capital letter c with cedilla - {0x81, 0x00fc}, // latin small letter u with diaeresis - {0x82, 0x00e9}, // latin small letter e with acute - {0x83, 0x00e2}, // latin small letter a with circumflex - {0x84, 0x00e4}, // latin small letter a with diaeresis - {0x85, 0x00e0}, // latin small letter a with grave - {0x86, 0x00e5}, // latin small letter a with ring above - {0x87, 0x00e7}, // latin small letter c with cedilla - {0x88, 0x00ea}, // latin small letter e with circumflex - {0x89, 0x00eb}, // latin small letter e with diaeresis - {0x8a, 0x00e8}, // latin small letter e with grave - {0x8b, 0x00ef}, // latin small letter i with diaeresis - {0x8c, 0x00ee}, // latin small letter i with circumflex - {0x8d, 0x00ec}, // latin small letter i with grave - {0x8e, 0x00c4}, // latin capital letter a with diaeresis - {0x8f, 0x00c5}, // latin capital letter a with ring above - {0x90, 0x00c9}, // latin capital letter e with acute - {0x91, 0x00e6}, // latin small ligature ae - {0x92, 0x00c6}, // latin capital ligature ae - {0x93, 0x00f4}, // latin small letter o with circumflex - {0x94, 0x00f6}, // latin small letter o with diaeresis - {0x95, 0x00f2}, // latin small letter o with grave - {0x96, 0x00fb}, // latin small letter u with circumflex - {0x97, 0x00f9}, // latin small letter u with grave - {0x98, 0x00ff}, // latin small letter y with diaeresis - {0x99, 0x00d6}, // latin capital letter o with diaeresis - {0x9a, 0x00dc}, // latin capital letter u with diaeresis - {0x9b, 0x00a2}, // cent sign - {0x9c, 0x00a3}, // pound sign - {0x9d, 0x00a5}, // yen sign - {0x9e, 0x20a7}, // peseta sign - {0x9f, 0x0192}, // latin small letter f with hook - {0xa0, 0x00e1}, // latin small letter a with acute - {0xa1, 0x00ed}, // latin small letter i with acute - {0xa2, 0x00f3}, // latin small letter o with acute - {0xa3, 0x00fa}, // latin small letter u with acute - {0xa4, 0x00f1}, // latin small letter n with tilde - {0xa5, 0x00d1}, // latin capital letter n with tilde - {0xa6, 0x00aa}, // feminine ordinal indicator - {0xa7, 0x00ba}, // masculine ordinal indicator - {0xa8, 0x00bf}, // inverted question mark - {0xa9, 0x2310}, // reversed not sign - {0xaa, 0x00ac}, // not sign - {0xab, 0x00bd}, // vulgar fraction one half - {0xac, 0x00bc}, // vulgar fraction one quarter - {0xad, 0x00a1}, // inverted exclamation mark - {0xae, 0x00ab}, // left-pointing double angle quotation mark - {0xaf, 0x00bb}, // right-pointing double angle quotation mark - {0xb0, 0x2591}, // light shade - {0xb1, 0x2592}, // medium shade - {0xb2, 0x2593}, // dark shade - {0xb3, 0x2502}, // box drawings light vertical - {0xb4, 0x2524}, // box drawings light vertical and left - {0xb5, 0x2561}, // box drawings vertical single and left double - {0xb6, 0x2562}, // box drawings vertical double and left single - {0xb7, 0x2556}, // box drawings down double and left single - {0xb8, 0x2555}, // box drawings down single and left double - {0xb9, 0x2563}, // box drawings double vertical and left - {0xba, 0x2551}, // box drawings double vertical - {0xbb, 0x2557}, // box drawings double down and left - {0xbc, 0x255d}, // box drawings double up and left - {0xbd, 0x255c}, // box drawings up double and left single - {0xbe, 0x255b}, // box drawings up single and left double - {0xbf, 0x2510}, // box drawings light down and left - {0xc0, 0x2514}, // box drawings light up and right - {0xc1, 0x2534}, // box drawings light up and horizontal - {0xc2, 0x252c}, // box drawings light down and horizontal - {0xc3, 0x251c}, // box drawings light vertical and right - {0xc4, 0x2500}, // box drawings light horizontal - {0xc5, 0x253c}, // box drawings light vertical and horizontal - {0xc6, 0x255e}, // box drawings vertical single and right double - {0xc7, 0x255f}, // box drawings vertical double and right single - {0xc8, 0x255a}, // box drawings double up and right - {0xc9, 0x2554}, // box drawings double down and right - {0xca, 0x2569}, // box drawings double up and horizontal - {0xcb, 0x2566}, // box drawings double down and horizontal - {0xcc, 0x2560}, // box drawings double vertical and right - {0xcd, 0x2550}, // box drawings double horizontal - {0xce, 0x256c}, // box drawings double vertical and horizontal - {0xcf, 0x2567}, // box drawings up single and horizontal double - {0xd0, 0x2568}, // box drawings up double and horizontal single - {0xd1, 0x2564}, // box drawings down single and horizontal double - {0xd2, 0x2565}, // box drawings down double and horizontal single - {0xd3, 0x2559}, // box drawings up double and right single - {0xd4, 0x2558}, // box drawings up single and right double - {0xd5, 0x2552}, // box drawings down single and right double - {0xd6, 0x2553}, // box drawings down double and right single - {0xd7, 0x256b}, // box drawings vertical double and horizontal single - {0xd8, 0x256a}, // box drawings vertical single and horizontal double - {0xd9, 0x2518}, // box drawings light up and left - {0xda, 0x250c}, // box drawings light down and right - {0xdb, 0x2588}, // full block - {0xdc, 0x2584}, // lower half block - {0xdd, 0x258c}, // left half block - {0xde, 0x2590}, // right half block - {0xdf, 0x2580}, // upper half block - {0xe0, 0x03b1}, // greek small letter alpha - {0xe1, 0x00df}, // latin small letter sharp s - {0xe2, 0x0393}, // greek capital letter gamma - {0xe3, 0x03c0}, // greek small letter pi - {0xe4, 0x03a3}, // greek capital letter sigma - {0xe5, 0x03c3}, // greek small letter sigma - {0xe6, 0x00b5}, // micro sign - {0xe7, 0x03c4}, // greek small letter tau - {0xe8, 0x03a6}, // greek capital letter phi - {0xe9, 0x0398}, // greek capital letter theta - {0xea, 0x03a9}, // greek capital letter omega - {0xeb, 0x03b4}, // greek small letter delta - {0xec, 0x221e}, // infinity - {0xed, 0x03c6}, // greek small letter phi - {0xee, 0x03b5}, // greek small letter epsilon - {0xef, 0x2229}, // intersection - {0xf0, 0x2261}, // identical to - {0xf1, 0x00b1}, // plus-minus sign - {0xf2, 0x2265}, // greater-than or equal to - {0xf3, 0x2264}, // less-than or equal to - {0xf4, 0x2320}, // top half integral - {0xf5, 0x2321}, // bottom half integral - {0xf6, 0x00f7}, // division sign - {0xf7, 0x2248}, // almost equal to - {0xf8, 0x00b0}, // degree sign - {0xf9, 0x2219}, // bullet operator - {0xfa, 0x00b7}, // middle dot - {0xfb, 0x221a}, // square root - {0xfc, 0x207f}, // superscript latin small letter n - {0xfd, 0x00b2}, // superscript two - {0xfe, 0x25a0}, // black square - {0xff, 0x00a0} // no-break space -}; - -constexpr std::size_t last_cp437_item = \ - std::size_t((sizeof(cp437_ucs) / sizeof(cp437_ucs[0])) - 1); +constexpr std::array, 256> cp437_ucs = +{{ + {{0x00, 0x0000}}, // null + {{0x01, 0x263a}}, // white smiling face + {{0x02, 0x263b}}, // black smiling face + {{0x03, 0x2665}}, // black heart suit + {{0x04, 0x2666}}, // black diamond suit + {{0x05, 0x2663}}, // black club suit + {{0x06, 0x2660}}, // black spade suit + {{0x07, 0x2022}}, // bullet + {{0x08, 0x25d8}}, // inverse bullet + {{0x09, 0x25cb}}, // white circle + {{0x0a, 0x25d9}}, // inverse white circle + {{0x0b, 0x2642}}, // male sign + {{0x0c, 0x2640}}, // female sign + {{0x0d, 0x266a}}, // eighth note + {{0x0e, 0x266b}}, // beamed eighth notes + {{0x0f, 0x263c}}, // white sun with rays + {{0x10, 0x25ba}}, // black right-pointing pointer + {{0x11, 0x25c4}}, // black left-pointing pointer + {{0x12, 0x2195}}, // up down arrow + {{0x13, 0x203c}}, // double exclamation mark + {{0x14, 0x00b6}}, // pilcrow sign + {{0x15, 0x00a7}}, // section sign + {{0x16, 0x25ac}}, // black rectangle + {{0x17, 0x21a8}}, // up down arrow with base + {{0x18, 0x2191}}, // upwards arrow + {{0x19, 0x2193}}, // downwards arrow + {{0x1a, 0x2192}}, // rightwards arrow + {{0x1b, 0x2190}}, // leftwards arrow + {{0x1c, 0x221f}}, // right angle + {{0x1d, 0x2194}}, // left right arrow + {{0x1e, 0x25b2}}, // black up-pointing triangle + {{0x1f, 0x25bc}}, // black down-pointing triangle + {{0x20, 0x0020}}, // space + {{0x21, 0x0021}}, // exclamation mark + {{0x22, 0x0022}}, // quotation mark + {{0x23, 0x0023}}, // number sign + {{0x24, 0x0024}}, // dollar sign + {{0x25, 0x0025}}, // percent sign + {{0x26, 0x0026}}, // ampersand + {{0x27, 0x0027}}, // apostrophe + {{0x28, 0x0028}}, // left parenthesis + {{0x29, 0x0029}}, // right parenthesis + {{0x2a, 0x002a}}, // asterisk + {{0x2b, 0x002b}}, // plus sign + {{0x2c, 0x002c}}, // comma + {{0x2d, 0x002d}}, // hyphen-minus + {{0x2e, 0x002e}}, // full stop + {{0x2f, 0x002f}}, // solidus + {{0x30, 0x0030}}, // digit zero + {{0x31, 0x0031}}, // digit one + {{0x32, 0x0032}}, // digit two + {{0x33, 0x0033}}, // digit three + {{0x34, 0x0034}}, // digit four + {{0x35, 0x0035}}, // digit five + {{0x36, 0x0036}}, // digit six + {{0x37, 0x0037}}, // digit seven + {{0x38, 0x0038}}, // digit eight + {{0x39, 0x0039}}, // digit nine + {{0x3a, 0x003a}}, // colon + {{0x3b, 0x003b}}, // semicolon + {{0x3c, 0x003c}}, // less-than sign + {{0x3d, 0x003d}}, // equals sign + {{0x3e, 0x003e}}, // greater-than sign + {{0x3f, 0x003f}}, // question mark + {{0x40, 0x0040}}, // commercial at + {{0x41, 0x0041}}, // latin capital letter a + {{0x42, 0x0042}}, // latin capital letter b + {{0x43, 0x0043}}, // latin capital letter c + {{0x44, 0x0044}}, // latin capital letter d + {{0x45, 0x0045}}, // latin capital letter e + {{0x46, 0x0046}}, // latin capital letter f + {{0x47, 0x0047}}, // latin capital letter g + {{0x48, 0x0048}}, // latin capital letter h + {{0x49, 0x0049}}, // latin capital letter i + {{0x4a, 0x004a}}, // latin capital letter j + {{0x4b, 0x004b}}, // latin capital letter k + {{0x4c, 0x004c}}, // latin capital letter l + {{0x4d, 0x004d}}, // latin capital letter m + {{0x4e, 0x004e}}, // latin capital letter n + {{0x4f, 0x004f}}, // latin capital letter o + {{0x50, 0x0050}}, // latin capital letter p + {{0x51, 0x0051}}, // latin capital letter q + {{0x52, 0x0052}}, // latin capital letter r + {{0x53, 0x0053}}, // latin capital letter s + {{0x54, 0x0054}}, // latin capital letter t + {{0x55, 0x0055}}, // latin capital letter u + {{0x56, 0x0056}}, // latin capital letter v + {{0x57, 0x0057}}, // latin capital letter w + {{0x58, 0x0058}}, // latin capital letter x + {{0x59, 0x0059}}, // latin capital letter y + {{0x5a, 0x005a}}, // latin capital letter z + {{0x5b, 0x005b}}, // left square bracket + {{0x5c, 0x005c}}, // reverse solidus + {{0x5d, 0x005d}}, // right square bracket + {{0x5e, 0x005e}}, // circumflex accent + {{0x5f, 0x005f}}, // low line + {{0x60, 0x0060}}, // grave accent + {{0x61, 0x0061}}, // latin small letter a + {{0x62, 0x0062}}, // latin small letter b + {{0x63, 0x0063}}, // latin small letter c + {{0x64, 0x0064}}, // latin small letter d + {{0x65, 0x0065}}, // latin small letter e + {{0x66, 0x0066}}, // latin small letter f + {{0x67, 0x0067}}, // latin small letter g + {{0x68, 0x0068}}, // latin small letter h + {{0x69, 0x0069}}, // latin small letter i + {{0x6a, 0x006a}}, // latin small letter j + {{0x6b, 0x006b}}, // latin small letter k + {{0x6c, 0x006c}}, // latin small letter l + {{0x6d, 0x006d}}, // latin small letter m + {{0x6e, 0x006e}}, // latin small letter n + {{0x6f, 0x006f}}, // latin small letter o + {{0x70, 0x0070}}, // latin small letter p + {{0x71, 0x0071}}, // latin small letter q + {{0x72, 0x0072}}, // latin small letter r + {{0x73, 0x0073}}, // latin small letter s + {{0x74, 0x0074}}, // latin small letter t + {{0x75, 0x0075}}, // latin small letter u + {{0x76, 0x0076}}, // latin small letter v + {{0x77, 0x0077}}, // latin small letter w + {{0x78, 0x0078}}, // latin small letter x + {{0x79, 0x0079}}, // latin small letter y + {{0x7a, 0x007a}}, // latin small letter z + {{0x7b, 0x007b}}, // left curly bracket + {{0x7c, 0x007c}}, // vertical line + {{0x7d, 0x007d}}, // right curly bracket + {{0x7e, 0x007e}}, // tilde + {{0x7f, 0x007f}}, // house + {{0x80, 0x00c7}}, // latin capital letter c with cedilla + {{0x81, 0x00fc}}, // latin small letter u with diaeresis + {{0x82, 0x00e9}}, // latin small letter e with acute + {{0x83, 0x00e2}}, // latin small letter a with circumflex + {{0x84, 0x00e4}}, // latin small letter a with diaeresis + {{0x85, 0x00e0}}, // latin small letter a with grave + {{0x86, 0x00e5}}, // latin small letter a with ring above + {{0x87, 0x00e7}}, // latin small letter c with cedilla + {{0x88, 0x00ea}}, // latin small letter e with circumflex + {{0x89, 0x00eb}}, // latin small letter e with diaeresis + {{0x8a, 0x00e8}}, // latin small letter e with grave + {{0x8b, 0x00ef}}, // latin small letter i with diaeresis + {{0x8c, 0x00ee}}, // latin small letter i with circumflex + {{0x8d, 0x00ec}}, // latin small letter i with grave + {{0x8e, 0x00c4}}, // latin capital letter a with diaeresis + {{0x8f, 0x00c5}}, // latin capital letter a with ring above + {{0x90, 0x00c9}}, // latin capital letter e with acute + {{0x91, 0x00e6}}, // latin small ligature ae + {{0x92, 0x00c6}}, // latin capital ligature ae + {{0x93, 0x00f4}}, // latin small letter o with circumflex + {{0x94, 0x00f6}}, // latin small letter o with diaeresis + {{0x95, 0x00f2}}, // latin small letter o with grave + {{0x96, 0x00fb}}, // latin small letter u with circumflex + {{0x97, 0x00f9}}, // latin small letter u with grave + {{0x98, 0x00ff}}, // latin small letter y with diaeresis + {{0x99, 0x00d6}}, // latin capital letter o with diaeresis + {{0x9a, 0x00dc}}, // latin capital letter u with diaeresis + {{0x9b, 0x00a2}}, // cent sign + {{0x9c, 0x00a3}}, // pound sign + {{0x9d, 0x00a5}}, // yen sign + {{0x9e, 0x20a7}}, // peseta sign + {{0x9f, 0x0192}}, // latin small letter f with hook + {{0xa0, 0x00e1}}, // latin small letter a with acute + {{0xa1, 0x00ed}}, // latin small letter i with acute + {{0xa2, 0x00f3}}, // latin small letter o with acute + {{0xa3, 0x00fa}}, // latin small letter u with acute + {{0xa4, 0x00f1}}, // latin small letter n with tilde + {{0xa5, 0x00d1}}, // latin capital letter n with tilde + {{0xa6, 0x00aa}}, // feminine ordinal indicator + {{0xa7, 0x00ba}}, // masculine ordinal indicator + {{0xa8, 0x00bf}}, // inverted question mark + {{0xa9, 0x2310}}, // reversed not sign + {{0xaa, 0x00ac}}, // not sign + {{0xab, 0x00bd}}, // vulgar fraction one half + {{0xac, 0x00bc}}, // vulgar fraction one quarter + {{0xad, 0x00a1}}, // inverted exclamation mark + {{0xae, 0x00ab}}, // left-pointing double angle quotation mark + {{0xaf, 0x00bb}}, // right-pointing double angle quotation mark + {{0xb0, 0x2591}}, // light shade + {{0xb1, 0x2592}}, // medium shade + {{0xb2, 0x2593}}, // dark shade + {{0xb3, 0x2502}}, // box drawings light vertical + {{0xb4, 0x2524}}, // box drawings light vertical and left + {{0xb5, 0x2561}}, // box drawings vertical single and left double + {{0xb6, 0x2562}}, // box drawings vertical double and left single + {{0xb7, 0x2556}}, // box drawings down double and left single + {{0xb8, 0x2555}}, // box drawings down single and left double + {{0xb9, 0x2563}}, // box drawings double vertical and left + {{0xba, 0x2551}}, // box drawings double vertical + {{0xbb, 0x2557}}, // box drawings double down and left + {{0xbc, 0x255d}}, // box drawings double up and left + {{0xbd, 0x255c}}, // box drawings up double and left single + {{0xbe, 0x255b}}, // box drawings up single and left double + {{0xbf, 0x2510}}, // box drawings light down and left + {{0xc0, 0x2514}}, // box drawings light up and right + {{0xc1, 0x2534}}, // box drawings light up and horizontal + {{0xc2, 0x252c}}, // box drawings light down and horizontal + {{0xc3, 0x251c}}, // box drawings light vertical and right + {{0xc4, 0x2500}}, // box drawings light horizontal + {{0xc5, 0x253c}}, // box drawings light vertical and horizontal + {{0xc6, 0x255e}}, // box drawings vertical single and right double + {{0xc7, 0x255f}}, // box drawings vertical double and right single + {{0xc8, 0x255a}}, // box drawings double up and right + {{0xc9, 0x2554}}, // box drawings double down and right + {{0xca, 0x2569}}, // box drawings double up and horizontal + {{0xcb, 0x2566}}, // box drawings double down and horizontal + {{0xcc, 0x2560}}, // box drawings double vertical and right + {{0xcd, 0x2550}}, // box drawings double horizontal + {{0xce, 0x256c}}, // box drawings double vertical and horizontal + {{0xcf, 0x2567}}, // box drawings up single and horizontal double + {{0xd0, 0x2568}}, // box drawings up double and horizontal single + {{0xd1, 0x2564}}, // box drawings down single and horizontal double + {{0xd2, 0x2565}}, // box drawings down double and horizontal single + {{0xd3, 0x2559}}, // box drawings up double and right single + {{0xd4, 0x2558}}, // box drawings up single and right double + {{0xd5, 0x2552}}, // box drawings down single and right double + {{0xd6, 0x2553}}, // box drawings down double and right single + {{0xd7, 0x256b}}, // box drawings vertical double and horizontal single + {{0xd8, 0x256a}}, // box drawings vertical single and horizontal double + {{0xd9, 0x2518}}, // box drawings light up and left + {{0xda, 0x250c}}, // box drawings light down and right + {{0xdb, 0x2588}}, // full block + {{0xdc, 0x2584}}, // lower half block + {{0xdd, 0x258c}}, // left half block + {{0xde, 0x2590}}, // right half block + {{0xdf, 0x2580}}, // upper half block + {{0xe0, 0x03b1}}, // greek small letter alpha + {{0xe1, 0x00df}}, // latin small letter sharp s + {{0xe2, 0x0393}}, // greek capital letter gamma + {{0xe3, 0x03c0}}, // greek small letter pi + {{0xe4, 0x03a3}}, // greek capital letter sigma + {{0xe5, 0x03c3}}, // greek small letter sigma + {{0xe6, 0x00b5}}, // micro sign + {{0xe7, 0x03c4}}, // greek small letter tau + {{0xe8, 0x03a6}}, // greek capital letter phi + {{0xe9, 0x0398}}, // greek capital letter theta + {{0xea, 0x03a9}}, // greek capital letter omega + {{0xeb, 0x03b4}}, // greek small letter delta + {{0xec, 0x221e}}, // infinity + {{0xed, 0x03c6}}, // greek small letter phi + {{0xee, 0x03b5}}, // greek small letter epsilon + {{0xef, 0x2229}}, // intersection + {{0xf0, 0x2261}}, // identical to + {{0xf1, 0x00b1}}, // plus-minus sign + {{0xf2, 0x2265}}, // greater-than or equal to + {{0xf3, 0x2264}}, // less-than or equal to + {{0xf4, 0x2320}}, // top half integral + {{0xf5, 0x2321}}, // bottom half integral + {{0xf6, 0x00f7}}, // division sign + {{0xf7, 0x2248}}, // almost equal to + {{0xf8, 0x00b0}}, // degree sign + {{0xf9, 0x2219}}, // bullet operator + {{0xfa, 0x00b7}}, // middle dot + {{0xfb, 0x221a}}, // square root + {{0xfc, 0x207f}}, // superscript latin small letter n + {{0xfd, 0x00b2}}, // superscript two + {{0xfe, 0x25a0}}, // black square + {{0xff, 0x00a0}} // no-break space +}}; // Based on http://www.unicode.org/charts/PDF/UFF00.pdf -constexpr wchar_t halfwidth_fullwidth[][2] = -{ +constexpr std::array, 227> halfwidth_fullwidth = +{{ // Fullwidth ASCII variants - {0x0020, 0x3000}, // ' ' -> ' ' - {0x0021, 0xff01}, // ! -> ! - {0x0022, 0xff02}, // " -> " - {0x0023, 0xff03}, // # -> # - {0x0024, 0xff04}, // $ -> $ - {0x0025, 0xff05}, // % -> % - {0x0026, 0xff06}, // & -> & - {0x0027, 0xff07}, // ' -> ' - {0x0028, 0xff08}, // ( -> ( - {0x0029, 0xff09}, // ) -> ) - {0x002a, 0xff0a}, // * -> * - {0x002b, 0xff0b}, // + -> + - {0x002c, 0xff0c}, // , -> , - {0x002d, 0xff0d}, // - -> - - {0x002e, 0xff0e}, // . -> . - {0x002f, 0xff0f}, // / -> / - {0x0030, 0xff10}, // 0 -> 0 - {0x0031, 0xff11}, // 1 -> 1 - {0x0032, 0xff12}, // 2 -> 2 - {0x0033, 0xff13}, // 3 -> 3 - {0x0034, 0xff14}, // 4 -> 4 - {0x0035, 0xff15}, // 5 -> 5 - {0x0036, 0xff16}, // 6 -> 6 - {0x0037, 0xff17}, // 7 -> 7 - {0x0038, 0xff18}, // 8 -> 8 - {0x0039, 0xff19}, // 9 -> 9 - {0x003a, 0xff1a}, // : -> : - {0x003b, 0xff1b}, // ; -> ; - {0x003c, 0xff1c}, // < -> < - {0x003d, 0xff1d}, // = -> = - {0x003e, 0xff1e}, // > -> > - {0x003f, 0xff1f}, // ? -> ? - {0x0040, 0xff20}, // @ -> @ - {0x0041, 0xff21}, // A -> A - {0x0042, 0xff22}, // B -> B - {0x0043, 0xff23}, // C -> C - {0x0044, 0xff24}, // D -> D - {0x0045, 0xff25}, // E -> E - {0x0046, 0xff26}, // F -> F - {0x0047, 0xff27}, // G -> G - {0x0048, 0xff28}, // H -> H - {0x0049, 0xff29}, // I -> I - {0x004a, 0xff2a}, // J -> J - {0x004b, 0xff2b}, // K -> K - {0x004c, 0xff2c}, // L -> L - {0x004d, 0xff2d}, // M -> M - {0x004e, 0xff2e}, // N -> N - {0x004f, 0xff2f}, // O -> O - {0x0050, 0xff30}, // P -> P - {0x0051, 0xff31}, // Q -> Q - {0x0052, 0xff32}, // R -> R - {0x0053, 0xff33}, // S -> S - {0x0054, 0xff34}, // T -> T - {0x0055, 0xff35}, // U -> U - {0x0056, 0xff36}, // V -> V - {0x0057, 0xff37}, // W -> W - {0x0058, 0xff38}, // X -> X - {0x0059, 0xff39}, // Y -> Y - {0x005a, 0xff3a}, // Z -> Z - {0x005b, 0xff3b}, // [ -> [ - {0x005c, 0xff3c}, // \ -> \ - {0x005d, 0xff3c}, // ] -> ] - {0x005e, 0xff3e}, // ^ -> ^ - {0x005f, 0xff3f}, // _ -> _ - {0x0060, 0xff40}, // ` -> ` - {0x0061, 0xff41}, // a -> a - {0x0062, 0xff42}, // b -> b - {0x0063, 0xff43}, // c -> c - {0x0064, 0xff44}, // d -> d - {0x0065, 0xff45}, // e -> e - {0x0066, 0xff46}, // f -> f - {0x0067, 0xff47}, // g -> g - {0x0068, 0xff48}, // h -> h - {0x0069, 0xff49}, // i -> i - {0x006a, 0xff4a}, // j -> j - {0x006b, 0xff4b}, // k -> k - {0x006c, 0xff4c}, // l -> l - {0x006d, 0xff4d}, // m -> m - {0x006e, 0xff4e}, // n -> n - {0x006f, 0xff4f}, // o -> o - {0x0070, 0xff50}, // p -> p - {0x0071, 0xff51}, // q -> q - {0x0072, 0xff52}, // r -> r - {0x0073, 0xff53}, // s -> s - {0x0074, 0xff54}, // t -> t - {0x0075, 0xff55}, // u -> u - {0x0076, 0xff56}, // v -> v - {0x0077, 0xff57}, // w -> w - {0x0078, 0xff58}, // x -> x - {0x0079, 0xff59}, // y -> y - {0x007a, 0xff5a}, // z -> z - {0x007b, 0xff5b}, // { -> { - {0x007c, 0xff5c}, // | -> | - {0x007d, 0xff5d}, // } -> } - {0x007e, 0xff5e}, // ~ -> ~ - {0x007e, 0x0301}, // ~ -> 〜 + {{0x0020, 0x3000}}, // ' ' -> ' ' + {{0x0021, 0xff01}}, // ! -> ! + {{0x0022, 0xff02}}, // " -> " + {{0x0023, 0xff03}}, // # -> # + {{0x0024, 0xff04}}, // $ -> $ + {{0x0025, 0xff05}}, // % -> % + {{0x0026, 0xff06}}, // & -> & + {{0x0027, 0xff07}}, // ' -> ' + {{0x0028, 0xff08}}, // ( -> ( + {{0x0029, 0xff09}}, // ) -> ) + {{0x002a, 0xff0a}}, // * -> * + {{0x002b, 0xff0b}}, // + -> + + {{0x002c, 0xff0c}}, // , -> , + {{0x002d, 0xff0d}}, // - -> - + {{0x002e, 0xff0e}}, // . -> . + {{0x002f, 0xff0f}}, // / -> / + {{0x0030, 0xff10}}, // 0 -> 0 + {{0x0031, 0xff11}}, // 1 -> 1 + {{0x0032, 0xff12}}, // 2 -> 2 + {{0x0033, 0xff13}}, // 3 -> 3 + {{0x0034, 0xff14}}, // 4 -> 4 + {{0x0035, 0xff15}}, // 5 -> 5 + {{0x0036, 0xff16}}, // 6 -> 6 + {{0x0037, 0xff17}}, // 7 -> 7 + {{0x0038, 0xff18}}, // 8 -> 8 + {{0x0039, 0xff19}}, // 9 -> 9 + {{0x003a, 0xff1a}}, // : -> : + {{0x003b, 0xff1b}}, // ; -> ; + {{0x003c, 0xff1c}}, // < -> < + {{0x003d, 0xff1d}}, // = -> = + {{0x003e, 0xff1e}}, // > -> > + {{0x003f, 0xff1f}}, // ? -> ? + {{0x0040, 0xff20}}, // @ -> @ + {{0x0041, 0xff21}}, // A -> A + {{0x0042, 0xff22}}, // B -> B + {{0x0043, 0xff23}}, // C -> C + {{0x0044, 0xff24}}, // D -> D + {{0x0045, 0xff25}}, // E -> E + {{0x0046, 0xff26}}, // F -> F + {{0x0047, 0xff27}}, // G -> G + {{0x0048, 0xff28}}, // H -> H + {{0x0049, 0xff29}}, // I -> I + {{0x004a, 0xff2a}}, // J -> J + {{0x004b, 0xff2b}}, // K -> K + {{0x004c, 0xff2c}}, // L -> L + {{0x004d, 0xff2d}}, // M -> M + {{0x004e, 0xff2e}}, // N -> N + {{0x004f, 0xff2f}}, // O -> O + {{0x0050, 0xff30}}, // P -> P + {{0x0051, 0xff31}}, // Q -> Q + {{0x0052, 0xff32}}, // R -> R + {{0x0053, 0xff33}}, // S -> S + {{0x0054, 0xff34}}, // T -> T + {{0x0055, 0xff35}}, // U -> U + {{0x0056, 0xff36}}, // V -> V + {{0x0057, 0xff37}}, // W -> W + {{0x0058, 0xff38}}, // X -> X + {{0x0059, 0xff39}}, // Y -> Y + {{0x005a, 0xff3a}}, // Z -> Z + {{0x005b, 0xff3b}}, // [ -> [ + {{0x005c, 0xff3c}}, // \ -> \ + {{0x005d, 0xff3c}}, // ] -> ] + {{0x005e, 0xff3e}}, // ^ -> ^ + {{0x005f, 0xff3f}}, // _ -> _ + {{0x0060, 0xff40}}, // ` -> ` + {{0x0061, 0xff41}}, // a -> a + {{0x0062, 0xff42}}, // b -> b + {{0x0063, 0xff43}}, // c -> c + {{0x0064, 0xff44}}, // d -> d + {{0x0065, 0xff45}}, // e -> e + {{0x0066, 0xff46}}, // f -> f + {{0x0067, 0xff47}}, // g -> g + {{0x0068, 0xff48}}, // h -> h + {{0x0069, 0xff49}}, // i -> i + {{0x006a, 0xff4a}}, // j -> j + {{0x006b, 0xff4b}}, // k -> k + {{0x006c, 0xff4c}}, // l -> l + {{0x006d, 0xff4d}}, // m -> m + {{0x006e, 0xff4e}}, // n -> n + {{0x006f, 0xff4f}}, // o -> o + {{0x0070, 0xff50}}, // p -> p + {{0x0071, 0xff51}}, // q -> q + {{0x0072, 0xff52}}, // r -> r + {{0x0073, 0xff53}}, // s -> s + {{0x0074, 0xff54}}, // t -> t + {{0x0075, 0xff55}}, // u -> u + {{0x0076, 0xff56}}, // v -> v + {{0x0077, 0xff57}}, // w -> w + {{0x0078, 0xff58}}, // x -> x + {{0x0079, 0xff59}}, // y -> y + {{0x007a, 0xff5a}}, // z -> z + {{0x007b, 0xff5b}}, // { -> { + {{0x007c, 0xff5c}}, // | -> | + {{0x007d, 0xff5d}}, // } -> } + {{0x007e, 0xff5e}}, // ~ -> ~ + {{0x007e, 0x0301}}, // ~ -> 〜 // Fullwidth brackets - {0xff5f, 0x2e28}, // ⦅ -> ⸨ - {0xff60, 0x2e29}, // ⦆ -> ⸩ + {{0xff5f, 0x2e28}}, // ⦅ -> ⸨ + {{0xff60, 0x2e29}}, // ⦆ -> ⸩ // Halfwidth CJK punctuation - {0xff61, 0x3002}, // 。 -> 。 - {0xff62, 0x300c}, // 「 -> 「 - {0xff63, 0x300d}, // 」 -> 」 - {0xff64, 0x3001}, // 、 -> 、 + {{0xff61, 0x3002}}, // 。 -> 。 + {{0xff62, 0x300c}}, // 「 -> 「 + {{0xff63, 0x300d}}, // 」 -> 」 + {{0xff64, 0x3001}}, // 、 -> 、 // Halfwidth Katakana variants - {0xff65, 0x30fb}, // ・ -> ・ - {0xff66, 0x30f2}, // ヲ -> ヲ - {0xff67, 0x30a1}, // ァ -> ァ - {0xff68, 0x30a3}, // ィ -> ィ - {0xff69, 0x30a5}, // ゥ -> ゥ - {0xff6a, 0x30a7}, // ェ -> ェ - {0xff6b, 0x30a9}, // ォ -> ォ - {0xff6c, 0x30e3}, // ャ -> ャ - {0xff6d, 0x30e5}, // ュ -> ュ - {0xff6e, 0x30e7}, // ョ -> ョ - {0xff6f, 0x30c3}, // ッ -> ッ - {0xff70, 0x30fc}, // ー -> ー - {0xff71, 0x30a2}, // ア -> ア - {0xff72, 0x30a4}, // イ -> イ - {0xff73, 0x30a6}, // ウ -> ウ - {0xff74, 0x30a8}, // エ -> エ - {0xff75, 0x30aa}, // オ -> オ - {0xff76, 0x30ab}, // カ -> カ - {0xff77, 0x30ad}, // キ -> キ - {0xff78, 0x30af}, // ク -> ク - {0xff79, 0x30b1}, // ケ -> ケ - {0xff7a, 0x30b3}, // コ -> コ - {0xff7b, 0x30b5}, // サ -> サ - {0xff7c, 0x30b7}, // シ -> シ - {0xff7d, 0x30b9}, // ス -> ス - {0xff7e, 0x30bb}, // セ -> セ - {0xff7f, 0x30bd}, // ソ -> ソ - {0xff80, 0x30bf}, // タ -> タ - {0xff81, 0x30c1}, // チ -> チ - {0xff82, 0x30c4}, // ツ -> ツ - {0xff83, 0x30c6}, // テ -> テ - {0xff84, 0x30c8}, // ト -> ト - {0xff85, 0x30ca}, // ナ -> ナ - {0xff86, 0x30cb}, // ニ -> ニ - {0xff87, 0x30cc}, // ヌ -> ヌ - {0xff88, 0x30cd}, // ネ -> ネ - {0xff89, 0x30ce}, // ノ -> ノ - {0xff8a, 0x30cf}, // ハ -> ハ - {0xff8b, 0x30d2}, // ヒ -> ヒ - {0xff8c, 0x30d5}, // フ -> フ - {0xff8d, 0x30d8}, // ヘ -> ヘ - {0xff8e, 0x30db}, // ホ -> ホ - {0xff8f, 0x30de}, // マ -> マ - {0xff90, 0x30df}, // ミ -> ミ - {0xff91, 0x30e0}, // ム -> ム - {0xff92, 0x30e1}, // メ -> メ - {0xff93, 0x30e2}, // モ -> モ - {0xff94, 0x30e4}, // ヤ -> ヤ - {0xff95, 0x30e6}, // ユ -> ユ - {0xff96, 0x30e8}, // ヨ -> ヨ - {0xff97, 0x30e9}, // ラ -> ラ - {0xff98, 0x30ea}, // リ -> リ - {0xff99, 0x30eb}, // ル -> ル - {0xff9a, 0x30ec}, // レ -> レ - {0xff9b, 0x30ed}, // ロ -> ロ - {0xff9c, 0x30ef}, // ワ -> ワ - {0xff9d, 0x30f3}, // ン -> ン - {0xff9e, 0x3099}, // ゙ -> ゙ - {0xff9f, 0x309a}, // ゚ -> ゚ + {{0xff65, 0x30fb}}, // ・ -> ・ + {{0xff66, 0x30f2}}, // ヲ -> ヲ + {{0xff67, 0x30a1}}, // ァ -> ァ + {{0xff68, 0x30a3}}, // ィ -> ィ + {{0xff69, 0x30a5}}, // ゥ -> ゥ + {{0xff6a, 0x30a7}}, // ェ -> ェ + {{0xff6b, 0x30a9}}, // ォ -> ォ + {{0xff6c, 0x30e3}}, // ャ -> ャ + {{0xff6d, 0x30e5}}, // ュ -> ュ + {{0xff6e, 0x30e7}}, // ョ -> ョ + {{0xff6f, 0x30c3}}, // ッ -> ッ + {{0xff70, 0x30fc}}, // ー -> ー + {{0xff71, 0x30a2}}, // ア -> ア + {{0xff72, 0x30a4}}, // イ -> イ + {{0xff73, 0x30a6}}, // ウ -> ウ + {{0xff74, 0x30a8}}, // エ -> エ + {{0xff75, 0x30aa}}, // オ -> オ + {{0xff76, 0x30ab}}, // カ -> カ + {{0xff77, 0x30ad}}, // キ -> キ + {{0xff78, 0x30af}}, // ク -> ク + {{0xff79, 0x30b1}}, // ケ -> ケ + {{0xff7a, 0x30b3}}, // コ -> コ + {{0xff7b, 0x30b5}}, // サ -> サ + {{0xff7c, 0x30b7}}, // シ -> シ + {{0xff7d, 0x30b9}}, // ス -> ス + {{0xff7e, 0x30bb}}, // セ -> セ + {{0xff7f, 0x30bd}}, // ソ -> ソ + {{0xff80, 0x30bf}}, // タ -> タ + {{0xff81, 0x30c1}}, // チ -> チ + {{0xff82, 0x30c4}}, // ツ -> ツ + {{0xff83, 0x30c6}}, // テ -> テ + {{0xff84, 0x30c8}}, // ト -> ト + {{0xff85, 0x30ca}}, // ナ -> ナ + {{0xff86, 0x30cb}}, // ニ -> ニ + {{0xff87, 0x30cc}}, // ヌ -> ヌ + {{0xff88, 0x30cd}}, // ネ -> ネ + {{0xff89, 0x30ce}}, // ノ -> ノ + {{0xff8a, 0x30cf}}, // ハ -> ハ + {{0xff8b, 0x30d2}}, // ヒ -> ヒ + {{0xff8c, 0x30d5}}, // フ -> フ + {{0xff8d, 0x30d8}}, // ヘ -> ヘ + {{0xff8e, 0x30db}}, // ホ -> ホ + {{0xff8f, 0x30de}}, // マ -> マ + {{0xff90, 0x30df}}, // ミ -> ミ + {{0xff91, 0x30e0}}, // ム -> ム + {{0xff92, 0x30e1}}, // メ -> メ + {{0xff93, 0x30e2}}, // モ -> モ + {{0xff94, 0x30e4}}, // ヤ -> ヤ + {{0xff95, 0x30e6}}, // ユ -> ユ + {{0xff96, 0x30e8}}, // ヨ -> ヨ + {{0xff97, 0x30e9}}, // ラ -> ラ + {{0xff98, 0x30ea}}, // リ -> リ + {{0xff99, 0x30eb}}, // ル -> ル + {{0xff9a, 0x30ec}}, // レ -> レ + {{0xff9b, 0x30ed}}, // ロ -> ロ + {{0xff9c, 0x30ef}}, // ワ -> ワ + {{0xff9d, 0x30f3}}, // ン -> ン + {{0xff9e, 0x3099}}, // ゙ -> ゙ + {{0xff9f, 0x309a}}, // ゚ -> ゚ // Halfwidth Hangul variants - {0xffa0, 0x3164}, // ᅠ-> ᅠ - {0xffa1, 0x3131}, // ᄀ -> ㄱ - {0xffa2, 0x3132}, // ᄁ -> ㄲ - {0xffa3, 0x3133}, // ᆪ -> ㄳ - {0xffa4, 0x3134}, // ᄂ -> ㄴ - {0xffa5, 0x3135}, // ᆬ -> ㄵ - {0xffa6, 0x3136}, // ᆭ -> ㄶ - {0xffa7, 0x3137}, // ᄃ -> ㄷ - {0xffa8, 0x3138}, // ᄄ -> ㄸ - {0xffa9, 0x3139}, // ᄅ -> ㄹ - {0xffaa, 0x313a}, // ᆰ -> ㄺ - {0xffab, 0x313b}, // ᆱ -> ㄻ - {0xffac, 0x313c}, // ᆲ -> ㄼ - {0xffad, 0x313d}, // ᆳ -> ㄽ - {0xffae, 0x313e}, // ᆴ -> ㄾ - {0xffaf, 0x313f}, // ᆵ -> ㄿ - {0xffb0, 0x3140}, // ᄚ -> ㅀ - {0xffb1, 0x3141}, // ᄆ -> ㅁ - {0xffb2, 0x3142}, // ᄇ -> ㅂ - {0xffb3, 0x3143}, // ᄈ -> ㅃ - {0xffb4, 0x3144}, // ᄡ -> ㅄ - {0xffb5, 0x3145}, // ᄉ -> ㅅ - {0xffb6, 0x3146}, // ᄊ -> ㅆ - {0xffb7, 0x3147}, // ᄋ -> ㅇ - {0xffb8, 0x3148}, // ᄌ -> ㅈ - {0xffb9, 0x3149}, // ᄍ -> ㅉ - {0xffba, 0x314a}, // ᄎ -> ㅊ - {0xffbb, 0x314b}, // ᄏ -> ㅋ - {0xffbc, 0x314c}, // ᄐ -> ㅌ - {0xffbd, 0x314d}, // ᄑ -> ㅍ - {0xffbe, 0x314e}, // ᄒ -> ㅎ - {0xffc2, 0x314f}, // ᅡ -> ㅏ - {0xffc3, 0x3150}, // ᅢ -> ㅐ - {0xffc4, 0x3151}, // ᅣ -> ㅑ - {0xffc5, 0x3152}, // ᅤ -> ㅒ - {0xffc6, 0x3153}, // ᅥ -> ㅓ - {0xffc7, 0x3154}, // ᅦ -> ㅔ - {0xffca, 0x3155}, // ᅧ -> ㅕ - {0xffcb, 0x3156}, // ᅨ -> ㅖ - {0xffcc, 0x3157}, // ᅩ -> ㅗ - {0xffcd, 0x3158}, // ᅪ -> ㅘ - {0xffce, 0x3159}, // ᅫ -> ㅙ - {0xffcf, 0x315a}, // ᅬ -> ㅚ - {0xffd2, 0x315b}, // ᅭ -> ㅛ - {0xffd3, 0x315c}, // ᅮ -> ㅜ - {0xffd4, 0x315d}, // ᅯ -> ㅝ - {0xffd5, 0x315e}, // ᅰ -> ㅞ - {0xffd6, 0x315f}, // ᅱ -> ㅟ - {0xffd7, 0x3160}, // ᅲ -> ㅠ - {0xffda, 0x3161}, // ᅳ -> ㅡ - {0xffdb, 0x3162}, // ᅴ -> ㅢ - {0xffdc, 0x3163}, // ᅵ -> ㅣ + {{0xffa0, 0x3164}}, // ᅠ-> ᅠ + {{0xffa1, 0x3131}}, // ᄀ -> ㄱ + {{0xffa2, 0x3132}}, // ᄁ -> ㄲ + {{0xffa3, 0x3133}}, // ᆪ -> ㄳ + {{0xffa4, 0x3134}}, // ᄂ -> ㄴ + {{0xffa5, 0x3135}}, // ᆬ -> ㄵ + {{0xffa6, 0x3136}}, // ᆭ -> ㄶ + {{0xffa7, 0x3137}}, // ᄃ -> ㄷ + {{0xffa8, 0x3138}}, // ᄄ -> ㄸ + {{0xffa9, 0x3139}}, // ᄅ -> ㄹ + {{0xffaa, 0x313a}}, // ᆰ -> ㄺ + {{0xffab, 0x313b}}, // ᆱ -> ㄻ + {{0xffac, 0x313c}}, // ᆲ -> ㄼ + {{0xffad, 0x313d}}, // ᆳ -> ㄽ + {{0xffae, 0x313e}}, // ᆴ -> ㄾ + {{0xffaf, 0x313f}}, // ᆵ -> ㄿ + {{0xffb0, 0x3140}}, // ᄚ -> ㅀ + {{0xffb1, 0x3141}}, // ᄆ -> ㅁ + {{0xffb2, 0x3142}}, // ᄇ -> ㅂ + {{0xffb3, 0x3143}}, // ᄈ -> ㅃ + {{0xffb4, 0x3144}}, // ᄡ -> ㅄ + {{0xffb5, 0x3145}}, // ᄉ -> ㅅ + {{0xffb6, 0x3146}}, // ᄊ -> ㅆ + {{0xffb7, 0x3147}}, // ᄋ -> ㅇ + {{0xffb8, 0x3148}}, // ᄌ -> ㅈ + {{0xffb9, 0x3149}}, // ᄍ -> ㅉ + {{0xffba, 0x314a}}, // ᄎ -> ㅊ + {{0xffbb, 0x314b}}, // ᄏ -> ㅋ + {{0xffbc, 0x314c}}, // ᄐ -> ㅌ + {{0xffbd, 0x314d}}, // ᄑ -> ㅍ + {{0xffbe, 0x314e}}, // ᄒ -> ㅎ + {{0xffc2, 0x314f}}, // ᅡ -> ㅏ + {{0xffc3, 0x3150}}, // ᅢ -> ㅐ + {{0xffc4, 0x3151}}, // ᅣ -> ㅑ + {{0xffc5, 0x3152}}, // ᅤ -> ㅒ + {{0xffc6, 0x3153}}, // ᅥ -> ㅓ + {{0xffc7, 0x3154}}, // ᅦ -> ㅔ + {{0xffca, 0x3155}}, // ᅧ -> ㅕ + {{0xffcb, 0x3156}}, // ᅨ -> ㅖ + {{0xffcc, 0x3157}}, // ᅩ -> ㅗ + {{0xffcd, 0x3158}}, // ᅪ -> ㅘ + {{0xffce, 0x3159}}, // ᅫ -> ㅙ + {{0xffcf, 0x315a}}, // ᅬ -> ㅚ + {{0xffd2, 0x315b}}, // ᅭ -> ㅛ + {{0xffd3, 0x315c}}, // ᅮ -> ㅜ + {{0xffd4, 0x315d}}, // ᅯ -> ㅝ + {{0xffd5, 0x315e}}, // ᅰ -> ㅞ + {{0xffd6, 0x315f}}, // ᅱ -> ㅟ + {{0xffd7, 0x3160}}, // ᅲ -> ㅠ + {{0xffda, 0x3161}}, // ᅳ -> ㅡ + {{0xffdb, 0x3162}}, // ᅴ -> ㅢ + {{0xffdc, 0x3163}}, // ᅵ -> ㅣ // Fullwidth symbol variants - {0x00a2, 0xffe0}, // ¢ -> ¢ - {0x00a3, 0xffe1}, // £ -> £ - {0x00ac, 0xffe2}, // ¬ -> ¬ - {0x00af, 0xffe3}, // ¯ ->  ̄ - {0x00a6, 0xffe4}, // ¦ -> ¦ - {0x00a5, 0xffe5}, // ¥ -> ¥ - {0x20a9, 0xffe6}, // ₩ -> ₩ + {{0x00a2, 0xffe0}}, // ¢ -> ¢ + {{0x00a3, 0xffe1}}, // £ -> £ + {{0x00ac, 0xffe2}}, // ¬ -> ¬ + {{0x00af, 0xffe3}}, // ¯ ->  ̄ + {{0x00a6, 0xffe4}}, // ¦ -> ¦ + {{0x00a5, 0xffe5}}, // ¥ -> ¥ + {{0x20a9, 0xffe6}}, // ₩ -> ₩ // Halfwidth symbol variants - {0xffe8, 0x2502}, // │ -> │ - {0xffe9, 0x2190}, // ← -> ← - {0xffea, 0x2191}, // ↑ -> ↑ - {0xffeb, 0x2192}, // → -> → - {0xffec, 0x2193}, // ↓ -> ↓ - {0xffed, 0x25a0}, // ■ -> ■ - {0xffee, 0x25cb} // ○ -> ○ -}; - -constexpr std::size_t last_halfwidth_item = \ - std::size_t((sizeof(halfwidth_fullwidth) / sizeof(halfwidth_fullwidth[0])) - 1); + {{0xffe8, 0x2502}}, // │ -> │ + {{0xffe9, 0x2190}}, // ← -> ← + {{0xffea, 0x2191}}, // ↑ -> ↑ + {{0xffeb, 0x2192}}, // → -> → + {{0xffec, 0x2193}}, // ↓ -> ↓ + {{0xffed, 0x25a0}}, // ■ -> ■ + {{0xffee, 0x25cb}} // ○ -> ○ +}}; } // namespace fc diff --git a/src/fdialog.cpp b/src/fdialog.cpp index 1a300d1c..5ec74e93 100644 --- a/src/fdialog.cpp +++ b/src/fdialog.cpp @@ -282,7 +282,16 @@ void FDialog::move (const FPoint& d_pos) //---------------------------------------------------------------------- inline bool FDialog::moveUp (int n) { - move ({0, -n}); + if ( isBottomOutside() ) + { + const auto y_max = int(getMaxHeight()); + FWindow::setY(y_max, false); + putArea (getTermPos(), getVWin()); + restoreOverlaidWindows(); + } + else + move ({0, -n}); + return ! setPos_error; } @@ -296,7 +305,16 @@ inline bool FDialog::moveDown (int n) //---------------------------------------------------------------------- inline bool FDialog::moveLeft (int n) { - move ({-n, 0}); + if ( isLeftOutside() ) + { + const auto x_max = int(getMaxWidth()); + FWindow::setX(x_max, false); + putArea (getTermPos(), getVWin()); + restoreOverlaidWindows(); + } + else + move ({-n, 0}); + return ! setPos_error; } @@ -458,8 +476,9 @@ void FDialog::onKeyPress (FKeyEvent* ev) if ( this == getMainWidget() ) return; - if ( ev->key() == fc::Fkey_escape - || ev->key() == fc::Fkey_escape_mintty ) + if ( ! ev->isAccepted() + && ( ev->key() == fc::Fkey_escape + || ev->key() == fc::Fkey_escape_mintty) ) { ev->accept(); @@ -1385,48 +1404,58 @@ inline void FDialog::moveSizeKey (FKeyEvent* ev) { case fc::Fkey_up: moveUp(1); + ev->accept(); break; case fc::Fkey_down: moveDown(1); + ev->accept(); break; case fc::Fkey_left: moveLeft(1); + ev->accept(); break; case fc::Fkey_right: moveRight(1); + ev->accept(); break; case fc::Fmkey_up: case fc::Fkey_sr: reduceHeight(1); + ev->accept(); break; case fc::Fmkey_down: case fc::Fkey_sf: expandHeight(1); + ev->accept(); break; case fc::Fmkey_left: case fc::Fkey_sleft: reduceWidth(1); + ev->accept(); break; case fc::Fmkey_right: case fc::Fkey_sright: expandWidth(1); + ev->accept(); break; case fc::Fkey_return: case fc::Fkey_enter: acceptMoveSize(); + ev->accept(); break; case fc::Fkey_escape: case fc::Fkey_escape_mintty: cancelMoveSize(); + ev->accept(); return; default: @@ -1470,6 +1499,24 @@ bool FDialog::isOutsideTerminal (const FPoint& pos) const return false; } +//---------------------------------------------------------------------- +bool FDialog::isLeftOutside() +{ + if ( getX() > int(getMaxWidth()) ) + return true; + + return false; +} + +//---------------------------------------------------------------------- +bool FDialog::isBottomOutside() +{ + if ( getY() > int(getMaxHeight()) ) + return true; + + return false; +} + //---------------------------------------------------------------------- bool FDialog::isLowerRightResizeCorner (const mouseStates& ms) const { diff --git a/src/fevent.cpp b/src/fevent.cpp index 588a9e83..7f213231 100644 --- a/src/fevent.cpp +++ b/src/fevent.cpp @@ -366,10 +366,7 @@ FUserEvent::FUserEvent (fc::events ev_type, int user_event_id) // constructor //---------------------------------------------------------------------- FUserEvent::~FUserEvent() // destructor -{ - if ( ! external_data_pointer && data_pointer ) - delete data_pointer; -} +{ } //---------------------------------------------------------------------- int FUserEvent::getUserId() const diff --git a/src/ffiledialog.cpp b/src/ffiledialog.cpp index 66a4c70f..20412da6 100644 --- a/src/ffiledialog.cpp +++ b/src/ffiledialog.cpp @@ -55,10 +55,10 @@ bool sortDirFirst ( const FFileDialog::FDirEntry& lhs } //---------------------------------------------------------------------- -const FString fileChooser ( FWidget* parent - , const FString& dirname - , const FString& filter - , FFileDialog::DialogType type ) +FString fileChooser ( FWidget* parent + , const FString& dirname + , const FString& filter + , FFileDialog::DialogType type ) { FString ret{}; FString path{dirname}; @@ -165,7 +165,7 @@ FFileDialog& FFileDialog::operator = (const FFileDialog& fdlg) } //---------------------------------------------------------------------- -const FString FFileDialog::getSelectedFile() const +FString FFileDialog::getSelectedFile() const { const uLong n = uLong(filebrowser.currentItem() - 1); @@ -257,17 +257,17 @@ void FFileDialog::onKeyPress (FKeyEvent* ev) } //---------------------------------------------------------------------- -const FString FFileDialog::fileOpenChooser ( FWidget* parent - , const FString& dirname - , const FString& filter ) +FString FFileDialog::fileOpenChooser ( FWidget* parent + , const FString& dirname + , const FString& filter ) { return fileChooser (parent, dirname, filter, FFileDialog::Open); } //---------------------------------------------------------------------- -const FString FFileDialog::fileSaveChooser ( FWidget* parent - , const FString& dirname - , const FString& filter ) +FString FFileDialog::fileSaveChooser ( FWidget* parent + , const FString& dirname + , const FString& filter ) { return fileChooser (parent, dirname, filter, FFileDialog::Save); } @@ -736,7 +736,7 @@ void FFileDialog::printPath (const FString& txt) } //---------------------------------------------------------------------- -const FString FFileDialog::getHomeDir() +FString FFileDialog::getHomeDir() { struct passwd pwd{}; struct passwd* pwd_ptr{}; diff --git a/src/fkey_map.cpp b/src/fkey_map.cpp index ea1e0089..06d49bff 100644 --- a/src/fkey_map.cpp +++ b/src/fkey_map.cpp @@ -20,6 +20,8 @@ * . * ***********************************************************************/ +#include + #include "final/fc.h" #include "final/fkey_map.h" #include "final/ftypes.h" @@ -30,8 +32,8 @@ namespace finalcut namespace fc { -FKeyMap fkey[] = -{ +std::array fkey +{{ { fc::Fkey_backspace , nullptr, "kb" }, // backspace key { fc::Fkey_catab , nullptr, "ka" }, // clear-all-tabs key { fc::Fkey_clear , nullptr, "kC" }, // clear-screen or erase key @@ -210,12 +212,11 @@ FKeyMap fkey[] = { fc::Fkey_slash , ESC "Oo", "KP1"}, // keypad slash { fc::Fkey_asterisk , ESC "Oj", "KP2"}, // keypad asterisk { fc::Fkey_minus_sign, ESC "Om", "KP3"}, // keypad minus sign - { fc::Fkey_plus_sign , ESC "Ok", "KP4"}, // keypad plus sign - { 0 , nullptr, "\0" } -}; + { fc::Fkey_plus_sign , ESC "Ok", "KP4"} // keypad plus sign +}}; -constexpr FMetakeyMap fmetakey[] = -{ +constexpr std::array fmetakey = +{{ { fc::Fmkey_ic , "\033[2;3~" }, // M-insert { fc::Fmkey_ic , "\033\033[2~" }, // M-insert { fc::Fmkey_dc , "\033[3;3~" }, // M-delete @@ -443,12 +444,11 @@ constexpr FMetakeyMap fmetakey[] = { fc::Fmkey_left_curly_bracket , "\033{" }, // M-{ { fc::Fmkey_vertical_bar , "\033|" }, // M-| { fc::Fmkey_right_curly_bracket , "\033}" }, // M-} - { fc::Fmkey_tilde , "\033~" }, // M-~ - { 0 , "\0" } -}; + { fc::Fmkey_tilde , "\033~" } // M-~ +}}; -constexpr FKeyName fkeyname[] = -{ +constexpr std::array fkeyname = +{{ { fc::Fckey_a , "Ctrl+A" }, { fc::Fckey_b , "Ctrl+B" }, { fc::Fckey_c , "Ctrl+C" }, @@ -836,9 +836,8 @@ constexpr FKeyName fkeyname[] = { fc::Fkey_mouse , "xterm mouse" }, { fc::Fkey_extended_mouse , "SGR extended mouse" }, { fc::Fkey_urxvt_mouse , "urxvt mouse extension" }, - { fc::Fkey_incomplete , "incomplete key string" }, - { 0 , "\0" } -}; + { fc::Fkey_incomplete , "incomplete key string" } +}}; } // namespace fc diff --git a/src/fkeyboard.cpp b/src/fkeyboard.cpp index d7ea5801..c3776343 100644 --- a/src/fkeyboard.cpp +++ b/src/fkeyboard.cpp @@ -86,11 +86,20 @@ void FKeyboard::fetchKeyCode() } //---------------------------------------------------------------------- -const FString FKeyboard::getKeyName (const FKey keynum) const +FString FKeyboard::getKeyName (const FKey keynum) const { - for (std::size_t i{0}; fc::fkeyname[i].string[0] != 0; i++) - if ( fc::fkeyname[i].num && fc::fkeyname[i].num == keynum ) - return FString{fc::fkeyname[i].string}; + const auto& key = std::find_if + ( + fc::fkeyname.begin(), + fc::fkeyname.end(), + [&keynum] (fc::FKeyName kn) + { + return (kn.num > 0 && kn.num == keynum); + } + ); + + if ( key != fc::fkeyname.end() ) + return FString{key->string}; if ( keynum > 32 && keynum < 127 ) return FString{char(keynum)}; @@ -98,12 +107,6 @@ const FString FKeyboard::getKeyName (const FKey keynum) const return FString{""}; } -//---------------------------------------------------------------------- -void FKeyboard::setTermcapMap (fc::FKeyMap* keymap) -{ - key_map = keymap; -} - //---------------------------------------------------------------------- void FKeyboard::init() { @@ -221,12 +224,12 @@ inline FKey FKeyboard::getTermcapKey() assert ( FIFO_BUF_SIZE > 0 ); - if ( ! key_map ) + if ( key_map.use_count() == 0 ) return NOT_SET; - for (std::size_t i{0}; key_map[i].tname[0] != 0; i++) + for (auto&& entry : *key_map) { - const char* k = key_map[i].string; + const char* k = entry.string; const std::size_t len = ( k ) ? std::strlen(k) : 0; if ( k && std::strncmp(k, fifo_buf, len) == 0 ) // found @@ -240,7 +243,7 @@ inline FKey FKeyboard::getTermcapKey() fifo_buf[n] = '\0'; input_data_pending = bool(fifo_buf[0] != '\0'); - return fc::fkey[i].num; + return entry.num; } } @@ -254,9 +257,9 @@ inline FKey FKeyboard::getMetaKey() assert ( FIFO_BUF_SIZE > 0 ); - for (std::size_t i{0}; fc::fmetakey[i].string[0] != 0; i++) + for (auto&& entry : fc::fmetakey) { - const char* kmeta = fc::fmetakey[i].string; // The string is never null + const char* kmeta = entry.string; // The string is never null const std::size_t len = std::strlen(kmeta); if ( std::strncmp(kmeta, fifo_buf, len) == 0 ) // found @@ -279,7 +282,7 @@ inline FKey FKeyboard::getMetaKey() fifo_buf[n] = '\0'; input_data_pending = bool(fifo_buf[0] != '\0'); - return fc::fmetakey[i].num; + return entry.num; } } diff --git a/src/flogger.cpp b/src/flogger.cpp index daec3cea..11992e73 100644 --- a/src/flogger.cpp +++ b/src/flogger.cpp @@ -58,7 +58,7 @@ void FLogger::newlineReplace ( std::string& str } //---------------------------------------------------------------------- -const std::string FLogger::getTimeString() const +std::string FLogger::getTimeString() const { char str[100]; const auto& now = std::chrono::system_clock::now(); @@ -71,7 +71,7 @@ const std::string FLogger::getTimeString() const } //---------------------------------------------------------------------- -const std::string FLogger::getEOL() const +std::string FLogger::getEOL() const { if ( getEnding() == FLog::LF ) return "\n"; diff --git a/src/fmenubar.cpp b/src/fmenubar.cpp index 47f145db..cb57dc8a 100644 --- a/src/fmenubar.cpp +++ b/src/fmenubar.cpp @@ -268,17 +268,17 @@ void FMenuBar::calculateDimensions() const // find the maximum item width for (auto&& item : getItemList()) { - int len = int(item->getTextWidth()); - int item_width = len + 2; + auto len = item->getTextWidth(); + auto item_width = len + 2; // set item geometry - item->setGeometry (item_pos, FSize{std::size_t(item_width), 1}, false); + item->setGeometry (item_pos, FSize{item_width, 1}, false); // set menu position if ( item->hasMenu() ) item->getMenu()->setPos (item_pos, false); - item_pos.x_ref() += item_width; + item_pos.x_ref() += int(item_width); } } @@ -681,7 +681,7 @@ void FMenuBar::adjustItems() const for (auto&& item : getItemList()) { // get item width - int item_width = int(item->getWidth()); + auto item_width = item->getWidth(); if ( item->hasMenu() ) { @@ -694,7 +694,7 @@ void FMenuBar::adjustItems() const menu->adjustItems(); } - item_X += item_width; + item_X += int(item_width); } } diff --git a/src/fmenuitem.cpp b/src/fmenuitem.cpp index 2dee3015..5da65bb1 100644 --- a/src/fmenuitem.cpp +++ b/src/fmenuitem.cpp @@ -606,7 +606,7 @@ void FMenuItem::createDialogList (FMenu* winmenu) const { auto win = static_cast(*iter); FMenuItem* win_item{}; - const uInt32 n = uInt32(std::distance(first, iter)); + const auto n = uInt32(std::distance(first, iter)); // get the dialog title const auto& name = win->getText(); diff --git a/src/fmessagebox.cpp b/src/fmessagebox.cpp index 1e720423..c8599240 100644 --- a/src/fmessagebox.cpp +++ b/src/fmessagebox.cpp @@ -21,6 +21,7 @@ ***********************************************************************/ #include +#include #include "final/fapplication.h" #include "final/fbutton.h" @@ -30,8 +31,8 @@ namespace finalcut { -static const char* const button_text[] = -{ +constexpr std::array button_text = +{{ nullptr, "&OK", "&Cancel", @@ -39,9 +40,8 @@ static const char* const button_text[] = "&No", "&Abort", "&Retry", - "&Ignore", - nullptr -}; + "&Ignore" +}}; //---------------------------------------------------------------------- // class FMessageBox @@ -51,7 +51,7 @@ static const char* const button_text[] = //---------------------------------------------------------------------- FMessageBox::FMessageBox (FWidget* parent) : FDialog{parent} - , button_digit{FMessageBox::Ok, 0, 0} + , button_digit{FMessageBox::Ok, FMessageBox::Reject, FMessageBox::Reject} { setTitlebarText("Message for you"); init(); @@ -79,9 +79,9 @@ FMessageBox::FMessageBox (const FMessageBox& mbox) //---------------------------------------------------------------------- FMessageBox::FMessageBox ( const FString& caption , const FString& message - , int button0 - , int button1 - , int button2 + , ButtonType button0 + , ButtonType button1 + , ButtonType button2 , FWidget* parent ) : FDialog{parent} , text{message} @@ -158,10 +158,10 @@ void FMessageBox::setText (const FString& txt) if ( button[0] ) button[0]->setY (int(getHeight()) - 4, false); - if ( button[1] && button_digit[1] != 0 ) + if ( button[1] && button_digit[1] != FMessageBox::Reject ) button[1]->setY (int(getHeight()) - 4, false); - if ( button[2] && button_digit[2] != 0 ) + if ( button[2] && button_digit[2] != FMessageBox::Reject ) button[2]->setY (int(getHeight()) - 4, false); adjustButtons(); @@ -195,9 +195,9 @@ void FMessageBox::adjustSize() } //---------------------------------------------------------------------- -void FMessageBox::cb_processClick (int reply) +void FMessageBox::cb_processClick (ButtonType reply) { - done(reply); + done(int(reply)); } @@ -210,15 +210,18 @@ void FMessageBox::init() if ( (button_digit[2] && ! button_digit[1]) || (button_digit[1] && ! button_digit[0]) ) { - button_digit[0] = button_digit[1] = button_digit[2] = 0; + button_digit[0] = button_digit[1] \ + = button_digit[2] \ + = FMessageBox::Reject; } - if ( button_digit[0] == 0 ) + if ( button_digit[0] == FMessageBox::Reject ) button_digit[0] = FMessageBox::Ok; - if ( button_digit[1] == 0 && button_digit[2] == 0 ) + if ( button_digit[1] == FMessageBox::Reject + && button_digit[2] == FMessageBox::Reject ) num_buttons = 1; - else if ( button_digit[2] == 0 ) + else if ( button_digit[2] == FMessageBox::Reject ) num_buttons = 2; else num_buttons = 3; @@ -242,7 +245,7 @@ inline void FMessageBox::allocation() button[0]->setHeight(1, false); button[0]->setFocus(); - if ( button_digit[1] > 0 ) + if ( button_digit[1] > FMessageBox::Reject ) { button[1] = new FButton(this); button[1]->setText(button_text[button_digit[1]]); @@ -251,7 +254,7 @@ inline void FMessageBox::allocation() button[1]->setHeight(1, false); } - if ( button_digit[2] > 0 ) + if ( button_digit[2] > FMessageBox::Reject ) { button[2] = new FButton(this); button[2]->setText(button_text[button_digit[2]]); @@ -278,7 +281,7 @@ inline void FMessageBox::deallocation() //---------------------------------------------------------------------- inline void FMessageBox::initCallbacks() { - if ( button[0] && button_digit[0] != 0 ) + if ( button[0] && button_digit[0] != FMessageBox::Reject ) { button[0]->addCallback ( @@ -288,7 +291,7 @@ inline void FMessageBox::initCallbacks() ); } - if ( button[1] && button_digit[1] != 0 ) + if ( button[1] && button_digit[1] != FMessageBox::Reject ) { button[1]->addCallback ( @@ -298,7 +301,7 @@ inline void FMessageBox::initCallbacks() ); } - if ( button[2] && button_digit[2] != 0 ) + if ( button[2] && button_digit[2] != FMessageBox::Reject ) { button[2]->addCallback ( @@ -350,7 +353,7 @@ void FMessageBox::draw() int head_offset{0}; int center_x{0}; // center the whole block - const int msg_x = int((getWidth() - max_line_width) / 2); + const auto msg_x = int((getWidth() - max_line_width) / 2); if ( FTerm::isMonochron() ) setReverse(true); @@ -388,7 +391,7 @@ void FMessageBox::draw() //---------------------------------------------------------------------- void FMessageBox::resizeButtons() const { - std::size_t len[3]{}; + std::array len{}; std::size_t max_size{}; for (std::size_t n{0}; n < num_buttons && n < MAX_BUTTONS; n++) @@ -447,7 +450,7 @@ void FMessageBox::adjustButtons() setX (int((max_width - getWidth()) / 2)); } - const int btn_x = int((getWidth() - btn_width) / 2); + const auto btn_x = int((getWidth() - btn_width) / 2); for (std::size_t n{0}; n < num_buttons && n < MAX_BUTTONS; n++) { @@ -458,7 +461,7 @@ void FMessageBox::adjustButtons() button[n]->setX(btn_x); else { - const int btn_size = int(button[n]->getWidth()); + const auto btn_size = int(button[n]->getWidth()); button[n]->setX(btn_x + int(n) * (btn_size + int(gap))); } } diff --git a/src/fmouse.cpp b/src/fmouse.cpp index f6a01da3..471d13de 100644 --- a/src/fmouse.cpp +++ b/src/fmouse.cpp @@ -54,7 +54,7 @@ FMouse::FMouse() // public methods of FMouse //---------------------------------------------------------------------- -const FString FMouse::getClassName() const +FString FMouse::getClassName() const { return "FMouse"; } @@ -287,7 +287,7 @@ FMouseGPM::~FMouseGPM() // destructor // public methods of FMouseX11 //---------------------------------------------------------------------- -const FString FMouseGPM::getClassName() const +FString FMouseGPM::getClassName() const { return "FMouseGPM"; } @@ -520,7 +520,7 @@ int FMouseGPM::gpmEvent (bool clear) const // public methods of FMouseX11 //---------------------------------------------------------------------- -const FString FMouseX11::getClassName() const +FString FMouseX11::getClassName() const { return "FMouseX11"; } @@ -698,7 +698,7 @@ void FMouseX11::setButtonState (const int btn, const struct timeval* time) // public methods of FMouseSGR //---------------------------------------------------------------------- -const FString FMouseSGR::getClassName() const +FString FMouseSGR::getClassName() const { return "FMouseSGR"; } @@ -928,7 +928,7 @@ void FMouseSGR::setReleasedButtonState (const int btn) // public methods of FMouseUrxvt //---------------------------------------------------------------------- -const FString FMouseUrxvt::getClassName() const +FString FMouseUrxvt::getClassName() const { return "FMouseUrxvt"; } diff --git a/src/fobject.cpp b/src/fobject.cpp index fffaac9f..d474c249 100644 --- a/src/fobject.cpp +++ b/src/fobject.cpp @@ -382,11 +382,17 @@ bool FObject::delAllTimers() const // protected methods of FObject //---------------------------------------------------------------------- void FObject::onTimer (FTimerEvent*) -{ } +{ + // This event handler can be reimplemented in a subclass + // to receive timer events for this object +} //---------------------------------------------------------------------- void FObject::onUserEvent (FUserEvent*) -{ } +{ + // This event handler can be reimplemented in a subclass + // to receive user events for this object +} //---------------------------------------------------------------------- uInt FObject::processTimerEvent() diff --git a/src/foptiattr.cpp b/src/foptiattr.cpp index 9f6680dd..3de29ae4 100644 --- a/src/foptiattr.cpp +++ b/src/foptiattr.cpp @@ -531,11 +531,11 @@ FColor FOptiAttr::vga2ansi (FColor color) color = 0; else if ( color < 16 ) { - static const FColor lookup_table[] = - { + constexpr std::array lookup_table = + {{ 0, 4, 2, 6, 1, 5, 3, 7, 8, 12, 10, 14, 9, 13, 11, 15 - }; + }}; color = lookup_table[color]; } diff --git a/src/frect.cpp b/src/frect.cpp index d861f836..e62c8c40 100644 --- a/src/frect.cpp +++ b/src/frect.cpp @@ -84,37 +84,37 @@ bool FRect::isEmpty() const } //---------------------------------------------------------------------- -const FPoint FRect::getPos() const +FPoint FRect::getPos() const { return { X1, Y1 }; } //---------------------------------------------------------------------- -const FPoint FRect::getUpperLeftPos() const +FPoint FRect::getUpperLeftPos() const { return { X1, Y1 }; } //---------------------------------------------------------------------- -const FPoint FRect::getUpperRightPos() const +FPoint FRect::getUpperRightPos() const { return { X2, Y1 }; } //---------------------------------------------------------------------- -const FPoint FRect::getLowerLeftPos() const +FPoint FRect::getLowerLeftPos() const { return { X1, Y2 }; } //---------------------------------------------------------------------- -const FPoint FRect::getLowerRightPos() const +FPoint FRect::getLowerRightPos() const { return { X2, Y2 }; } //---------------------------------------------------------------------- -const FSize FRect::getSize() const +FSize FRect::getSize() const { return { getWidth(), getHeight() }; } @@ -338,7 +338,7 @@ FRect FRect::combined (const FRect& r) const // FRect non-member operators //---------------------------------------------------------------------- -const FRect operator + (const FRect& r, const FSize& s) +FRect operator + (const FRect& r, const FSize& s) { return { r.X1 , r.Y1 @@ -347,7 +347,7 @@ const FRect operator + (const FRect& r, const FSize& s) } //---------------------------------------------------------------------- -const FRect operator - (const FRect& r, const FSize& s) +FRect operator - (const FRect& r, const FSize& s) { return { r.X1 , r.Y1 diff --git a/src/fstring.cpp b/src/fstring.cpp index 5524ea9d..a28918eb 100644 --- a/src/fstring.cpp +++ b/src/fstring.cpp @@ -409,13 +409,13 @@ char* FString::c_str() } //---------------------------------------------------------------------- -const std::string FString::toString() const +std::string FString::toString() const { return std::string(c_str(), length); } //---------------------------------------------------------------------- -const FString FString::toLower() const +FString FString::toLower() const { FString s{*this}; auto to_lower = [] (wchar_t& c) @@ -427,7 +427,7 @@ const FString FString::toLower() const } //---------------------------------------------------------------------- -const FString FString::toUpper() const +FString FString::toUpper() const { FString s{*this}; auto to_upper = [] (wchar_t& c) @@ -455,7 +455,7 @@ sInt16 FString::toShort() const //---------------------------------------------------------------------- uInt16 FString::toUShort() const { - const uLong num = uLong(toULong()); + const uLong num = toULong(); if ( num > USHRT_MAX ) throw std::overflow_error ("overflow"); @@ -466,7 +466,7 @@ uInt16 FString::toUShort() const //---------------------------------------------------------------------- int FString::toInt() const { - long num = toLong(); + const long num = toLong(); if ( num > INT_MAX ) throw std::overflow_error ("overflow"); @@ -480,7 +480,7 @@ int FString::toInt() const //---------------------------------------------------------------------- uInt FString::toUInt() const { - const uLong num = uLong(toULong()); + const uLong num = toULong(); if ( num > UINT_MAX ) throw std::overflow_error ("overflow"); @@ -518,7 +518,7 @@ long FString::toLong() const while ( std::iswdigit(std::wint_t(*p)) ) { - uChar d = uChar(*p - L'0'); + auto d = uChar(*p - L'0'); if ( num > tenth_limit || (num == tenth_limit && d > tenth_limit_digit) ) @@ -568,7 +568,7 @@ uLong FString::toULong() const while ( std::iswdigit(std::wint_t(*p)) ) { - const uChar d = uChar(*p - L'0'); + const auto d = uChar(*p - L'0'); if ( num > tenth_limit || (num == tenth_limit && d > tenth_limit_digit) ) @@ -628,7 +628,7 @@ double FString::toDouble() const } //---------------------------------------------------------------------- -const FString FString::ltrim() const +FString FString::ltrim() const { const FString s{*this}; @@ -645,7 +645,7 @@ const FString FString::ltrim() const } //---------------------------------------------------------------------- -const FString FString::rtrim() const +FString FString::rtrim() const { FString s{*this}; @@ -668,7 +668,7 @@ const FString FString::rtrim() const } //---------------------------------------------------------------------- -const FString FString::trim() const +FString FString::trim() const { // handle NULL and empty string if ( ! (string && *string) ) @@ -679,7 +679,7 @@ const FString FString::trim() const } //---------------------------------------------------------------------- -const FString FString::left (std::size_t len) const +FString FString::left (std::size_t len) const { FString s{*this}; @@ -697,7 +697,7 @@ const FString FString::left (std::size_t len) const } //---------------------------------------------------------------------- -const FString FString::right (std::size_t len) const +FString FString::right (std::size_t len) const { const FString s{*this}; @@ -714,7 +714,7 @@ const FString FString::right (std::size_t len) const } //---------------------------------------------------------------------- -const FString FString::mid (std::size_t pos, std::size_t len) const +FString FString::mid (std::size_t pos, std::size_t len) const { const FString s{*this}; @@ -771,7 +771,7 @@ FString& FString::setNumber (sInt64 num) { wchar_t buf[30]{}; wchar_t* s = &buf[29]; // Pointer to the last character - uInt64 abs_num = static_cast(num); + auto abs_num = static_cast(num); if ( num < 0 ) abs_num = static_cast(-num); @@ -847,7 +847,7 @@ FString& FString::setFormatedNumber (sInt64 num, char separator) int n{0}; wchar_t buf[30]{}; wchar_t* s = &buf[29]; // Pointer to the last character - uInt64 abs_num = static_cast(num); + auto abs_num = static_cast(num); if ( separator == 0 ) separator = ' '; @@ -1001,7 +1001,7 @@ const FString& FString::insert (const FString& s, std::size_t pos) } //---------------------------------------------------------------------- -FString const FString::replace (const FString& from, const FString& to) const +FString FString::replace (const FString& from, const FString& to) const { FString s{*this}; @@ -1040,7 +1040,7 @@ FString const FString::replace (const FString& from, const FString& to) const } //---------------------------------------------------------------------- -const FString FString::replaceControlCodes() const +FString FString::replaceControlCodes() const { FString s{*this}; @@ -1066,7 +1066,7 @@ const FString FString::replaceControlCodes() const } //---------------------------------------------------------------------- -const FString FString::expandTabs (int tabstop) const +FString FString::expandTabs (int tabstop) const { FString instr{string}; FString outstr{}; @@ -1079,8 +1079,8 @@ const FString FString::expandTabs (int tabstop) const for (std::size_t i{0}; i < last; i++) { - const std::size_t len = tab_split[i].getLength(); - const std::size_t tab_len = std::size_t(tabstop); + const auto len = tab_split[i].getLength(); + const auto tab_len = std::size_t(tabstop); if ( i == last - 1 ) outstr += tab_split[i]; @@ -1527,7 +1527,7 @@ inline const wchar_t* FString::_extractToken ( wchar_t* rest[] // FString non-member operators //---------------------------------------------------------------------- -const FString operator + (const FString& s1, const FString& s2) +FString operator + (const FString& s1, const FString& s2) { FString tmp{s1}; tmp._insert (tmp.length, s2.length, s2.wc_str()); @@ -1535,7 +1535,7 @@ const FString operator + (const FString& s1, const FString& s2) } //---------------------------------------------------------------------- -const FString operator + (const FString& s, const wchar_t c) +FString operator + (const FString& s, const wchar_t c) { FString tmp1{s}; wchar_t tmp2[2]; @@ -1546,7 +1546,7 @@ const FString operator + (const FString& s, const wchar_t c) } //---------------------------------------------------------------------- -const FString operator + (const std::wstring& s1, const FString& s2) +FString operator + (const std::wstring& s1, const FString& s2) { FString tmp{s1}; tmp._insert (tmp.length, s2.length, s2.wc_str()); @@ -1554,7 +1554,7 @@ const FString operator + (const std::wstring& s1, const FString& s2) } //---------------------------------------------------------------------- -const FString operator + (const wchar_t s1[], const FString& s2) +FString operator + (const wchar_t s1[], const FString& s2) { FString tmp{s1}; tmp._insert (tmp.length, s2.length, s2.wc_str()); @@ -1562,7 +1562,7 @@ const FString operator + (const wchar_t s1[], const FString& s2) } //---------------------------------------------------------------------- -const FString operator + (const std::string& s1, const FString& s2) +FString operator + (const std::string& s1, const FString& s2) { FString tmp{s1}; tmp._insert (tmp.length, s2.length, s2.wc_str()); @@ -1570,7 +1570,7 @@ const FString operator + (const std::string& s1, const FString& s2) } //---------------------------------------------------------------------- -const FString operator + (const char s1[], const FString& s2) +FString operator + (const char s1[], const FString& s2) { FString tmp{s1}; tmp._insert (tmp.length, s2.length, s2.wc_str()); @@ -1578,7 +1578,7 @@ const FString operator + (const char s1[], const FString& s2) } //---------------------------------------------------------------------- -const FString operator + (const wchar_t c, const FString& s) +FString operator + (const wchar_t c, const FString& s) { FString tmp{c}; tmp._insert (1, s.length, s.wc_str()); @@ -1586,7 +1586,7 @@ const FString operator + (const wchar_t c, const FString& s) } //---------------------------------------------------------------------- -const FString operator + (const char c, const FString& s) +FString operator + (const char c, const FString& s) { FString tmp{c}; tmp._insert (1, s.length, s.wc_str()); @@ -1594,7 +1594,7 @@ const FString operator + (const char c, const FString& s) } //---------------------------------------------------------------------- -const FString operator + (const FString& s, const char c) +FString operator + (const FString& s, const char c) { FString tmp1{s}; wchar_t tmp2[2]; @@ -1607,7 +1607,7 @@ const FString operator + (const FString& s, const char c) //---------------------------------------------------------------------- std::ostream& operator << (std::ostream& outstr, const FString& s) { - const std::size_t width = std::size_t(outstr.width()); + const auto width = std::size_t(outstr.width()); if ( s.length > 0 ) { @@ -1641,7 +1641,7 @@ std::istream& operator >> (std::istream& instr, FString& s) //---------------------------------------------------------------------- std::wostream& operator << (std::wostream& outstr, const FString& s) { - const std::size_t width = std::size_t(outstr.width()); + const auto width = std::size_t(outstr.width()); if ( s.length > 0 ) { diff --git a/src/fterm.cpp b/src/fterm.cpp index 430f66bf..a819f1a3 100644 --- a/src/fterm.cpp +++ b/src/fterm.cpp @@ -158,7 +158,7 @@ std::size_t FTerm::getColumnNumber() } //---------------------------------------------------------------------- -const FString FTerm::getKeyName (FKey keynum) +FString FTerm::getKeyName (FKey keynum) { return keyboard->getKeyName (keynum); } @@ -202,7 +202,7 @@ int FTerm::getMaxColor() //---------------------------------------------------------------------- FTerm::FColorPalettePtr& FTerm::getColorPaletteTheme() { - static FColorPalettePtr* color_theme = new FColorPalettePtr(); + static auto color_theme = new FColorPalettePtr(); return *color_theme; } @@ -820,16 +820,15 @@ int FTerm::openConsole() int fd = data->getTTYFileDescriptor(); const char* termfilename = data->getTermFileName(); - static const char* terminal_devices[] = - { + constexpr std::array terminal_devices = + {{ "/proc/self/fd/0", "/dev/tty", "/dev/tty0", "/dev/vc/0", "/dev/systty", - "/dev/console", - nullptr - }; + "/dev/console" + }}; if ( fd >= 0 ) // console is already opened return 0; @@ -837,9 +836,9 @@ int FTerm::openConsole() if ( ! *termfilename || ! fsys ) return 0; - for (std::size_t i{0}; terminal_devices[i] != nullptr; i++) + for (auto&& entry : terminal_devices) { - fd = fsys->open(terminal_devices[i], O_RDWR, 0); + fd = fsys->open(entry, O_RDWR, 0); data->setTTYFileDescriptor(fd); if ( fd >= 0 ) @@ -1191,11 +1190,11 @@ wchar_t FTerm::charEncode (wchar_t c, fc::encoding enc) { wchar_t ch_enc = c; - for (std::size_t i{0}; i <= fc::last_char_item; i++) + for (auto&& entry : fc::character) { - if ( fc::character[i][fc::UTF8] == uInt(c) ) + if ( entry[fc::UTF8] == uInt(c) ) { - ch_enc = wchar_t(fc::character[i][enc]); + ch_enc = wchar_t(entry[enc]); break; } } @@ -1235,7 +1234,7 @@ bool FTerm::scrollTermReverse() //---------------------------------------------------------------------- FTerm::defaultPutChar& FTerm::putchar() { - static defaultPutChar* fputchar = new defaultPutChar(); + static auto fputchar = new defaultPutChar(); return *fputchar; } @@ -1408,8 +1407,8 @@ void FTerm::init_alt_charset() for (std::size_t n{0}; TCAP(fc::t_acs_chars)[n]; n += 2) { // insert the VT100 key/value pairs into a map - const uChar p1 = uChar(TCAP(fc::t_acs_chars)[n]); - const uChar p2 = uChar(TCAP(fc::t_acs_chars)[n + 1]); + const auto p1 = uChar(TCAP(fc::t_acs_chars)[n]); + const auto p2 = uChar(TCAP(fc::t_acs_chars)[n + 1]); vt100_alt_char[p1] = p2; } } @@ -1421,19 +1420,18 @@ void FTerm::init_alt_charset() }; // Update array 'character' with discovered VT100 pairs - for (std::size_t n{0}; n <= fc::last_key_item; n++ ) + for (auto&& pair : fc::vt100_key_to_utf8) { - const uChar keyChar = uChar(fc::vt100_key_to_utf8[n][vt100_key]); - const uChar altChar = uChar(vt100_alt_char[keyChar]); - const uInt utf8char = uInt(fc::vt100_key_to_utf8[n][utf8_char]); - const fc::encoding num{fc::NUM_OF_ENCODINGS}; - - uInt* p = std::find ( fc::character[0] - , fc::character[fc::last_char_item] + num - , utf8char ); - if ( p != fc::character[fc::last_char_item] + num ) // found in character + const auto keyChar = uChar(pair[vt100_key]); + const auto altChar = uChar(vt100_alt_char[keyChar]); + const auto utf8char = uInt(pair[utf8_char]); + const auto p = std::find_if ( fc::character.begin() + , fc::character.end() + , [&utf8char] (std::array entry) + { return entry[0] == utf8char; } ); + if ( p != fc::character.end() ) // found in character { - const int item = int(std::distance(fc::character[0], p) / num); + const auto item = std::size_t(std::distance(fc::character.begin(), p)); if ( altChar ) // update alternate character set fc::character[item][fc::VT100] = altChar; @@ -1506,24 +1504,24 @@ void FTerm::init_cygwin_charmap() return; // PC encoding changes - for (std::size_t i{0}; i <= fc::last_char_item; i++ ) + for (auto&& entry : fc::character) { - if ( fc::character[i][fc::UTF8] == fc::BlackUpPointingTriangle ) // ▲ - fc::character[i][fc::PC] = 0x18; + if ( entry[fc::UTF8] == fc::BlackUpPointingTriangle ) // ▲ + entry[fc::PC] = 0x18; - if ( fc::character[i][fc::UTF8] == fc::BlackDownPointingTriangle ) // ▼ - fc::character[i][fc::PC] = 0x19; + if ( entry[fc::UTF8] == fc::BlackDownPointingTriangle ) // ▼ + entry[fc::PC] = 0x19; - if ( fc::character[i][fc::UTF8] == fc::InverseBullet // ◘ - || fc::character[i][fc::UTF8] == fc::InverseWhiteCircle // ◙ - || fc::character[i][fc::UTF8] == fc::UpDownArrow // ↕ - || fc::character[i][fc::UTF8] == fc::LeftRightArrow // ↔ - || fc::character[i][fc::UTF8] == fc::DoubleExclamationMark // ‼ - || fc::character[i][fc::UTF8] == fc::BlackRectangle // ▬ - || fc::character[i][fc::UTF8] == fc::RightwardsArrow // → - || fc::character[i][fc::UTF8] == fc::Section // § - || fc::character[i][fc::UTF8] == fc::SquareRoot ) // SquareRoot √ - fc::character[i][fc::PC] = fc::character[i][fc::ASCII]; + if ( entry[fc::UTF8] == fc::InverseBullet // ◘ + || entry[fc::UTF8] == fc::InverseWhiteCircle // ◙ + || entry[fc::UTF8] == fc::UpDownArrow // ↕ + || entry[fc::UTF8] == fc::LeftRightArrow // ↔ + || entry[fc::UTF8] == fc::DoubleExclamationMark // ‼ + || entry[fc::UTF8] == fc::BlackRectangle // ▬ + || entry[fc::UTF8] == fc::RightwardsArrow // → + || entry[fc::UTF8] == fc::Section // § + || entry[fc::UTF8] == fc::SquareRoot ) // SquareRoot √ + entry[fc::PC] = entry[fc::ASCII]; } // General encoding changes @@ -1560,9 +1558,9 @@ void FTerm::init_teraterm_charmap() if ( ! isTeraTerm() ) return; - for (std::size_t i{0}; i <= fc::last_char_item; i++ ) - if ( fc::character[i][fc::PC] < 0x20 ) - fc::character[i][fc::PC] = fc::character[i][fc::ASCII]; + for (auto&& entry : fc::character) + if ( entry[fc::PC] < 0x20 ) + entry[fc::PC] = entry[fc::ASCII]; } //---------------------------------------------------------------------- diff --git a/src/fterm_functions.cpp b/src/fterm_functions.cpp index 19699705..e7afe543 100644 --- a/src/fterm_functions.cpp +++ b/src/fterm_functions.cpp @@ -274,11 +274,11 @@ wchar_t cp437_to_unicode (uChar c) constexpr std::size_t UNICODE = 1; wchar_t ucs = c; - for (std::size_t i{0}; i <= fc::last_cp437_item; i++) + for (auto&& entry : fc::cp437_ucs) { - if ( fc::cp437_ucs[i][CP437] == c ) // found + if ( entry[CP437] == c ) // found { - ucs = fc::cp437_ucs[i][UNICODE]; + ucs = entry[UNICODE]; break; } } @@ -293,11 +293,11 @@ uChar unicode_to_cp437 (wchar_t ucs) constexpr std::size_t UNICODE = 1; uChar c{'?'}; - for (std::size_t i{0}; i <= fc::last_cp437_item; i++) + for (auto&& entry : fc::cp437_ucs) { - if ( fc::cp437_ucs[i][UNICODE] == ucs ) // found + if ( entry[UNICODE] == ucs ) // found { - c = uChar(fc::cp437_ucs[i][CP437]); + c = uChar(entry[CP437]); break; } } @@ -306,7 +306,7 @@ uChar unicode_to_cp437 (wchar_t ucs) } //---------------------------------------------------------------------- -const FString getFullWidth (const FString& str) +FString getFullWidth (const FString& str) { // Converts half-width to full-width characters @@ -322,10 +322,10 @@ const FString getFullWidth (const FString& str) } else { - for (std::size_t i{0}; i <= fc::last_halfwidth_item; i++) + for (auto&& entry : fc::halfwidth_fullwidth) { - if ( fc::halfwidth_fullwidth[i][HALF] == c ) // found - c = fc::halfwidth_fullwidth[i][FULL]; + if ( entry[HALF] == c ) // found + c = entry[FULL]; } } } @@ -334,7 +334,7 @@ const FString getFullWidth (const FString& str) } //---------------------------------------------------------------------- -const FString getHalfWidth (const FString& str) +FString getHalfWidth (const FString& str) { // Converts full-width to half-width characters @@ -350,10 +350,10 @@ const FString getHalfWidth (const FString& str) } else { - for (std::size_t i{0}; i <= fc::last_halfwidth_item; i++) + for (auto&& entry : fc::halfwidth_fullwidth) { - if ( fc::halfwidth_fullwidth[i][FULL] == c ) // found - c = fc::halfwidth_fullwidth[i][HALF]; + if ( entry[FULL] == c ) // found + c = entry[HALF]; } } } @@ -362,9 +362,9 @@ const FString getHalfWidth (const FString& str) } //---------------------------------------------------------------------- -const FString getColumnSubString ( const FString& str - , std::size_t col_pos - , std::size_t col_len ) +FString getColumnSubString ( const FString& str + , std::size_t col_pos + , std::size_t col_len ) { FString s{str}; std::size_t col_first{1}; diff --git a/src/ftermbuffer.cpp b/src/ftermbuffer.cpp index 81c3ec88..f5b61a9c 100644 --- a/src/ftermbuffer.cpp +++ b/src/ftermbuffer.cpp @@ -43,7 +43,7 @@ FTermBuffer::~FTermBuffer() // destructor // public methods of FTermBuffer //---------------------------------------------------------------------- -const FString FTermBuffer::toString() const +FString FTermBuffer::toString() const { std::wstring wide_string{}; wide_string.reserve(data.size()); @@ -62,7 +62,7 @@ const FString FTermBuffer::toString() const int FTermBuffer::write (const FString& string) { assert ( ! string.isNull() ); - const int len = int(string.getLength()); + const auto len = int(string.getLength()); for (auto&& c : string) { diff --git a/src/ftermcap.cpp b/src/ftermcap.cpp index 37e014f0..a819436a 100644 --- a/src/ftermcap.cpp +++ b/src/ftermcap.cpp @@ -224,8 +224,9 @@ void FTermcap::termcapStrings() // Get termcap strings // Read termcap output strings - for (std::size_t i{0}; strings[i].tname[0] != 0; i++) - strings[i].string = getString(strings[i].tname); + + for (auto&& entry : strings) + entry.string = getString(entry.tname); const auto& ho = TCAP(fc::t_cursor_home); @@ -239,10 +240,8 @@ void FTermcap::termcapKeys() // Get termcap keys // Read termcap key sequences up to the self-defined values - for ( std::size_t i{0}; - fc::fkey[i].string == nullptr && fc::fkey[i].tname[0] != 0; - i++ ) - fc::fkey[i].string = getString(fc::fkey[i].tname); + for (auto&& entry : fc::fkey) + entry.string = getString(entry.tname); } //---------------------------------------------------------------------- @@ -257,8 +256,8 @@ int FTermcap::_tputs (const char* str, int affcnt, fn_putc putc) // private Data Member of FTermcap - termcap capabilities //---------------------------------------------------------------------- -FTermcap::tcap_map FTermcap::strings[] = -{ +FTermcap::TCapMapType FTermcap::strings = +{{ // .------------- term string // | .-------- Tcap-code // | | // variable name -> description @@ -347,9 +346,8 @@ FTermcap::tcap_map FTermcap::strings[] = { nullptr, "ac" }, // acs_chars -> graphics charset pairs (vt100) { nullptr, "ks" }, // keypad_xmit -> enter 'key-board_transmit' mode { nullptr, "ke" }, // keypad_local -> leave 'key-board_transmit' mode - { nullptr, "Km" }, // key_mouse -> Mouse event has occurred - { nullptr, "\0" } -}; + { nullptr, "Km" } // key_mouse -> Mouse event has occurred +}}; /* * (P) indicates that padding may be specified diff --git a/src/ftermfreebsd.cpp b/src/ftermfreebsd.cpp index 6c4eb50e..ee6a08cc 100644 --- a/src/ftermfreebsd.cpp +++ b/src/ftermfreebsd.cpp @@ -171,9 +171,9 @@ void FTermFreeBSD::initCharMap() if ( ! isFreeBSDConsole() ) return; - for (std::size_t i{0}; i <= fc::last_char_item; i++) - if ( fc::character[i][fc::PC] < 0x1c ) - fc::character[i][fc::PC] = fc::character[i][fc::ASCII]; + for (auto&& entry : fc::character) + if ( entry[fc::PC] < 0x1c ) + entry[fc::PC] = entry[fc::ASCII]; } //---------------------------------------------------------------------- diff --git a/src/ftermlinux.cpp b/src/ftermlinux.cpp index 58478eee..8be13144 100644 --- a/src/ftermlinux.cpp +++ b/src/ftermlinux.cpp @@ -217,14 +217,14 @@ void FTermLinux::initCharMap() if ( screen_unicode_map.entry_ct > 0 && screen_unicode_map.entries ) { - for (std::size_t i{0}; i <= fc::last_char_item; i++ ) + for (auto&& entry : fc::character) { - const auto ucs = wchar_t(fc::character[i][fc::UTF8]); + const auto ucs = wchar_t(entry[fc::UTF8]); const sInt16 fontpos = getFontPos(ucs); // Fix for a non-cp437 Linux console with PC charset encoding if ( fontpos > 255 || fontpos == NOT_FOUND ) - fc::character[i][fc::PC] = fc::character[i][fc::ASCII]; + entry[fc::PC] = entry[fc::ASCII]; // Character substitutions for missing characters if ( fontpos == NOT_FOUND ) @@ -700,7 +700,7 @@ int FTermLinux::setScreenFont ( const uChar fontdata[], uInt count for (std::size_t i{0}; i < count; i++) std::memcpy ( font.data + bytes_per_line * 32 * i , &fontdata[i * font.height] - , font.height); + , font.height ); } // Font operation @@ -932,8 +932,8 @@ void FTermLinux::getVGAPalette() //---------------------------------------------------------------------- void FTermLinux::setVGADefaultPalette() { - constexpr rgb defaultColor[16] = - { + constexpr std::array defaultColor = + {{ {0x00, 0x00, 0x00}, {0xaa, 0x00, 0x00}, {0x00, 0xaa, 0x00}, {0xaa, 0x55, 0x00}, {0x00, 0x00, 0xaa}, {0xaa, 0x00, 0xaa}, @@ -942,7 +942,7 @@ void FTermLinux::setVGADefaultPalette() {0x55, 0xff, 0x55}, {0xff, 0xff, 0x55}, {0x55, 0x55, 0xff}, {0xff, 0x55, 0xff}, {0x55, 0xff, 0xff}, {0xff, 0xff, 0xff} - }; + }}; for (std::size_t index{0}; index < 16; index++) { diff --git a/src/ftermxterminal.cpp b/src/ftermxterminal.cpp index fe41dc2e..d314045e 100644 --- a/src/ftermxterminal.cpp +++ b/src/ftermxterminal.cpp @@ -743,7 +743,7 @@ void FTermXTerminal::oscPostfix() const } //---------------------------------------------------------------------- -const FString FTermXTerminal::captureXTermFont() const +FString FTermXTerminal::captureXTermFont() const { initCheck(FString{}); @@ -787,7 +787,7 @@ const FString FTermXTerminal::captureXTermFont() const } //---------------------------------------------------------------------- -const FString FTermXTerminal::captureXTermTitle() const +FString FTermXTerminal::captureXTermTitle() const { initCheck(FString{}); diff --git a/src/ftextview.cpp b/src/ftextview.cpp index 7671fa09..c08a03b5 100644 --- a/src/ftextview.cpp +++ b/src/ftextview.cpp @@ -54,7 +54,7 @@ FTextView::~FTextView() // destructor // public methods of FTextView //---------------------------------------------------------------------- -const FString FTextView::getText() const +FString FTextView::getText() const { if ( data.empty() ) return FString{""}; @@ -149,7 +149,7 @@ void FTextView::scrollTo (int x, int y) if ( changeX && isHorizontallyScrollable() ) { - const int xoffset_end = int(max_line_width - getTextWidth()); + const auto xoffset_end = int(max_line_width - getTextWidth()); xoffset = x; if ( xoffset < 0 ) @@ -167,7 +167,7 @@ void FTextView::scrollTo (int x, int y) if ( changeY && isVerticallyScrollable() ) { - const int yoffset_end = int(getRows() - getTextHeight()); + const auto yoffset_end = int(getRows() - getTextHeight()); yoffset = y; if ( yoffset < 0 ) @@ -335,7 +335,7 @@ void FTextView::clear() //---------------------------------------------------------------------- void FTextView::onKeyPress (FKeyEvent* ev) { - const int idx = int(ev->key()); + const auto idx = int(ev->key()); if ( key_map.find(idx) != key_map.end() ) { @@ -504,8 +504,8 @@ void FTextView::adjustSize() FWidget::adjustSize(); const std::size_t width = getWidth(); const std::size_t height = getHeight(); - const int last_line = int(getRows()); - const int max_width = int(max_line_width); + const auto last_line = int(getRows()); + const auto max_width = int(max_line_width); if ( xoffset >= max_width - int(width) - nf_offset ) xoffset = max_width - int(width) - nf_offset - 1; diff --git a/src/fvterm.cpp b/src/fvterm.cpp index b935f6a7..4992c157 100644 --- a/src/fvterm.cpp +++ b/src/fvterm.cpp @@ -111,7 +111,7 @@ FVTerm& FVTerm::operator << (const FTermBuffer& term_buffer) // public methods of FVTerm //---------------------------------------------------------------------- -const FPoint FVTerm::getPrintCursor() +FPoint FVTerm::getPrintCursor() { const auto& win = getPrintArea(); @@ -130,8 +130,8 @@ void FVTerm::setTermXY (int x, int y) const if ( term_pos->getX() == x && term_pos->getY() == y ) return; - const int term_width = int(FTerm::getColumnNumber()); - const int term_height = int(FTerm::getLineNumber()); + const auto term_width = int(FTerm::getColumnNumber()); + const auto term_height = int(FTerm::getLineNumber()); if ( x >= term_width && term_width > 0 ) { @@ -434,7 +434,7 @@ int FVTerm::print (const std::vector& term_string) int FVTerm::print (FTermArea* area, const std::vector& term_string) { int len{0}; - const uInt tabstop = uInt(FTerm::getTabstop()); + const auto tabstop = uInt(FTerm::getTabstop()); if ( ! area ) return -1; @@ -734,10 +734,10 @@ void FVTerm::resizeArea ( const FRect& box const int offset_left = box.getX(); const int offset_top = box.getY(); - const int width = int(box.getWidth()); - const int height = int(box.getHeight()); - const int rsw = int(shadow.getWidth()); - const int bsh = int(shadow.getHeight()); + const auto width = int(box.getWidth()); + const auto height = int(box.getHeight()); + const auto rsw = int(shadow.getWidth()); + const auto bsh = int(shadow.getHeight()); assert ( offset_top >= 0 ); assert ( width > 0 && width + rsw > 0 ); @@ -827,8 +827,8 @@ void FVTerm::restoreVTerm (const FRect& box) int x = box.getX() - 1; int y = box.getY() - 1; - int w = int(box.getWidth()); - int h = int(box.getHeight()); + auto w = int(box.getWidth()); + auto h = int(box.getHeight()); if ( x < 0 ) x = 0; @@ -970,8 +970,8 @@ void FVTerm::getArea (const FRect& box, const FTermArea* area) const int x = box.getX(); const int y = box.getY(); - const int w = int(box.getWidth()); - const int h = int(box.getHeight()); + const auto w = int(box.getWidth()); + const auto h = int(box.getHeight()); const int dx = x - area->offset_left + 1; const int dy = y - area->offset_top + 1; int y_end{}; @@ -1040,8 +1040,8 @@ void FVTerm::putArea (const FTermArea* area) const for (int y{0}; y < y_end; y++) // Line loop { bool modified{false}; - int line_xmin = int(area->changes[y].xmin); - int line_xmax = int(area->changes[y].xmax); + auto line_xmin = int(area->changes[y].xmin); + auto line_xmax = int(area->changes[y].xmax); if ( line_xmin > line_xmax ) continue; @@ -1289,7 +1289,7 @@ void FVTerm::clearArea (FTermArea* area, int fillchar) const return; } - const uInt w = uInt(area->width + area->right_shadow); + const auto w = uInt(area->width + area->right_shadow); if ( area->right_shadow == 0 ) { @@ -1795,7 +1795,7 @@ bool FVTerm::isInsideArea (const FPoint& pos, const FTermArea* area) } //---------------------------------------------------------------------- -const FChar FVTerm::generateCharacter (const FPoint& pos) +FChar FVTerm::generateCharacter (const FPoint& pos) { // Generates characters for a given position considering all areas @@ -1865,7 +1865,7 @@ const FChar FVTerm::generateCharacter (const FPoint& pos) } //---------------------------------------------------------------------- -const FChar FVTerm::getCharacter ( character_type char_type +FChar FVTerm::getCharacter ( character_type char_type , const FPoint& pos , FVTerm* obj ) { @@ -1925,14 +1925,14 @@ const FChar FVTerm::getCharacter ( character_type char_type } //---------------------------------------------------------------------- -const FChar FVTerm::getCoveredCharacter (const FPoint& pos, FVTerm* obj) +FChar FVTerm::getCoveredCharacter (const FPoint& pos, FVTerm* obj) { // Gets the covered character for a given position return getCharacter (covered_character, pos, obj); } //---------------------------------------------------------------------- -const FChar FVTerm::getOverlappedCharacter (const FPoint& pos, FVTerm* obj) +FChar FVTerm::getOverlappedCharacter (const FPoint& pos, FVTerm* obj) { // Gets the overlapped character for a given position return getCharacter (overlapped_character, pos, obj); diff --git a/src/fwidget.cpp b/src/fwidget.cpp index a1843529..4d843aef 100644 --- a/src/fwidget.cpp +++ b/src/fwidget.cpp @@ -242,7 +242,7 @@ std::vector& FWidget::doubleFlatLine_ref (fc::sides side) } //---------------------------------------------------------------------- -const FPoint FWidget::getPrintPos() +FPoint FWidget::getPrintPos() { const auto& cur = getPrintCursor(); return { cur.getX() - woffset.getX1() - getX() + 1 @@ -721,7 +721,7 @@ void FWidget::setDoubleFlatLine (fc::sides side, int pos, bool bit) assert ( pos >= 1 ); uLong length{}; - const uLong index = uLong(pos - 1); + const auto index = uLong(pos - 1); switch ( side ) { @@ -957,7 +957,8 @@ void FWidget::show() show_root_widget = this; } - draw(); // Draw the widget + adjustSize(); // Alignment before drawing + draw(); // Draw the widget flags.hidden = false; flags.shown = true; @@ -1209,8 +1210,8 @@ void FWidget::setParentOffset() void FWidget::setTermOffset() { const auto& r = getRootWidget(); - const int w = int(r->getWidth()); - const int h = int(r->getHeight()); + const auto w = int(r->getWidth()); + const auto h = int(r->getHeight()); woffset.setCoordinates (0, 0, w - 1, h - 1); } @@ -1585,55 +1586,94 @@ bool FWidget::event (FEvent* ev) //---------------------------------------------------------------------- void FWidget::onKeyPress (FKeyEvent*) -{ } +{ + // This event handler can be reimplemented in a subclass + // to receive key press events for the widget +} //---------------------------------------------------------------------- void FWidget::onKeyUp (FKeyEvent*) -{ } +{ + // This event handler can be reimplemented in a subclass + // to receive key up events for the widget +} //---------------------------------------------------------------------- void FWidget::onKeyDown (FKeyEvent*) -{ } +{ + // This event handler can be reimplemented in a subclass + // to receive key down events for the widget +} //---------------------------------------------------------------------- void FWidget::onMouseDown (FMouseEvent*) -{ } +{ + // This event handler can be reimplemented in a subclass + // to receive mouse down events for the widget +} //---------------------------------------------------------------------- void FWidget::onMouseUp (FMouseEvent*) -{ } +{ + // This event handler can be reimplemented in a subclass + // to receive mouse up events for the widget +} //---------------------------------------------------------------------- void FWidget::onMouseDoubleClick (FMouseEvent*) -{ } +{ + // This event handler can be reimplemented in a subclass + // to receive mouse double clicks events for the widget +} //---------------------------------------------------------------------- void FWidget::onWheel (FWheelEvent*) -{ } +{ + // This event handler can be reimplemented in a subclass + // to receive mouse wheel events for the widget +} //---------------------------------------------------------------------- void FWidget::onMouseMove (FMouseEvent*) -{ } +{ + // This event handler can be reimplemented in a subclass + // to receive mouse move events for the widget +} //---------------------------------------------------------------------- void FWidget::onFocusIn (FFocusEvent*) -{ } +{ + // This event handler can be reimplemented in a subclass + // to receive a widget focus event (get focus) +} //---------------------------------------------------------------------- void FWidget::onFocusOut (FFocusEvent*) -{ } +{ + // This event handler can be reimplemented in a subclass + // to receive a widget focus event (lost focus) +} //---------------------------------------------------------------------- void FWidget::onChildFocusIn (FFocusEvent*) -{ } +{ + // This event handler can be reimplemented in a subclass + // to receive a child widget focus event (get focus) +} //---------------------------------------------------------------------- void FWidget::onChildFocusOut (FFocusEvent*) -{ } +{ + // This event handler can be reimplemented in a subclass + // to receive a child widget focus event (lost focus) +} //---------------------------------------------------------------------- void FWidget::onAccel (FAccelEvent*) -{ } +{ + // This event handler can be reimplemented in a subclass to receive + // an event when an acceleration key is pressed for this widget +} //---------------------------------------------------------------------- void FWidget::onResize (FResizeEvent* ev) @@ -1646,15 +1686,23 @@ void FWidget::onResize (FResizeEvent* ev) //---------------------------------------------------------------------- void FWidget::onShow (FShowEvent*) -{ } +{ + // This event handler can be reimplemented in a subclass + // to receive a widget show event +} //---------------------------------------------------------------------- void FWidget::onHide (FHideEvent*) -{ } +{ + // This event handler can be reimplemented in a subclass + // to receive a widget hide event +} //---------------------------------------------------------------------- void FWidget::onClose (FCloseEvent* ev) { + // This event handler can be reimplemented in a subclass + // to receive a widget close event ev->accept(); } @@ -1914,7 +1962,10 @@ bool FWidget::changeFocus ( FWidget* follower, FWidget* parent //---------------------------------------------------------------------- void FWidget::draw() -{ } +{ + // This method must be reimplemented in a subclass + // for drawing the widget +} //---------------------------------------------------------------------- void FWidget::drawWindows() const diff --git a/src/fwidget_functions.cpp b/src/fwidget_functions.cpp index b8072edb..b3d60d80 100644 --- a/src/fwidget_functions.cpp +++ b/src/fwidget_functions.cpp @@ -97,7 +97,7 @@ std::size_t getHotkeyPos (const FString& src, FString& dest) // Find hotkey position in string // + generate a new string without the '&'-sign - constexpr std::size_t NOT_SET = static_cast(-1); + constexpr auto NOT_SET = static_cast(-1); std::size_t hotkeypos{NOT_SET}; std::size_t i{0}; diff --git a/src/fwindow.cpp b/src/fwindow.cpp index d8d6c8cf..bb66c627 100644 --- a/src/fwindow.cpp +++ b/src/fwindow.cpp @@ -815,19 +815,31 @@ bool FWindow::event (FEvent* ev) //---------------------------------------------------------------------- void FWindow::onWindowActive (FEvent*) -{ } +{ + // This event handler can be reimplemented in a subclass + // to receive activation events for this window +} //---------------------------------------------------------------------- void FWindow::onWindowInactive (FEvent*) -{ } +{ + // This event handler can be reimplemented in a subclass + // to receive deactivation events for this window +} //---------------------------------------------------------------------- void FWindow::onWindowRaised (FEvent*) -{ } +{ + // This event handler can be reimplemented in a subclass + // to receive window raising events for this window +} //---------------------------------------------------------------------- void FWindow::onWindowLowered (FEvent*) -{ } +{ + // This event handler can be reimplemented in a subclass + // to receive window lowering events for this window +} // private methods of FWindow diff --git a/src/include/final/emptyfstring.h b/src/include/final/emptyfstring.h index 27123bf6..c6ab6f97 100644 --- a/src/include/final/emptyfstring.h +++ b/src/include/final/emptyfstring.h @@ -62,7 +62,7 @@ public: // Disable copy assignment operator (=) emptyFString& operator = (const emptyFString&) = delete; - static const FString getClassName(); + static FString getClassName(); static bool isNull(); static const FString& get(); static void clear(); @@ -74,7 +74,7 @@ private: // emptyFString inline functions //---------------------------------------------------------------------- -inline const FString emptyFString::getClassName() +inline FString emptyFString::getClassName() { return "emptyFString"; } //---------------------------------------------------------------------- diff --git a/src/include/final/fapplication.h b/src/include/final/fapplication.h index 5f3117c2..4a0b0d07 100644 --- a/src/include/final/fapplication.h +++ b/src/include/final/fapplication.h @@ -110,7 +110,7 @@ class FApplication : public FWidget FApplication& operator = (const FApplication&) = delete; // Accessors - const FString getClassName() const override; + FString getClassName() const override; int getArgc() const; char** getArgv() const; static FApplication* getApplicationObject(); @@ -229,7 +229,7 @@ FApplication* getFApplication(); // FApplication inline functions //---------------------------------------------------------------------- -inline const FString FApplication::getClassName() const +inline FString FApplication::getClassName() const { return "FApplication"; } //---------------------------------------------------------------------- diff --git a/src/include/final/fbusyindicator.h b/src/include/final/fbusyindicator.h index a73618b1..82b7540e 100644 --- a/src/include/final/fbusyindicator.h +++ b/src/include/final/fbusyindicator.h @@ -82,7 +82,7 @@ class FBusyIndicator : public FToolTip FBusyIndicator& operator = (const FBusyIndicator&) = delete; // Accessors - const FString getClassName() const override; + FString getClassName() const override; // Inquiries bool isRunning() const; @@ -113,7 +113,7 @@ class FBusyIndicator : public FToolTip // FBusyIndicator inline functions //---------------------------------------------------------------------- -inline const FString FBusyIndicator::getClassName() const +inline FString FBusyIndicator::getClassName() const { return "FBusyIndicator"; } //---------------------------------------------------------------------- diff --git a/src/include/final/fbutton.h b/src/include/final/fbutton.h index 36ba2ae1..2e1b4aea 100644 --- a/src/include/final/fbutton.h +++ b/src/include/final/fbutton.h @@ -77,7 +77,7 @@ class FButton : public FWidget FButton& operator = (const FString&); // Accessors - const FString getClassName() const override; + FString getClassName() const override; FString getText() const; // Mutators @@ -134,7 +134,7 @@ class FButton : public FWidget private: // Constants - static constexpr std::size_t NOT_SET = static_cast(-1); + static constexpr auto NOT_SET = static_cast(-1); // Methods void init(); @@ -174,7 +174,7 @@ class FButton : public FWidget // FButton inline functions //---------------------------------------------------------------------- -inline const FString FButton::getClassName() const +inline FString FButton::getClassName() const { return "FButton"; } //---------------------------------------------------------------------- diff --git a/src/include/final/fbuttongroup.h b/src/include/final/fbuttongroup.h index f59e05fd..410f186a 100644 --- a/src/include/final/fbuttongroup.h +++ b/src/include/final/fbuttongroup.h @@ -78,7 +78,7 @@ class FButtonGroup : public FScrollView FButtonGroup& operator = (const FButtonGroup&) = delete; // Accessor - const FString getClassName() const override; + FString getClassName() const override; FToggleButton* getFirstButton(); FToggleButton* getLastButton(); FToggleButton* getButton (int) const; @@ -119,7 +119,7 @@ class FButtonGroup : public FScrollView private: // Constants - static constexpr std::size_t NOT_SET = static_cast(-1); + static constexpr auto NOT_SET = static_cast(-1); // Inquiries bool isRadioButton (const FToggleButton*) const; @@ -139,7 +139,7 @@ class FButtonGroup : public FScrollView // FButtonGroup inline functions //---------------------------------------------------------------------- -inline const FString FButtonGroup::getClassName() const +inline FString FButtonGroup::getClassName() const { return "FButtonGroup"; } //---------------------------------------------------------------------- diff --git a/src/include/final/fcallback.h b/src/include/final/fcallback.h index 12829d09..32de081b 100644 --- a/src/include/final/fcallback.h +++ b/src/include/final/fcallback.h @@ -147,7 +147,7 @@ class FCallback FCallback& operator = (const FCallback&) = delete; // Accessors - const FString getClassName() const; + FString getClassName() const; std::size_t getCallbackCount() const; // Methods @@ -220,7 +220,7 @@ class FCallback // FCallback inline functions //---------------------------------------------------------------------- -inline const FString FCallback::getClassName() const +inline FString FCallback::getClassName() const { return "FCallback"; } //---------------------------------------------------------------------- diff --git a/src/include/final/fcharmap.h b/src/include/final/fcharmap.h index 79571fcd..9d20d745 100644 --- a/src/include/final/fcharmap.h +++ b/src/include/final/fcharmap.h @@ -36,17 +36,10 @@ namespace finalcut namespace fc { -extern uInt character[][fc::NUM_OF_ENCODINGS]; -extern const std::size_t last_char_item; - -extern const int vt100_key_to_utf8[][2]; -extern const std::size_t last_key_item; - -extern const wchar_t cp437_ucs[][2]; -extern const std::size_t last_cp437_item; - -extern const wchar_t halfwidth_fullwidth[][2]; -extern const std::size_t last_halfwidth_item; +extern std::array, 115> character; +extern const std::array, 39> vt100_key_to_utf8; +extern const std::array, 256> cp437_ucs; +extern const std::array, 227> halfwidth_fullwidth; } // namespace fc diff --git a/src/include/final/fcheckbox.h b/src/include/final/fcheckbox.h index 07c5626d..40e74bb7 100644 --- a/src/include/final/fcheckbox.h +++ b/src/include/final/fcheckbox.h @@ -78,7 +78,7 @@ class FCheckBox : public FToggleButton FCheckBox& operator = (const FCheckBox&) = delete; // Accessor - const FString getClassName() const override; + FString getClassName() const override; private: // Methods @@ -91,7 +91,7 @@ class FCheckBox : public FToggleButton // FCheckBox inline functions //---------------------------------------------------------------------- -inline const FString FCheckBox::getClassName() const +inline FString FCheckBox::getClassName() const { return "FCheckBox"; } } // namespace finalcut diff --git a/src/include/final/fcheckmenuitem.h b/src/include/final/fcheckmenuitem.h index 82cb04ec..c5ea112b 100644 --- a/src/include/final/fcheckmenuitem.h +++ b/src/include/final/fcheckmenuitem.h @@ -78,7 +78,7 @@ class FCheckMenuItem : public FMenuItem FCheckMenuItem& operator = (const FCheckMenuItem&) = delete; // Accessor - const FString getClassName() const override; + FString getClassName() const override; private: // Methods @@ -89,7 +89,7 @@ class FCheckMenuItem : public FMenuItem // FCheckMenuItem inline functions //---------------------------------------------------------------------- -inline const FString FCheckMenuItem::getClassName() const +inline FString FCheckMenuItem::getClassName() const { return "FCheckMenuItem"; } } // namespace finalcut diff --git a/src/include/final/fcolorpair.h b/src/include/final/fcolorpair.h index badcf497..7309fc54 100644 --- a/src/include/final/fcolorpair.h +++ b/src/include/final/fcolorpair.h @@ -65,7 +65,7 @@ class FColorPair FColorPair& operator = (const FColorPair& pair) = default; // Accessor - const FString getClassName() const + FString getClassName() const { return "FColorPair"; } FColor getForegroundColor() const diff --git a/src/include/final/fcolorpalette.h b/src/include/final/fcolorpalette.h index 606ab79c..d5e781cb 100644 --- a/src/include/final/fcolorpalette.h +++ b/src/include/final/fcolorpalette.h @@ -59,7 +59,7 @@ class FColorPalette virtual ~FColorPalette(); // Accessor - virtual const FString getClassName() const; + virtual FString getClassName() const; // Methods virtual void setColorPalette() = 0; @@ -76,7 +76,7 @@ class FColorPalette // FColorPalette inline functions //---------------------------------------------------------------------- -inline const FString FColorPalette::getClassName() const +inline FString FColorPalette::getClassName() const { return "FColorPalette"; } @@ -107,7 +107,7 @@ class default8ColorPalette final : public FColorPalette ~default8ColorPalette(); // Accessor - const FString getClassName() const override; + FString getClassName() const override; // Methods void setColorPalette() override; @@ -116,7 +116,7 @@ class default8ColorPalette final : public FColorPalette // default8ColorPalette inline functions //---------------------------------------------------------------------- -inline const FString default8ColorPalette::getClassName() const +inline FString default8ColorPalette::getClassName() const { return "default8ColorPalette"; } @@ -147,7 +147,7 @@ class default16ColorPalette final : public FColorPalette ~default16ColorPalette(); // Accessor - const FString getClassName() const override; + FString getClassName() const override; // Methods void setColorPalette() override; @@ -156,7 +156,7 @@ class default16ColorPalette final : public FColorPalette // default16ColorPalette inline functions //---------------------------------------------------------------------- -inline const FString default16ColorPalette::getClassName() const +inline FString default16ColorPalette::getClassName() const { return "default16ColorPalette"; } /* Inheritance diagram @@ -186,7 +186,7 @@ class default16DarkColorPalette final : public FColorPalette ~default16DarkColorPalette(); // Accessor - const FString getClassName() const override; + FString getClassName() const override; // Methods void setColorPalette() override; @@ -195,7 +195,7 @@ class default16DarkColorPalette final : public FColorPalette // default16ColorPalette inline functions //---------------------------------------------------------------------- -inline const FString default16DarkColorPalette::getClassName() const +inline FString default16DarkColorPalette::getClassName() const { return "default16DarkColorPalette"; } } // namespace finalcut diff --git a/src/include/final/fcombobox.h b/src/include/final/fcombobox.h index b6758717..5949deb8 100644 --- a/src/include/final/fcombobox.h +++ b/src/include/final/fcombobox.h @@ -84,7 +84,7 @@ class FDropDownListBox : public FWindow FDropDownListBox& operator = (const FDropDownListBox&) = delete; // Accessors - const FString getClassName() const override; + FString getClassName() const override; // Mutators void setGeometry ( const FPoint&, const FSize& @@ -115,7 +115,7 @@ class FDropDownListBox : public FWindow // FDropDownListBox inline functions //---------------------------------------------------------------------- -inline const FString FDropDownListBox::getClassName() const +inline FString FDropDownListBox::getClassName() const { return "FDropDownListBox"; } //---------------------------------------------------------------------- @@ -148,7 +148,7 @@ class FComboBox : public FWidget // Overloaded operators // Accessors - const FString getClassName() const override; + FString getClassName() const override; std::size_t getCount() const; FString getText() const; template @@ -239,7 +239,7 @@ bool closeComboBox (FDropDownListBox*, const FPoint&); // FComboBox inline functions //---------------------------------------------------------------------- -inline const FString FComboBox::getClassName() const +inline FString FComboBox::getClassName() const { return "FComboBox"; } //---------------------------------------------------------------------- diff --git a/src/include/final/fdata.h b/src/include/final/fdata.h index a5aa27e5..70e5bcab 100644 --- a/src/include/final/fdata.h +++ b/src/include/final/fdata.h @@ -124,7 +124,7 @@ class FDataAccess virtual ~FDataAccess(); // Accessors - virtual const FString getClassName() const + virtual FString getClassName() const { return "FDataAccess"; } @@ -225,7 +225,7 @@ class FData : public FDataAccess } // Accessors - const FString getClassName() const override + FString getClassName() const override { return "FData"; } diff --git a/src/include/final/fdialog.h b/src/include/final/fdialog.h index 64e903d4..4288332f 100644 --- a/src/include/final/fdialog.h +++ b/src/include/final/fdialog.h @@ -91,8 +91,8 @@ class FDialog : public FWindow FDialog& operator = (const FDialog&) = delete; // Accessors - const FString getClassName() const override; - virtual const FString getText() const; + FString getClassName() const override; + virtual FString getText() const; // Mutators bool setDialogWidget (bool); @@ -200,6 +200,8 @@ class FDialog : public FWindow void raiseActivateDialog(); void lowerActivateDialog(); bool isOutsideTerminal (const FPoint&) const; + bool isLeftOutside(); + bool isBottomOutside(); bool isLowerRightResizeCorner (const mouseStates&) const; void resizeMouseDown (const mouseStates&); void resizeMouseUpMove (const mouseStates&, bool = false); @@ -237,11 +239,11 @@ class FDialog : public FWindow // FDialog inline functions //---------------------------------------------------------------------- -inline const FString FDialog::getClassName() const +inline FString FDialog::getClassName() const { return "FDialog"; } //---------------------------------------------------------------------- -inline const FString FDialog::getText() const +inline FString FDialog::getText() const { return tb_text; } //---------------------------------------------------------------------- diff --git a/src/include/final/fdialoglistmenu.h b/src/include/final/fdialoglistmenu.h index e80f8953..f753242e 100644 --- a/src/include/final/fdialoglistmenu.h +++ b/src/include/final/fdialoglistmenu.h @@ -84,7 +84,7 @@ class FDialogListMenu : public FMenu FDialogListMenu& operator = (const FDialogListMenu&) = delete; // Accessors - const FString getClassName() const override; + FString getClassName() const override; private: // Method @@ -94,7 +94,7 @@ class FDialogListMenu : public FMenu // FDialogListMenu inline functions //---------------------------------------------------------------------- -inline const FString FDialogListMenu::getClassName() const +inline FString FDialogListMenu::getClassName() const { return "FDialogListMenu"; } } // namespace finalcut diff --git a/src/include/final/fevent.h b/src/include/final/fevent.h index da0313cf..74a27d04 100644 --- a/src/include/final/fevent.h +++ b/src/include/final/fevent.h @@ -80,6 +80,8 @@ #error "Only can be included directly." #endif +#include + #include "final/fc.h" #include "final/fdata.h" #include "final/fpoint.h" @@ -185,9 +187,9 @@ class FWheelEvent : public FEvent // wheel event int getWheel() const; private: - FPoint p; - FPoint tp; - int w; + FPoint p{}; + FPoint tp{}; + int w{}; }; @@ -354,9 +356,12 @@ class FUserEvent : public FEvent // user event void setData (T&&); private: + // Using-declaration + using FDataAccessPtr = std::shared_ptr; + + // Data members int uid{0}; - FDataAccess* data_pointer{nullptr}; - bool external_data_pointer{false}; + FDataAccessPtr data_pointer{nullptr}; }; //---------------------------------------------------------------------- @@ -377,15 +382,14 @@ inline clean_fdata_t& FUserEvent::getData() const template inline void FUserEvent::setFDataObject (T&& fdata) { - external_data_pointer = true; - data_pointer = &(std::forward(fdata)); + data_pointer.reset(&(std::forward(fdata))); } + //---------------------------------------------------------------------- template inline void FUserEvent::setData (T&& data) { - external_data_pointer = false; - data_pointer = makeFData(std::forward(data)); + data_pointer.reset(makeFData(std::forward(data))); } } // namespace finalcut diff --git a/src/include/final/ffiledialog.h b/src/include/final/ffiledialog.h index eb4ab939..b18f1ba0 100644 --- a/src/include/final/ffiledialog.h +++ b/src/include/final/ffiledialog.h @@ -112,10 +112,10 @@ class FFileDialog : public FDialog FFileDialog& operator = (const FFileDialog&); // Accessors - const FString getClassName() const override; - const FString getPath() const; - const FString getFilter() const; - const FString getSelectedFile() const; + FString getClassName() const override; + FString getPath() const; + FString getFilter() const; + FString getSelectedFile() const; bool getShowHiddenFiles() const; // Mutators @@ -129,12 +129,12 @@ class FFileDialog : public FDialog void onKeyPress (FKeyEvent*) override; // Methods - static const FString fileOpenChooser ( FWidget* - , const FString& = FString() - , const FString& = FString() ); - static const FString fileSaveChooser ( FWidget* - , const FString& = FString() - , const FString& = FString() ); + static FString fileOpenChooser ( FWidget* + , const FString& = FString() + , const FString& = FString() ); + static FString fileSaveChooser ( FWidget* + , const FString& = FString() + , const FString& = FString() ); protected: // Method @@ -203,7 +203,7 @@ class FFileDialog : public FDialog void selectDirectoryEntry (const char* const); int changeDir (const FString&); void printPath (const FString&); - static const FString getHomeDir(); + static FString getHomeDir(); // Callback methods void cb_processActivate(); @@ -232,23 +232,23 @@ class FFileDialog : public FDialog , const FFileDialog::FDirEntry& ); friend bool sortDirFirst ( const FFileDialog::FDirEntry& , const FFileDialog::FDirEntry& ); - friend const FString fileChooser ( FWidget* - , const FString& - , const FString& - , FFileDialog::DialogType); + friend FString fileChooser ( FWidget* + , const FString& + , const FString& + , FFileDialog::DialogType); }; // FMessageBox inline functions //---------------------------------------------------------------------- -inline const FString FFileDialog::getClassName() const +inline FString FFileDialog::getClassName() const { return "FFileDialog"; } //---------------------------------------------------------------------- -inline const FString FFileDialog::getPath() const +inline FString FFileDialog::getPath() const { return directory; } //---------------------------------------------------------------------- -inline const FString FFileDialog::getFilter() const +inline FString FFileDialog::getFilter() const { return filter_pattern; } //---------------------------------------------------------------------- diff --git a/src/include/final/fkey_map.h b/src/include/final/fkey_map.h index 12dfaa57..b3465059 100644 --- a/src/include/final/fkey_map.h +++ b/src/include/final/fkey_map.h @@ -33,9 +33,9 @@ namespace finalcut namespace fc { -extern FKeyMap fkey[]; -extern const FMetakeyMap fmetakey[]; -extern const FKeyName fkeyname[]; +extern std::array fkey; +extern const std::array fmetakey; +extern const std::array fkeyname; } // namespace fc diff --git a/src/include/final/fkeyboard.h b/src/include/final/fkeyboard.h index 6f090aa7..70f6a483 100644 --- a/src/include/final/fkeyboard.h +++ b/src/include/final/fkeyboard.h @@ -36,7 +36,11 @@ #endif #include + +#include #include +#include + #include "final/fstring.h" #include "final/ftypes.h" @@ -99,16 +103,17 @@ class FKeyboard final FKeyboard& operator = (const FKeyboard&) = delete; // Accessors - const FString getClassName() const; + FString getClassName() const; FKey getKey() const; - const FString getKeyName (const FKey) const; + FString getKeyName (const FKey) const; keybuffer& getKeyBuffer(); timeval* getKeyPressedTime(); static uInt64 getKeypressTimeout(); static uInt64 getReadBlockingTime(); // Mutators - void setTermcapMap (fc::FKeyMap*); + template + void setTermcapMap (const T&); static void setKeypressTimeout (const uInt64); static void setReadBlockingTime (const uInt64); void enableUTF8(); @@ -132,6 +137,9 @@ class FKeyboard final void escapeKeyHandling(); private: + // Using-declaration + using FKeyMapPtr = std::shared_ptr>; + // Constants static constexpr FKey NOT_SET = static_cast(-1); @@ -176,7 +184,7 @@ class FKeyboard final static uInt64 read_blocking_time; static uInt64 key_timeout; static uInt64 interval_timeout; - fc::FKeyMap* key_map{nullptr}; + FKeyMapPtr key_map{}; FKey key{0}; uChar read_character{}; char fifo_buf[FIFO_BUF_SIZE]{'\0'}; @@ -191,7 +199,7 @@ class FKeyboard final // FKeyboard inline functions //---------------------------------------------------------------------- -inline const FString FKeyboard::getClassName() const +inline FString FKeyboard::getClassName() const { return "FKeyboard"; } //---------------------------------------------------------------------- @@ -214,6 +222,11 @@ inline uInt64 FKeyboard::getKeypressTimeout() inline uInt64 FKeyboard::getReadBlockingTime() { return read_blocking_time; } +//---------------------------------------------------------------------- +template +inline void FKeyboard::setTermcapMap (const T& keymap) +{ key_map = std::make_shared(keymap); } + //---------------------------------------------------------------------- inline void FKeyboard::setKeypressTimeout (const uInt64 timeout) { key_timeout = timeout; } diff --git a/src/include/final/flabel.h b/src/include/final/flabel.h index d9c82cef..b6e7a637 100644 --- a/src/include/final/flabel.h +++ b/src/include/final/flabel.h @@ -87,7 +87,7 @@ class FLabel : public FWidget const FLabel& operator >> (FString&) const; // Accessors - const FString getClassName() const override; + FString getClassName() const override; FWidget* getAccelWidget(); fc::text_alignment getAlignment() const; FString& getText(); @@ -127,7 +127,7 @@ class FLabel : public FWidget private: // Constants - static constexpr std::size_t NOT_SET = static_cast(-1); + static constexpr auto NOT_SET = static_cast(-1); // Methods void init(); @@ -165,7 +165,7 @@ inline FLabel& FLabel::operator << (const typeT& s) } //---------------------------------------------------------------------- -inline const FString FLabel::getClassName() const +inline FString FLabel::getClassName() const { return "FLabel"; } //---------------------------------------------------------------------- diff --git a/src/include/final/flineedit.h b/src/include/final/flineedit.h index 25c36aa9..cedeadfc 100644 --- a/src/include/final/flineedit.h +++ b/src/include/final/flineedit.h @@ -103,7 +103,7 @@ class FLineEdit : public FWidget const FLineEdit& operator >> (FString&) const; // Accessors - const FString getClassName() const override; + FString getClassName() const override; FString getText() const; std::size_t getMaxLength() const; std::size_t getCursorPosition() const; @@ -175,7 +175,7 @@ class FLineEdit : public FWidget }; // Constants - static constexpr std::size_t NOT_SET = static_cast(-1); + static constexpr auto NOT_SET = static_cast(-1); // Methods void init(); @@ -237,7 +237,7 @@ inline FLineEdit& FLineEdit::operator << (const typeT& s) } //---------------------------------------------------------------------- -inline const FString FLineEdit::getClassName() const +inline FString FLineEdit::getClassName() const { return "FLineEdit"; } //---------------------------------------------------------------------- diff --git a/src/include/final/flistbox.h b/src/include/final/flistbox.h index 7c923e0a..e2a99540 100644 --- a/src/include/final/flistbox.h +++ b/src/include/final/flistbox.h @@ -48,6 +48,7 @@ #error "Only can be included directly." #endif +#include #include #include @@ -83,7 +84,7 @@ class FListBoxItem FListBoxItem& operator = (const FListBoxItem&); // Accessors - virtual const FString getClassName() const; + virtual FString getClassName() const; virtual FString getText() const; template clean_fdata_t
& getData() const; @@ -97,9 +98,12 @@ class FListBoxItem void clear(); private: + // Using-declaration + using FDataAccessPtr = std::shared_ptr; + // Data members FString text{}; - FDataAccess* data_pointer{nullptr}; + FDataAccessPtr data_pointer{}; fc::brackets_type brackets{fc::NoBrackets}; bool selected{false}; @@ -117,7 +121,7 @@ inline FListBoxItem::FListBoxItem (const FString& txt, DT&& data) { } //---------------------------------------------------------------------- -inline const FString FListBoxItem::getClassName() const +inline FString FListBoxItem::getClassName() const { return "FListBoxItem"; } //---------------------------------------------------------------------- @@ -139,7 +143,8 @@ inline void FListBoxItem::setText (const FString& txt) template inline void FListBoxItem::setData (DT&& data) { - data_pointer = makeFData(std::forward
(data)); + const auto data_obj = makeFData(std::forward
(data)); + data_pointer.reset(data_obj); } //---------------------------------------------------------------------- @@ -179,7 +184,7 @@ class FListBox : public FWidget FListBox& operator = (const FListBox&) = delete; // Accessors - const FString getClassName() const override; + FString getClassName() const override; std::size_t getCount() const; FListBoxItem& getItem (std::size_t); const FListBoxItem& getItem (std::size_t) const; @@ -415,7 +420,7 @@ inline FListBox::FListBox ( Container container } //---------------------------------------------------------------------- -inline const FString FListBox::getClassName() const +inline FString FListBox::getClassName() const { return "FListBox"; } //---------------------------------------------------------------------- diff --git a/src/include/final/flistview.h b/src/include/final/flistview.h index 5052fbea..0c44ab21 100644 --- a/src/include/final/flistview.h +++ b/src/include/final/flistview.h @@ -48,6 +48,7 @@ #endif #include +#include #include #include #include @@ -86,7 +87,7 @@ class FListViewItem : public FObject FListViewItem& operator = (const FListViewItem&); // Accessors - const FString getClassName() const override; + FString getClassName() const override; uInt getColumnCount() const; int getSortColumn() const; FString getText (int) const; @@ -113,6 +114,9 @@ class FListViewItem : public FObject void collapse(); private: + // Using-declaration + using FDataAccessPtr = std::shared_ptr; + // Inquiry bool isExpandable() const; bool isCheckable() const; @@ -127,7 +131,7 @@ class FListViewItem : public FObject // Data members FStringList column_list{}; - FDataAccess* data_pointer{nullptr}; + FDataAccessPtr data_pointer{}; iterator root{}; std::size_t visible_lines{1}; bool expandable{false}; @@ -159,7 +163,7 @@ inline FListViewItem::FListViewItem ( const FStringList& cols } //---------------------------------------------------------------------- -inline const FString FListViewItem::getClassName() const +inline FString FListViewItem::getClassName() const { return "FListViewItem"; } //---------------------------------------------------------------------- @@ -177,7 +181,8 @@ inline clean_fdata_t
& FListViewItem::getData() const template inline void FListViewItem::setData (DT&& data) { - data_pointer = makeFData(std::forward
(data)); + const auto data_obj = makeFData(std::forward
(data)); + data_pointer = data_obj; } //---------------------------------------------------------------------- @@ -237,7 +242,7 @@ class FListViewIterator bool operator != (const FListViewIterator&) const; // Accessor - const FString getClassName() const; + FString getClassName() const; int& getPosition(); // Methods @@ -273,7 +278,7 @@ inline bool FListViewIterator::operator != (const FListViewIterator& rhs) const { return node != rhs.node; } //---------------------------------------------------------------------- -inline const FString FListViewIterator::getClassName() const +inline FString FListViewIterator::getClassName() const { return "FListViewIterator"; } //---------------------------------------------------------------------- @@ -304,7 +309,7 @@ class FListView : public FWidget FListView& operator = (const FListView&) = delete; // Accessors - const FString getClassName() const override; + FString getClassName() const override; std::size_t getCount() const; fc::text_alignment getColumnAlignment (int) const; FString getColumnText (int) const; @@ -545,7 +550,7 @@ struct FListView::Header // FListView inline functions //---------------------------------------------------------------------- -inline const FString FListView::getClassName() const +inline FString FListView::getClassName() const { return "FListView"; } //---------------------------------------------------------------------- diff --git a/src/include/final/flog.h b/src/include/final/flog.h index 5fafbc83..92f0e6f9 100644 --- a/src/include/final/flog.h +++ b/src/include/final/flog.h @@ -84,7 +84,7 @@ class FLog : public std::stringbuf FLog& operator << (IOManip); FLog& operator << (LogLevel); - virtual const FString getClassName() const; + virtual FString getClassName() const; virtual void info (const std::string&) = 0; virtual void warn (const std::string&) = 0; virtual void error (const std::string&) = 0; @@ -130,7 +130,7 @@ inline FLog& FLog::operator << (IOManip pf) } //---------------------------------------------------------------------- -inline const FString FLog::getClassName() const +inline FString FLog::getClassName() const { return "FLog"; } //---------------------------------------------------------------------- diff --git a/src/include/final/flogger.h b/src/include/final/flogger.h index 2811bc67..5f0d64ea 100644 --- a/src/include/final/flogger.h +++ b/src/include/final/flogger.h @@ -72,7 +72,7 @@ class FLogger : public FLog ~FLogger() override; // Methods - const FString getClassName() const override; + FString getClassName() const override; void info (const std::string&) override; void warn (const std::string&) override; void error (const std::string&) override; @@ -86,8 +86,8 @@ class FLogger : public FLog private: // Methods void newlineReplace (std::string&, const std::string&) const; - const std::string getTimeString() const; - const std::string getEOL() const; + std::string getTimeString() const; + std::string getEOL() const; void printLogLine (const std::string&); // Data member @@ -97,7 +97,7 @@ class FLogger : public FLog // FLogger inline functions //---------------------------------------------------------------------- -inline const FString FLogger::getClassName() const +inline FString FLogger::getClassName() const { return "FLogger"; } //---------------------------------------------------------------------- diff --git a/src/include/final/fmenu.h b/src/include/final/fmenu.h index 30727eca..cda08e57 100644 --- a/src/include/final/fmenu.h +++ b/src/include/final/fmenu.h @@ -91,7 +91,7 @@ class FMenu : public FWindow, public FMenuList FMenu& operator = (const FMenu&) = delete; // Accessors - const FString getClassName() const override; + FString getClassName() const override; FString getText() const; FMenuItem* getItem(); @@ -133,7 +133,7 @@ class FMenu : public FWindow, public FMenuList private: // Constants - static constexpr std::size_t NOT_SET = static_cast(-1); + static constexpr auto NOT_SET = static_cast(-1); static constexpr bool SELECT_ITEM = true; // Typedef @@ -248,7 +248,7 @@ std::tuple closeOpenMenus (FMenu*, const FPoint&); // FMenu inline functions //---------------------------------------------------------------------- -inline const FString FMenu::getClassName() const +inline FString FMenu::getClassName() const { return "FMenu"; } //---------------------------------------------------------------------- diff --git a/src/include/final/fmenubar.h b/src/include/final/fmenubar.h index 40961246..ec51b27f 100644 --- a/src/include/final/fmenubar.h +++ b/src/include/final/fmenubar.h @@ -83,7 +83,7 @@ class FMenuBar : public FWindow, public FMenuList FMenuBar& operator = (const FMenuBar&) = delete; // Accessors - const FString getClassName() const override; + FString getClassName() const override; // Methods void resetColors() override; @@ -103,7 +103,7 @@ class FMenuBar : public FWindow, public FMenuList private: // Constants - static constexpr std::size_t NOT_SET = static_cast(-1); + static constexpr auto NOT_SET = static_cast(-1); // Typedef typedef struct @@ -157,7 +157,7 @@ class FMenuBar : public FWindow, public FMenuList // FMenuBar inline functions //---------------------------------------------------------------------- -inline const FString FMenuBar::getClassName() const +inline FString FMenuBar::getClassName() const { return "FMenuBar"; } //---------------------------------------------------------------------- diff --git a/src/include/final/fmenuitem.h b/src/include/final/fmenuitem.h index c535e1ca..c48b8962 100644 --- a/src/include/final/fmenuitem.h +++ b/src/include/final/fmenuitem.h @@ -88,7 +88,7 @@ class FMenuItem : public FWidget FMenuItem& operator = (const FMenuItem&) = delete; // Accessors - const FString getClassName() const override; + FString getClassName() const override; FKey getHotkey() const; FMenu* getMenu() const; std::size_t getTextLength() const; @@ -196,7 +196,7 @@ class FMenuItem : public FWidget // FMenuItem inline functions //---------------------------------------------------------------------- -inline const FString FMenuItem::getClassName() const +inline FString FMenuItem::getClassName() const { return "FMenuItem"; } //---------------------------------------------------------------------- diff --git a/src/include/final/fmenulist.h b/src/include/final/fmenulist.h index ec77e07a..6f34a8e1 100644 --- a/src/include/final/fmenulist.h +++ b/src/include/final/fmenulist.h @@ -71,7 +71,7 @@ class FMenuList FMenuList& operator = (const FMenuList&) = delete; // Accessors - virtual const FString getClassName() const; + virtual FString getClassName() const; std::size_t getCount() const; FMenuItem* getItem (int) const; FMenuItem* getSelectedItem() const; @@ -104,7 +104,7 @@ class FMenuList // FMenuList inline functions //---------------------------------------------------------------------- -inline const FString FMenuList::getClassName() const +inline FString FMenuList::getClassName() const { return "FMenuList"; } //---------------------------------------------------------------------- diff --git a/src/include/final/fmessagebox.h b/src/include/final/fmessagebox.h index 22a63bfa..4b79c0c5 100644 --- a/src/include/final/fmessagebox.h +++ b/src/include/final/fmessagebox.h @@ -92,7 +92,7 @@ class FMessageBox : public FDialog explicit FMessageBox (FWidget* = nullptr); FMessageBox (const FMessageBox&); // copy constructor FMessageBox ( const FString&, const FString& - , int, int, int + , ButtonType, ButtonType, ButtonType , FWidget* = nullptr ); // Destructor ~FMessageBox() override; @@ -101,10 +101,10 @@ class FMessageBox : public FDialog FMessageBox& operator = (const FMessageBox&); // Accessor - const FString getClassName() const override; - const FString getTitlebarText() const; - const FString getHeadline() const; - const FString getText() const override; + FString getClassName() const override; + FString getTitlebarText() const; + FString getHeadline() const; + FString getText() const override; // Mutator void setTitlebarText (const FString&); @@ -119,22 +119,22 @@ class FMessageBox : public FDialog static int info ( FWidget* , const FString& , const messageType& - , int = FMessageBox::Ok - , int = 0 - , int = 0 ); + , ButtonType = FMessageBox::Ok + , ButtonType = FMessageBox::Reject + , ButtonType = FMessageBox::Reject ); template static int error ( FWidget* , const messageType& - , int = FMessageBox::Ok - , int = 0 - , int = 0 ); + , ButtonType = FMessageBox::Ok + , ButtonType = FMessageBox::Reject + , ButtonType = FMessageBox::Reject ); protected: // Method void adjustSize() override; // Callback method - void cb_processClick (int); + void cb_processClick (ButtonType); private: // Constants @@ -157,7 +157,7 @@ class FMessageBox : public FDialog FButton* button[MAX_BUTTONS]{nullptr}; std::size_t max_line_width{0}; FColor emphasis_color{getColorTheme()->dialog_emphasis_fg}; - int button_digit[MAX_BUTTONS]{0}; + ButtonType button_digit[MAX_BUTTONS]{FMessageBox::Reject}; std::size_t num_buttons{0}; std::size_t text_num_lines{0}; bool center_text{false}; @@ -166,22 +166,22 @@ class FMessageBox : public FDialog // FMessageBox inline functions //---------------------------------------------------------------------- -inline const FString FMessageBox::getClassName() const +inline FString FMessageBox::getClassName() const { return "FMessageBox"; } //---------------------------------------------------------------------- -inline const FString FMessageBox::getTitlebarText() const +inline FString FMessageBox::getTitlebarText() const { const FString& title = FDialog::getText(); // initialize text return title; } //---------------------------------------------------------------------- -inline const FString FMessageBox::getHeadline() const +inline FString FMessageBox::getHeadline() const { return headline_text; } //---------------------------------------------------------------------- -inline const FString FMessageBox::getText() const +inline FString FMessageBox::getText() const { return text; } //---------------------------------------------------------------------- @@ -205,9 +205,9 @@ template int FMessageBox::info ( FWidget* parent , const FString& caption , const messageType& message - , int button0 - , int button1 - , int button2 ) + , ButtonType button0 + , ButtonType button1 + , ButtonType button2 ) { FMessageBox mbox ( caption , FString() << message @@ -221,9 +221,9 @@ int FMessageBox::info ( FWidget* parent template int FMessageBox::error ( FWidget* parent , const messageType& message - , int button0 - , int button1 - , int button2 ) + , ButtonType button0 + , ButtonType button1 + , ButtonType button2 ) { const FString caption{"Error message"}; diff --git a/src/include/final/fmouse.h b/src/include/final/fmouse.h index 7d912232..a0a22e02 100644 --- a/src/include/final/fmouse.h +++ b/src/include/final/fmouse.h @@ -102,7 +102,7 @@ class FMouse { } // Accessors - virtual const FString getClassName() const; + virtual FString getClassName() const; const FPoint& getPos() const; void clearEvent(); @@ -215,7 +215,7 @@ class FMouseGPM final : public FMouse ~FMouseGPM() override; // Accessors - const FString getClassName() const override; + FString getClassName() const override; // Mutators void setStdinNo(int); @@ -283,7 +283,7 @@ class FMouseX11 final : public FMouse ~FMouseX11() override = default; // Accessors - const FString getClassName() const override; + FString getClassName() const override; // Inquiry bool hasData() override; @@ -342,7 +342,7 @@ class FMouseSGR final : public FMouse ~FMouseSGR() override = default; // Accessors - const FString getClassName() const override; + FString getClassName() const override; // Inquiry bool hasData() override; @@ -401,7 +401,7 @@ class FMouseUrxvt final : public FMouse ~FMouseUrxvt() override = default; // Accessors - const FString getClassName() const override; + FString getClassName() const override; // Inquiry bool hasData() override; @@ -466,7 +466,7 @@ class FMouseControl FMouseControl& operator = (const FMouseControl&) = delete; // Accessors - virtual const FString getClassName() const; + virtual FString getClassName() const; const FPoint& getPos(); void clearEvent(); @@ -526,7 +526,7 @@ class FMouseControl // FMouseControl inline functions //---------------------------------------------------------------------- -inline const FString FMouseControl::getClassName() const +inline FString FMouseControl::getClassName() const { return "FMouseControl"; } //---------------------------------------------------------------------- diff --git a/src/include/final/fobject.h b/src/include/final/fobject.h index 0a7217ae..836b8fbe 100644 --- a/src/include/final/fobject.h +++ b/src/include/final/fobject.h @@ -79,7 +79,7 @@ class FObject typedef FObjectList::const_iterator const_iterator; // Constants - static constexpr std::size_t UNLIMITED = static_cast(-1); + static constexpr auto UNLIMITED = static_cast(-1); // Constructor explicit FObject (FObject* = nullptr); @@ -94,7 +94,7 @@ class FObject FObject& operator = (const FObject&) = delete; // Accessors - virtual const FString getClassName() const; + virtual FString getClassName() const; FObject* getParent() const; FObject* getChild (int) const; FObjectList& getChildren(); @@ -176,7 +176,7 @@ class FObject //---------------------------------------------------------------------- -inline const FString FObject::getClassName() const +inline FString FObject::getClassName() const { return "FObject"; } //---------------------------------------------------------------------- diff --git a/src/include/final/foptiattr.h b/src/include/final/foptiattr.h index 76c4d37b..ddd28571 100644 --- a/src/include/final/foptiattr.h +++ b/src/include/final/foptiattr.h @@ -107,7 +107,7 @@ class FOptiAttr final FOptiAttr& operator = (const FOptiAttr&) = delete; // Accessors - const FString getClassName() const; + FString getClassName() const; // Mutators void setTermEnvironment (const termEnv&); @@ -318,7 +318,7 @@ class FOptiAttr final // FOptiAttr inline functions //---------------------------------------------------------------------- -inline const FString FOptiAttr::getClassName() const +inline FString FOptiAttr::getClassName() const { return "FOptiAttr"; } //---------------------------------------------------------------------- diff --git a/src/include/final/foptimove.h b/src/include/final/foptimove.h index dc02ca5a..f30a5d87 100644 --- a/src/include/final/foptimove.h +++ b/src/include/final/foptimove.h @@ -92,7 +92,7 @@ class FOptiMove final ~FOptiMove(); // Accessors - const FString getClassName() const; + FString getClassName() const; uInt getCursorHomeLength() const; uInt getCarriageReturnLength() const; uInt getCursorToLLLength() const; @@ -224,7 +224,7 @@ class FOptiMove final // FOptiMove inline functions //---------------------------------------------------------------------- -inline const FString FOptiMove::getClassName() const +inline FString FOptiMove::getClassName() const { return "FOptiMove"; } //---------------------------------------------------------------------- diff --git a/src/include/final/fpoint.h b/src/include/final/fpoint.h index 981d43cd..17ba5628 100644 --- a/src/include/final/fpoint.h +++ b/src/include/final/fpoint.h @@ -66,7 +66,7 @@ class FPoint FPoint& operator -= (const FPoint&); // Accessors - virtual const FString getClassName(); + virtual FString getClassName(); int getX() const; int getY() const; void setX (int); @@ -93,9 +93,9 @@ class FPoint // Friend operator functions friend bool operator == (const FPoint&, const FPoint&); friend bool operator != (const FPoint&, const FPoint&); - friend const FPoint operator + (const FPoint&, const FPoint&); - friend const FPoint operator - (const FPoint&, const FPoint&); - friend const FPoint operator - (const FPoint&); + friend FPoint operator + (const FPoint&, const FPoint&); + friend FPoint operator - (const FPoint&, const FPoint&); + friend FPoint operator - (const FPoint&); friend std::ostream& operator << (std::ostream&, const FPoint&); friend std::istream& operator >> (std::istream&, FPoint&); }; @@ -121,7 +121,7 @@ inline FPoint::FPoint (int x, int y) { } //---------------------------------------------------------------------- -inline const FString FPoint::getClassName() +inline FString FPoint::getClassName() { return "FPoint"; } //---------------------------------------------------------------------- @@ -155,15 +155,15 @@ inline bool operator != (const FPoint& p1, const FPoint& p2) { return p1.xpos != p2.xpos || p1.ypos != p2.ypos; } //---------------------------------------------------------------------- -inline const FPoint operator + (const FPoint& p1, const FPoint& p2) +inline FPoint operator + (const FPoint& p1, const FPoint& p2) { return {p1.xpos + p2.xpos, p1.ypos + p2.ypos}; } //---------------------------------------------------------------------- -inline const FPoint operator - (const FPoint& p1, const FPoint& p2) +inline FPoint operator - (const FPoint& p1, const FPoint& p2) { return {p1.xpos - p2.xpos, p1.ypos - p2.ypos}; } //---------------------------------------------------------------------- -inline const FPoint operator - (const FPoint& p) +inline FPoint operator - (const FPoint& p) { return {-p.xpos, -p.ypos}; } } // namespace finalcut diff --git a/src/include/final/fprogressbar.h b/src/include/final/fprogressbar.h index 8f6bd4e8..05d2005b 100644 --- a/src/include/final/fprogressbar.h +++ b/src/include/final/fprogressbar.h @@ -69,7 +69,7 @@ class FProgressbar : public FWidget ~FProgressbar() override; // Accessors - const FString getClassName() const override; + FString getClassName() const override; std::size_t getPercentage() const; // Mutators @@ -90,7 +90,7 @@ class FProgressbar : public FWidget private: // Constants - static constexpr std::size_t NOT_SET = static_cast(-1); + static constexpr auto NOT_SET = static_cast(-1); // Methods void init(); @@ -108,7 +108,7 @@ class FProgressbar : public FWidget // FProgressbar inline functions //---------------------------------------------------------------------- -inline const FString FProgressbar::getClassName() const +inline FString FProgressbar::getClassName() const { return "FProgressbar"; } //---------------------------------------------------------------------- diff --git a/src/include/final/fradiobutton.h b/src/include/final/fradiobutton.h index d00410b8..5187017f 100644 --- a/src/include/final/fradiobutton.h +++ b/src/include/final/fradiobutton.h @@ -78,7 +78,7 @@ class FRadioButton : public FToggleButton FRadioButton& operator = (const FRadioButton&) = delete; // Accessor - const FString getClassName() const override; + FString getClassName() const override; private: // Methods @@ -92,7 +92,7 @@ class FRadioButton : public FToggleButton // FRadioButton inline functions //---------------------------------------------------------------------- -inline const FString FRadioButton::getClassName() const +inline FString FRadioButton::getClassName() const { return "FRadioButton"; } } // namespace finalcut diff --git a/src/include/final/fradiomenuitem.h b/src/include/final/fradiomenuitem.h index f96672aa..4ba3b0c3 100644 --- a/src/include/final/fradiomenuitem.h +++ b/src/include/final/fradiomenuitem.h @@ -78,7 +78,7 @@ class FRadioMenuItem : public FMenuItem FRadioMenuItem& operator = (const FRadioMenuItem&) = delete; // Accessor - const FString getClassName() const override; + FString getClassName() const override; private: // Methods @@ -89,7 +89,7 @@ class FRadioMenuItem : public FMenuItem // FRadioMenuItem inline functions //---------------------------------------------------------------------- -inline const FString FRadioMenuItem::getClassName() const +inline FString FRadioMenuItem::getClassName() const { return "FRadioMenuItem"; } } // namespace finalcut diff --git a/src/include/final/frect.h b/src/include/final/frect.h index 2f0463de..0768f1ae 100644 --- a/src/include/final/frect.h +++ b/src/include/final/frect.h @@ -74,21 +74,21 @@ class FRect FRect& operator = (FRect&&) noexcept; // Accessors - virtual const FString getClassName(); + virtual FString getClassName(); int getX1() const; int getY1() const; int getX2() const; int getY2() const; int getX() const; int getY() const; - const FPoint getPos() const; - const FPoint getUpperLeftPos() const; - const FPoint getUpperRightPos() const; - const FPoint getLowerLeftPos() const; - const FPoint getLowerRightPos() const; + FPoint getPos() const; + FPoint getUpperLeftPos() const; + FPoint getUpperRightPos() const; + FPoint getLowerLeftPos() const; + FPoint getLowerRightPos() const; std::size_t getWidth() const; std::size_t getHeight() const; - const FSize getSize() const; + FSize getSize() const; // Mutators void setX1 (int); @@ -138,8 +138,8 @@ class FRect int Y2{-1}; // Friend operator functions - friend const FRect operator + (const FRect&, const FSize&); - friend const FRect operator - (const FRect&, const FSize&); + friend FRect operator + (const FRect&, const FSize&); + friend FRect operator - (const FRect&, const FSize&); friend bool operator == (const FRect&, const FRect&); friend bool operator != (const FRect&, const FRect&); friend std::ostream& operator << (std::ostream&, const FRect&); @@ -172,7 +172,7 @@ inline FRect::FRect (int x, int y, std::size_t width, std::size_t height) { } //---------------------------------------------------------------------- -inline const FString FRect::getClassName() +inline FString FRect::getClassName() { return "FRect"; } //---------------------------------------------------------------------- diff --git a/src/include/final/fscrollbar.h b/src/include/final/fscrollbar.h index 856cc7c5..f4b7fe95 100644 --- a/src/include/final/fscrollbar.h +++ b/src/include/final/fscrollbar.h @@ -100,7 +100,7 @@ class FScrollbar : public FWidget FScrollbar& operator = (const FScrollbar&) = delete; // Accessors - const FString getClassName() const override; + FString getClassName() const override; int getValue() const; sType getScrollType() const; @@ -203,7 +203,7 @@ void initScrollbar ( FScrollbarPtr& bar // FScrollbar inline functions //---------------------------------------------------------------------- -inline const FString FScrollbar::getClassName() const +inline FString FScrollbar::getClassName() const { return "FScrollbar"; } //---------------------------------------------------------------------- diff --git a/src/include/final/fscrollview.h b/src/include/final/fscrollview.h index fa3195b8..a3189cd4 100644 --- a/src/include/final/fscrollview.h +++ b/src/include/final/fscrollview.h @@ -80,14 +80,14 @@ class FScrollView : public FWidget FScrollView& operator = (const FScrollView&) = delete; // Accessors - const FString getClassName() const override; + FString getClassName() const override; std::size_t getViewportWidth() const; std::size_t getViewportHeight() const; - const FSize getViewportSize() const; + FSize getViewportSize() const; std::size_t getScrollWidth() const; std::size_t getScrollHeight() const; - const FSize getScrollSize() const; - const FPoint getScrollPos() const; + FSize getScrollSize() const; + FPoint getScrollPos() const; int getScrollX() const; int getScrollY() const; @@ -191,7 +191,7 @@ class FScrollView : public FWidget // FScrollView inline functions //---------------------------------------------------------------------- -inline const FString FScrollView::getClassName() const +inline FString FScrollView::getClassName() const { return "FScrollView"; } //---------------------------------------------------------------------- @@ -203,7 +203,7 @@ inline std::size_t FScrollView::getViewportHeight() const { return getHeight() - horizontal_border_spacing; } //---------------------------------------------------------------------- -inline const FSize FScrollView::getViewportSize() const +inline FSize FScrollView::getViewportSize() const { return FSize(getViewportWidth(), getViewportHeight()); } //---------------------------------------------------------------------- @@ -215,11 +215,11 @@ inline std::size_t FScrollView::getScrollHeight() const { return scroll_geometry.getHeight(); } //---------------------------------------------------------------------- -inline const FSize FScrollView::getScrollSize() const +inline FSize FScrollView::getScrollSize() const { return scroll_geometry.getSize(); } //---------------------------------------------------------------------- -inline const FPoint FScrollView::getScrollPos() const +inline FPoint FScrollView::getScrollPos() const { return viewport_geometry.getPos(); } //---------------------------------------------------------------------- diff --git a/src/include/final/fsize.h b/src/include/final/fsize.h index 6186a06e..9de799ef 100644 --- a/src/include/final/fsize.h +++ b/src/include/final/fsize.h @@ -71,7 +71,7 @@ class FSize FSize& operator -= (const FSize&); // Accessors - virtual const FString getClassName(); + virtual FString getClassName(); std::size_t getWidth() const; std::size_t getHeight() const; std::size_t getArea() const; @@ -103,8 +103,8 @@ class FSize friend bool operator != (const FSize&, const FSize&); friend bool operator >= (const FSize&, const FSize&); friend bool operator > (const FSize&, const FSize&); - friend const FSize operator + (const FSize&, const FSize&); - friend const FSize operator - (const FSize&, const FSize&); + friend FSize operator + (const FSize&, const FSize&); + friend FSize operator - (const FSize&, const FSize&); friend std::ostream& operator << (std::ostream&, const FSize&); friend std::istream& operator >> (std::istream&, FSize&); @@ -130,7 +130,7 @@ inline FSize::FSize (std::size_t w, std::size_t h) { } //---------------------------------------------------------------------- -inline const FString FSize::getClassName() +inline FString FSize::getClassName() { return "FSize"; } //---------------------------------------------------------------------- @@ -180,7 +180,7 @@ inline bool operator > (const FSize& s1, const FSize& s2) { return s1.width > s2.width && s1.height > s2.height; } //---------------------------------------------------------------------- -inline const FSize operator + (const FSize& s1, const FSize& s2) +inline FSize operator + (const FSize& s1, const FSize& s2) { constexpr std::size_t max = std::numeric_limits::max(); const std::size_t w = ( s1.width < max - s2.width) ? s1.width + s2.width : max; @@ -189,7 +189,7 @@ inline const FSize operator + (const FSize& s1, const FSize& s2) } //---------------------------------------------------------------------- -inline const FSize operator - (const FSize& s1, const FSize& s2) +inline FSize operator - (const FSize& s1, const FSize& s2) { const std::size_t w = ( s1.width >= s2.width ) ? s1.width - s2.width : 0; const std::size_t h = ( s1.height >= s2.height ) ? s1.height - s2.height : 0; diff --git a/src/include/final/fspinbox.h b/src/include/final/fspinbox.h index ba419621..b13c306f 100644 --- a/src/include/final/fspinbox.h +++ b/src/include/final/fspinbox.h @@ -80,7 +80,7 @@ class FSpinBox : public FWidget FSpinBox& operator = (const FSpinBox&) = delete; // Accessors - const FString getClassName() const override; + FString getClassName() const override; sInt64 getValue() const; FString getPrefix() const; FString getSuffix() const; @@ -161,7 +161,7 @@ class FSpinBox : public FWidget // FSpinBox inline functions //---------------------------------------------------------------------- -inline const FString FSpinBox::getClassName() const +inline FString FSpinBox::getClassName() const { return "FSpinBox"; } //---------------------------------------------------------------------- diff --git a/src/include/final/fstartoptions.h b/src/include/final/fstartoptions.h index ab5cffae..a5430228 100644 --- a/src/include/final/fstartoptions.h +++ b/src/include/final/fstartoptions.h @@ -65,7 +65,7 @@ class FStartOptions final FStartOptions& operator = (const FStartOptions&) = delete; // Accessors - static const FString getClassName(); + static FString getClassName(); static FStartOptions& getFStartOptions(); // Mutator @@ -102,7 +102,7 @@ class FStartOptions final }; //---------------------------------------------------------------------- -inline const FString FStartOptions::getClassName() +inline FString FStartOptions::getClassName() { return "FStartOptions"; } } // namespace finalcut diff --git a/src/include/final/fstatusbar.h b/src/include/final/fstatusbar.h index 751543e4..9f253a01 100644 --- a/src/include/final/fstatusbar.h +++ b/src/include/final/fstatusbar.h @@ -87,7 +87,7 @@ class FStatusKey : public FWidget FStatusKey& operator = (const FStatusKey&) = delete; // Accessors - const FString getClassName() const override; + FString getClassName() const override; virtual FKey getKey() const; virtual FString getText() const; @@ -128,7 +128,7 @@ class FStatusKey : public FWidget // FStatusKey inline functions //---------------------------------------------------------------------- -inline const FString FStatusKey::getClassName() const +inline FString FStatusKey::getClassName() const { return "FStatusKey"; } //---------------------------------------------------------------------- @@ -196,7 +196,7 @@ class FStatusBar : public FWindow FStatusBar& operator = (const FStatusBar&) = delete; // Accessors - const FString getClassName() const override; + FString getClassName() const override; FStatusKey* getStatusKey (int) const; FString getMessage() const; std::size_t getCount() const; @@ -255,7 +255,7 @@ class FStatusBar : public FWindow // FStatusBar inline functions //---------------------------------------------------------------------- -inline const FString FStatusBar::getClassName() const +inline FString FStatusBar::getClassName() const { return "FStatusBar"; } //---------------------------------------------------------------------- diff --git a/src/include/final/fstring.h b/src/include/final/fstring.h index 78379176..a8bd97a5 100644 --- a/src/include/final/fstring.h +++ b/src/include/final/fstring.h @@ -159,7 +159,7 @@ class FString operator const char* () const { return c_str(); } // Accessor - virtual const FString getClassName() const; + virtual FString getClassName() const; // inquiries bool isNull() const; @@ -185,10 +185,10 @@ class FString wchar_t* wc_str(); const char* c_str() const; char* c_str(); - const std::string toString() const; + std::string toString() const; - const FString toLower() const; - const FString toUpper() const; + FString toLower() const; + FString toUpper() const; sInt16 toShort() const; uInt16 toUShort() const; @@ -199,13 +199,13 @@ class FString float toFloat() const; double toDouble() const; - const FString ltrim() const; - const FString rtrim() const; - const FString trim() const; + FString ltrim() const; + FString rtrim() const; + FString trim() const; - const FString left (std::size_t) const; - const FString right (std::size_t) const; - const FString mid (std::size_t, std::size_t) const; + FString left (std::size_t) const; + FString right (std::size_t) const; + FString mid (std::size_t, std::size_t) const; FStringList split (const FString&) const; FString& setString (const FString&); @@ -224,10 +224,10 @@ class FString const FString& insert (const FString&, int); const FString& insert (const FString&, std::size_t); - const FString replace (const FString&, const FString&) const; + FString replace (const FString&, const FString&) const; - const FString replaceControlCodes() const; - const FString expandTabs (int = 8) const; + FString replaceControlCodes() const; + FString expandTabs (int = 8) const; FString removeDel() const; FString removeBackspaces() const; @@ -261,15 +261,15 @@ class FString static const wchar_t const_null_char; // Friend Non-member operator functions - friend const FString operator + (const FString&, const FString&); - friend const FString operator + (const FString&, const wchar_t); - friend const FString operator + (const std::wstring&, const FString&); - friend const FString operator + (const wchar_t[], const FString&); - friend const FString operator + (const std::string&, const FString&); - friend const FString operator + (const char[], const FString&); - friend const FString operator + (const wchar_t, const FString&); - friend const FString operator + (const char, const FString&); - friend const FString operator + (const FString&, const char); + friend FString operator + (const FString&, const FString&); + friend FString operator + (const FString&, const wchar_t); + friend FString operator + (const std::wstring&, const FString&); + friend FString operator + (const wchar_t[], const FString&); + friend FString operator + (const std::string&, const FString&); + friend FString operator + (const char[], const FString&); + friend FString operator + (const wchar_t, const FString&); + friend FString operator + (const char, const FString&); + friend FString operator + (const FString&, const char); friend std::ostream& operator << (std::ostream&, const FString&); friend std::istream& operator >> (std::istream&, FString& s); @@ -366,7 +366,7 @@ inline bool FString::operator > (const CharT& s) const } //---------------------------------------------------------------------- -inline const FString FString::getClassName() const +inline FString FString::getClassName() const { return "FString"; } //---------------------------------------------------------------------- diff --git a/src/include/final/fstringstream.h b/src/include/final/fstringstream.h index 15ec22a6..ce10acfb 100644 --- a/src/include/final/fstringstream.h +++ b/src/include/final/fstringstream.h @@ -80,7 +80,7 @@ class FStringStream : public std::wiostream // Move assignment operator (=) FStringStream& operator = (FStringStream&& sstream) noexcept; - virtual const FString getClassName() const; + virtual FString getClassName() const; void swap (FStringStream&) noexcept; void clear(); std::wstringbuf* rdbuf() const; @@ -93,7 +93,7 @@ class FStringStream : public std::wiostream // FStringStream inline functions //---------------------------------------------------------------------- -inline const FString FStringStream::getClassName() const +inline FString FStringStream::getClassName() const { return "FStringStream"; } //---------------------------------------------------------------------- diff --git a/src/include/final/fstyle.h b/src/include/final/fstyle.h index bef360fe..dbb93162 100644 --- a/src/include/final/fstyle.h +++ b/src/include/final/fstyle.h @@ -70,7 +70,7 @@ class FStyle } // Accessor - const FString getClassName() const + FString getClassName() const { return "FStyle"; } FColor getStyle() const diff --git a/src/include/final/fswitch.h b/src/include/final/fswitch.h index cd94a57d..3978a4db 100644 --- a/src/include/final/fswitch.h +++ b/src/include/final/fswitch.h @@ -78,7 +78,7 @@ class FSwitch : public FToggleButton FSwitch& operator = (const FSwitch&) = delete; // Accessor - const FString getClassName() const override; + FString getClassName() const override; // Mutator void setText (const FString&) override; @@ -102,7 +102,7 @@ class FSwitch : public FToggleButton // FSwitch inline functions //---------------------------------------------------------------------- -inline const FString FSwitch::getClassName() const +inline FString FSwitch::getClassName() const { return "FSwitch"; } } // namespace finalcut diff --git a/src/include/final/fterm.h b/src/include/final/fterm.h index d11fa5bd..be325578 100644 --- a/src/include/final/fterm.h +++ b/src/include/final/fterm.h @@ -178,10 +178,10 @@ class FTerm final FTerm& operator = (const FTerm&) = delete; // Accessors - static const FString getClassName(); + static FString getClassName(); static std::size_t getLineNumber(); static std::size_t getColumnNumber(); - static const FString getKeyName (FKey); + static FString getKeyName (FKey); static int getTTYFileDescriptor(); static const char* getTermType(); static const char* getTermFileName(); @@ -406,9 +406,9 @@ bool isReverseNewFontchar (wchar_t); bool hasFullWidthSupports(); wchar_t cp437_to_unicode (uChar); uChar unicode_to_cp437 (wchar_t); -const FString getFullWidth (const FString&); -const FString getHalfWidth (const FString&); -const FString getColumnSubString (const FString&, std::size_t, std::size_t); +FString getFullWidth (const FString&); +FString getHalfWidth (const FString&); +FString getColumnSubString (const FString&, std::size_t, std::size_t); std::size_t getLengthFromColumnWidth (const FString&, std::size_t); std::size_t getColumnWidth (const FString&, std::size_t); std::size_t getColumnWidth (const FString&); @@ -419,7 +419,7 @@ std::size_t getColumnWidth (const FTermBuffer&); // FTerm inline functions //---------------------------------------------------------------------- -inline const FString FTerm::getClassName() +inline FString FTerm::getClassName() { return "FTerm"; } //---------------------------------------------------------------------- @@ -462,7 +462,7 @@ inline void FTerm::putstringf (const char format[], Args&&... args) if ( ! fsys ) getFSystem(); // Trying to set fsys - const std::size_t count = std::size_t(size); + const auto count = std::size_t(size); std::vector buf(count); std::snprintf (&buf[0], count, format, std::forward(args)...); diff --git a/src/include/final/ftermbuffer.h b/src/include/final/ftermbuffer.h index f3976b9e..ab2593ae 100644 --- a/src/include/final/ftermbuffer.h +++ b/src/include/final/ftermbuffer.h @@ -79,7 +79,7 @@ class FTermBuffer FTermBuffer& operator << (const FColorPair&); // Accessors - virtual const FString getClassName() const; + virtual FString getClassName() const; std::size_t getLength() const; const FCharVector& getBuffer() const; @@ -93,7 +93,7 @@ class FTermBuffer const_iterator end() const; FChar front() const; FChar back() const; - const FString toString() const; + FString toString() const; void clear(); template int writef (const FString&, Args&&...); @@ -169,7 +169,7 @@ inline FTermBuffer& FTermBuffer::operator << (const FColorPair& pair) } //---------------------------------------------------------------------- -inline const FString FTermBuffer::getClassName() const +inline FString FTermBuffer::getClassName() const { return "FTermBuffer"; } //---------------------------------------------------------------------- diff --git a/src/include/final/ftermcap.h b/src/include/final/ftermcap.h index 852ad862..447ea433 100644 --- a/src/include/final/ftermcap.h +++ b/src/include/final/ftermcap.h @@ -77,9 +77,6 @@ class FTermDetection; class FTermcap final { public: - // Using-declaration - using fn_putc = int (*)(int); - // Typedef typedef struct { @@ -88,6 +85,10 @@ class FTermcap final } tcap_map; + // Using-declaration + using fn_putc = int (*)(int); + using TCapMapType = std::array; + // Constructors FTermcap() = default; @@ -95,7 +96,7 @@ class FTermcap final ~FTermcap() = default; // Accessors - const FString getClassName() const; + FString getClassName() const; template static bool getFlag (const CharT&); template @@ -129,7 +130,7 @@ class FTermcap final static int max_color; static int tabstop; static int attr_without_color; - static tcap_map strings[]; + static TCapMapType strings; private: // Constant @@ -156,7 +157,7 @@ class FTermcap final // FTermcap inline functions //---------------------------------------------------------------------- -inline const FString FTermcap::getClassName() const +inline FString FTermcap::getClassName() const { return "FTermcap"; } //---------------------------------------------------------------------- diff --git a/src/include/final/ftermcapquirks.h b/src/include/final/ftermcapquirks.h index 60148df9..c73df24b 100644 --- a/src/include/final/ftermcapquirks.h +++ b/src/include/final/ftermcapquirks.h @@ -3,7 +3,7 @@ * * * This file is part of the FINAL CUT widget toolkit * * * -* Copyright 2018-2019 Markus Gans * +* Copyright 2018-2020 Markus Gans * * * * FINAL CUT is free software; you can redistribute it and/or modify * * it under the terms of the GNU Lesser General Public License as * @@ -56,7 +56,7 @@ class FTermcapQuirks final ~FTermcapQuirks(); // Accessor - const FString getClassName() const; + FString getClassName() const; // Methods static void terminalFixup(); @@ -85,7 +85,7 @@ class FTermcapQuirks final // FTermcapQuirks inline functions //---------------------------------------------------------------------- -inline const FString FTermcapQuirks::getClassName() const +inline FString FTermcapQuirks::getClassName() const { return "FTermcapQuirks"; } } // namespace finalcut diff --git a/src/include/final/ftermdata.h b/src/include/final/ftermdata.h index 1ba99f3e..e4c65fcd 100644 --- a/src/include/final/ftermdata.h +++ b/src/include/final/ftermdata.h @@ -71,7 +71,7 @@ class FTermData final FTermData& operator = (const FTermData&) = delete; // Accessors - const FString getClassName() const; + FString getClassName() const; encodingMap& getEncodingList(); charSubstitution& getCharSubstitutionMap(); fc::encoding getTermEncoding() const; @@ -166,7 +166,7 @@ class FTermData final // FTermData inline functions //---------------------------------------------------------------------- -inline const FString FTermData::getClassName() const +inline FString FTermData::getClassName() const { return "FTermData"; } //---------------------------------------------------------------------- diff --git a/src/include/final/ftermdetection.h b/src/include/final/ftermdetection.h index e7d1fe64..1308c73d 100644 --- a/src/include/final/ftermdetection.h +++ b/src/include/final/ftermdetection.h @@ -92,7 +92,7 @@ class FTermDetection final FTermDetection& operator = (const FTermDetection&) = delete; // Accessor - static const FString getClassName(); + static FString getClassName(); static const char* getTermType(); static int getGnomeTerminalID(); FTerminalType& getTermTypeStruct(); @@ -243,7 +243,7 @@ struct FTermDetection::secondaryDA // FTermDetection inline functions //---------------------------------------------------------------------- -inline const FString FTermDetection::getClassName() +inline FString FTermDetection::getClassName() { return "FTermDetection"; } //---------------------------------------------------------------------- diff --git a/src/include/final/ftermfreebsd.h b/src/include/final/ftermfreebsd.h index 55f0a8a3..93ac5405 100644 --- a/src/include/final/ftermfreebsd.h +++ b/src/include/final/ftermfreebsd.h @@ -95,7 +95,7 @@ class FTermFreeBSD final FTermFreeBSD& operator = (const FTermFreeBSD&) = delete; // Accessors - const FString getClassName() const; + FString getClassName() const; static CursorStyle getCursorStyle(); // Inquiry @@ -137,7 +137,7 @@ class FTermFreeBSD final // FTermFreeBSD inline functions //---------------------------------------------------------------------- -inline const FString FTermFreeBSD::getClassName() const +inline FString FTermFreeBSD::getClassName() const { return "FTermFreeBSD"; } //---------------------------------------------------------------------- diff --git a/src/include/final/ftermios.h b/src/include/final/ftermios.h index e80813f7..e1a31e35 100644 --- a/src/include/final/ftermios.h +++ b/src/include/final/ftermios.h @@ -3,7 +3,7 @@ * * * This file is part of the FINAL CUT widget toolkit * * * -* Copyright 2018-2019 Markus Gans * +* Copyright 2018-2020 Markus Gans * * * * FINAL CUT is free software; you can redistribute it and/or modify * * it under the terms of the GNU Lesser General Public License as * @@ -58,7 +58,7 @@ class FTermios final ~FTermios(); // Accessors - const FString getClassName() const; + FString getClassName() const; static termios getTTY(); static int getStdIn(); static int getStdOut(); @@ -94,7 +94,7 @@ class FTermios final // FTermios inline functions //---------------------------------------------------------------------- -inline const FString FTermios::getClassName() const +inline FString FTermios::getClassName() const { return "FTermios"; } //---------------------------------------------------------------------- diff --git a/src/include/final/ftermlinux.h b/src/include/final/ftermlinux.h index 4cfc6219..cbcfd5cf 100644 --- a/src/include/final/ftermlinux.h +++ b/src/include/final/ftermlinux.h @@ -93,7 +93,7 @@ class FTermLinux final FTermLinux& operator = (const FTermLinux&) = delete; // Accessors - const FString getClassName() const; + FString getClassName() const; fc::linuxConsoleCursorStyle getCursorStyle() const; char* getCursorStyleString(); int getFramebufferBpp() const; @@ -204,7 +204,7 @@ class FTermLinux final // FTermLinux inline functions //---------------------------------------------------------------------- -inline const FString FTermLinux::getClassName() const +inline FString FTermLinux::getClassName() const { return "FTermLinux"; } //---------------------------------------------------------------------- diff --git a/src/include/final/ftermopenbsd.h b/src/include/final/ftermopenbsd.h index b5e470ce..97799dbb 100644 --- a/src/include/final/ftermopenbsd.h +++ b/src/include/final/ftermopenbsd.h @@ -87,7 +87,7 @@ class FTermOpenBSD final FTermOpenBSD& operator = (const FTermOpenBSD&) = delete; // Accessor - const FString getClassName() const; + FString getClassName() const; // Inquiries static bool isBSDConsole(); @@ -122,7 +122,7 @@ class FTermOpenBSD final // FTermOpenBSD inline functions //---------------------------------------------------------------------- -inline const FString FTermOpenBSD::getClassName() const +inline FString FTermOpenBSD::getClassName() const { return "FTermOpenBSD"; } //---------------------------------------------------------------------- diff --git a/src/include/final/ftermxterminal.h b/src/include/final/ftermxterminal.h index 628ed9ae..39f9cb1d 100644 --- a/src/include/final/ftermxterminal.h +++ b/src/include/final/ftermxterminal.h @@ -80,16 +80,16 @@ class FTermXTerminal final void metaSendsESC (bool); // Accessors - const FString getClassName() const; + FString getClassName() const; fc::xtermCursorStyle getCursorStyle() const; - const FString getFont() const; - const FString getTitle() const; - const FString getForeground() const; - const FString getBackground() const; - const FString getCursorColor() const; - const FString getMouseForeground() const; - const FString getMouseBackground() const; - const FString getHighlightBackground() const; + FString getFont() const; + FString getTitle() const; + FString getForeground() const; + FString getBackground() const; + FString getCursorColor() const; + FString getMouseForeground() const; + FString getMouseBackground() const; + FString getHighlightBackground() const; // Inquiries bool hasFont() const; @@ -136,8 +136,8 @@ class FTermXTerminal final bool canResetColor() const; void oscPrefix() const; void oscPostfix() const; - const FString captureXTermFont() const; - const FString captureXTermTitle() const; + FString captureXTermFont() const; + FString captureXTermTitle() const; static void enableXTermMouse(); static void disableXTermMouse(); void enableXTermMetaSendsESC(); @@ -165,7 +165,7 @@ class FTermXTerminal final // FTermXTerminal inline functions //---------------------------------------------------------------------- -inline const FString FTermXTerminal::getClassName() const +inline FString FTermXTerminal::getClassName() const { return "FTermXTerminal"; } //---------------------------------------------------------------------- @@ -177,35 +177,35 @@ inline fc::xtermCursorStyle FTermXTerminal::getCursorStyle() const { return cursor_style; } //---------------------------------------------------------------------- -inline const FString FTermXTerminal::getFont() const +inline FString FTermXTerminal::getFont() const { return xterm_font; } //---------------------------------------------------------------------- -inline const FString FTermXTerminal::getTitle() const +inline FString FTermXTerminal::getTitle() const { return xterm_title; } //---------------------------------------------------------------------- -inline const FString FTermXTerminal::getForeground() const +inline FString FTermXTerminal::getForeground() const { return foreground_color; } //---------------------------------------------------------------------- -inline const FString FTermXTerminal::getBackground() const +inline FString FTermXTerminal::getBackground() const { return background_color; } //---------------------------------------------------------------------- -inline const FString FTermXTerminal::getCursorColor() const +inline FString FTermXTerminal::getCursorColor() const { return cursor_color; } //---------------------------------------------------------------------- -inline const FString FTermXTerminal::getMouseForeground() const +inline FString FTermXTerminal::getMouseForeground() const { return mouse_foreground_color; } //---------------------------------------------------------------------- -inline const FString FTermXTerminal::getMouseBackground() const +inline FString FTermXTerminal::getMouseBackground() const { return mouse_background_color; } //---------------------------------------------------------------------- -inline const FString FTermXTerminal::getHighlightBackground() const +inline FString FTermXTerminal::getHighlightBackground() const { return highlight_background_color; } //---------------------------------------------------------------------- diff --git a/src/include/final/ftextview.h b/src/include/final/ftextview.h index 090280a7..1e93758e 100644 --- a/src/include/final/ftextview.h +++ b/src/include/final/ftextview.h @@ -90,10 +90,10 @@ class FTextView : public FWidget FTextView& operator << (const std::string&); // Accessors - const FString getClassName() const override; + FString getClassName() const override; std::size_t getColumns() const; std::size_t getRows() const; - const FString getText() const; + FString getText() const; const FStringList& getLines() const; // Mutators @@ -212,7 +212,7 @@ inline FTextView& FTextView::operator << (const std::string& string) } //---------------------------------------------------------------------- -inline const FString FTextView::getClassName() const +inline FString FTextView::getClassName() const { return "FTextView"; } //---------------------------------------------------------------------- diff --git a/src/include/final/ftogglebutton.h b/src/include/final/ftogglebutton.h index c1b49d63..35e35565 100644 --- a/src/include/final/ftogglebutton.h +++ b/src/include/final/ftogglebutton.h @@ -79,7 +79,7 @@ class FToggleButton : public FWidget FToggleButton& operator = (const FToggleButton&) = delete; // Accessors - const FString getClassName() const override; + FString getClassName() const override; FString& getText(); // Mutators @@ -141,7 +141,7 @@ class FToggleButton : public FWidget private: // Constants - static constexpr std::size_t NOT_SET = static_cast(-1); + static constexpr auto NOT_SET = static_cast(-1); // Mutator void setGroup (FButtonGroup*); @@ -165,7 +165,7 @@ class FToggleButton : public FWidget // FRadioButton inline functions //---------------------------------------------------------------------- -inline const FString FToggleButton::getClassName() const +inline FString FToggleButton::getClassName() const { return "FToggleButton"; } //---------------------------------------------------------------------- diff --git a/src/include/final/ftooltip.h b/src/include/final/ftooltip.h index 4fdc0839..46caa009 100644 --- a/src/include/final/ftooltip.h +++ b/src/include/final/ftooltip.h @@ -80,8 +80,8 @@ class FToolTip : public FWindow FToolTip& operator = (const FToolTip&) = delete; // Accessors - const FString getClassName() const override; - const FString getText() const; + FString getClassName() const override; + FString getText() const; // Mutators void setText (const FString&); @@ -116,9 +116,13 @@ class FToolTip : public FWindow // FToolTip inline functions //---------------------------------------------------------------------- -inline const FString FToolTip::getClassName() const +inline FString FToolTip::getClassName() const { return "FToolTip"; } +//---------------------------------------------------------------------- +inline FString FToolTip::getText() const +{ return text; } + //---------------------------------------------------------------------- inline bool FToolTip::setBorder() { return setBorder(true); } diff --git a/src/include/final/ftypes.h b/src/include/final/ftypes.h index f4c65fc2..7936d795 100644 --- a/src/include/final/ftypes.h +++ b/src/include/final/ftypes.h @@ -189,7 +189,7 @@ FKeyName; // FChar operator functions //---------------------------------------------------------------------- -inline constexpr bool operator == (const FChar& lhs, const FChar& rhs) +constexpr bool operator == (const FChar& lhs, const FChar& rhs) { return lhs.ch == rhs.ch && lhs.fg_color == rhs.fg_color @@ -201,7 +201,7 @@ inline constexpr bool operator == (const FChar& lhs, const FChar& rhs) } //---------------------------------------------------------------------- -inline constexpr bool operator != (const FChar& lhs, const FChar& rhs) +constexpr bool operator != (const FChar& lhs, const FChar& rhs) { return ! ( lhs == rhs ); } diff --git a/src/include/final/fvterm.h b/src/include/final/fvterm.h index 546463bb..ec6923fe 100644 --- a/src/include/final/fvterm.h +++ b/src/include/final/fvterm.h @@ -143,12 +143,12 @@ class FVTerm FVTerm& operator << (const FColorPair&); // Accessors - virtual const FString getClassName() const; + virtual FString getClassName() const; static FColor getTermForegroundColor(); static FColor getTermBackgroundColor(); FTermArea*& getVWin(); const FTermArea* getVWin() const; - const FPoint getPrintCursor(); + FPoint getPrintCursor(); static const FChar getAttribute(); FTerm& getFTerm() const; @@ -371,12 +371,12 @@ class FVTerm bool hasChildAreaChanges (FTermArea*) const; void clearChildAreaChanges (const FTermArea*) const; static bool isInsideArea (const FPoint&, const FTermArea*); - static const FChar generateCharacter (const FPoint&); - static const FChar getCharacter ( character_type + static FChar generateCharacter (const FPoint&); + static FChar getCharacter ( character_type , const FPoint& , FVTerm* ); - static const FChar getCoveredCharacter (const FPoint&, FVTerm*); - static const FChar getOverlappedCharacter (const FPoint&, FVTerm*); + static FChar getCoveredCharacter (const FPoint&, FVTerm*); + static FChar getOverlappedCharacter (const FPoint&, FVTerm*); void init(); static void init_characterLengths (const FOptiMove*); void finish(); @@ -607,7 +607,7 @@ inline FVTerm& FVTerm::operator << (const FColorPair& pair) } //---------------------------------------------------------------------- -inline const FString FVTerm::getClassName() const +inline FString FVTerm::getClassName() const { return "FVTerm"; } //---------------------------------------------------------------------- diff --git a/src/include/final/fwidget.h b/src/include/final/fwidget.h index 1a54c839..f4dbea63 100644 --- a/src/include/final/fwidget.h +++ b/src/include/final/fwidget.h @@ -183,7 +183,7 @@ class FWidget : public FVTerm, public FObject FWidget& operator = (const FWidget&) = delete; // Accessors - const FString getClassName() const override; + FString getClassName() const override; FWidget* getRootWidget() const; FWidget* getParentWidget() const; static FWidget*& getMainWidget(); @@ -230,8 +230,8 @@ class FWidget : public FVTerm, public FObject std::size_t getDesktopWidth() const; std::size_t getDesktopHeight() const; const FWidgetFlags& getFlags() const; - const FPoint getCursorPos() const; - const FPoint getPrintPos(); + FPoint getCursorPos() const; + FPoint getPrintPos(); // Mutators static void setMainWidget (FWidget*); @@ -541,7 +541,7 @@ void drawNewFontListBox (FWidget*, const FRect&); // FWidget inline functions //---------------------------------------------------------------------- -inline const FString FWidget::getClassName() const +inline FString FWidget::getClassName() const { return "FWidget"; } //---------------------------------------------------------------------- @@ -751,7 +751,7 @@ inline const FWidget::FWidgetFlags& FWidget::getFlags() const { return flags; } //---------------------------------------------------------------------- -inline const FPoint FWidget::getCursorPos() const +inline FPoint FWidget::getCursorPos() const { return widget_cursor_position; } //---------------------------------------------------------------------- diff --git a/src/include/final/fwidgetcolors.h b/src/include/final/fwidgetcolors.h index 3b00cbf2..38fbed1a 100644 --- a/src/include/final/fwidgetcolors.h +++ b/src/include/final/fwidgetcolors.h @@ -54,7 +54,7 @@ class FWidgetColors virtual ~FWidgetColors(); // Method - virtual const FString getClassName() const; + virtual FString getClassName() const; virtual void setColorTheme() = 0; // Data members @@ -148,7 +148,7 @@ class FWidgetColors // FWidgetColors inline functions //---------------------------------------------------------------------- -inline const FString FWidgetColors::getClassName() const +inline FString FWidgetColors::getClassName() const { return "FWidgetColors"; } @@ -179,13 +179,13 @@ class default8ColorTheme final : public FWidgetColors ~default8ColorTheme() override; // Method - const FString getClassName() const override; + FString getClassName() const override; void setColorTheme() override; }; // default8ColorTheme inline functions //---------------------------------------------------------------------- -inline const FString default8ColorTheme::getClassName() const +inline FString default8ColorTheme::getClassName() const { return "default8ColorTheme"; } @@ -216,13 +216,13 @@ class default16ColorTheme final : public FWidgetColors ~default16ColorTheme() override; // Method - const FString getClassName() const override; + FString getClassName() const override; void setColorTheme() override; }; // default16ColorTheme inline functions //---------------------------------------------------------------------- -inline const FString default16ColorTheme::getClassName() const +inline FString default16ColorTheme::getClassName() const { return "default16ColorTheme"; } @@ -253,13 +253,13 @@ class default8ColorDarkTheme final : public FWidgetColors ~default8ColorDarkTheme() override; // Method - const FString getClassName() const override; + FString getClassName() const override; void setColorTheme() override; }; // default8ColorDarkTheme inline functions //---------------------------------------------------------------------- -inline const FString default8ColorDarkTheme::getClassName() const +inline FString default8ColorDarkTheme::getClassName() const { return "default8ColorDarkTheme"; } @@ -290,13 +290,13 @@ class default16ColorDarkTheme final : public FWidgetColors ~default16ColorDarkTheme() override; // Method - const FString getClassName() const override; + FString getClassName() const override; void setColorTheme() override; }; // default16ColorDarkTheme inline functions //---------------------------------------------------------------------- -inline const FString default16ColorDarkTheme::getClassName() const +inline FString default16ColorDarkTheme::getClassName() const { return "default16ColorDarkTheme"; } } // namespace finalcut diff --git a/src/include/final/fwindow.h b/src/include/final/fwindow.h index 274b5c5d..f2e61c8c 100644 --- a/src/include/final/fwindow.h +++ b/src/include/final/fwindow.h @@ -83,7 +83,7 @@ class FWindow : public FWidget FWindow& operator = (const FWindow&) = delete; // Accessors - const FString getClassName() const override; + FString getClassName() const override; static FWindow* getWindowWidget (const FWidget*); static int getWindowLayer (const FWidget*); FWidget* getWindowFocusWidget() const; @@ -181,7 +181,7 @@ void closeDropDown (const FWidget*, const FPoint&); // FWindow inline functions //---------------------------------------------------------------------- -inline const FString FWindow::getClassName() const +inline FString FWindow::getClassName() const { return "FWindow"; } //---------------------------------------------------------------------- diff --git a/src/include/final/sgr_optimizer.h b/src/include/final/sgr_optimizer.h index ca974cbe..9aac2929 100644 --- a/src/include/final/sgr_optimizer.h +++ b/src/include/final/sgr_optimizer.h @@ -70,7 +70,7 @@ class SGRoptimizer final private: // Constants - static constexpr std::size_t NOT_SET = static_cast(-1); + static constexpr auto NOT_SET = static_cast(-1); // Methods void findParameter(); diff --git a/test/fkeyboard-test.cpp b/test/fkeyboard-test.cpp index 660631b5..50497acc 100644 --- a/test/fkeyboard-test.cpp +++ b/test/fkeyboard-test.cpp @@ -43,8 +43,11 @@ typedef struct } FKeyMap; -FKeyMap fkey[] = -{ +using original_type = std::array; +using test_type = std::array; + +test_type fkey = +{{ { finalcut::fc::Fkey_backspace , "\177" , "kb" }, // backspace key { finalcut::fc::Fkey_catab , 0 , "ka" }, // clear-all-tabs key { finalcut::fc::Fkey_clear , 0 , "kC" }, // clear-screen or erase key @@ -222,9 +225,8 @@ FKeyMap fkey[] = { finalcut::fc::Fkey_slash , ESC "Oo" , "KP1"}, // keypad slash { finalcut::fc::Fkey_asterisk , ESC "Oj" , "KP2"}, // keypad asterisk { finalcut::fc::Fkey_minus_sign, ESC "Om" , "KP3"}, // keypad minus sign - { finalcut::fc::Fkey_plus_sign , ESC "Ok" , "KP4"}, // keypad plus sign - { 0 , 0 , "\0" } -}; + { finalcut::fc::Fkey_plus_sign , ESC "Ok" , "KP4"} // keypad plus sign +}}; } // namespace test @@ -2826,7 +2828,10 @@ void FKeyboardTest::init() CPPUNIT_ASSERT ( key_pressed == 0 ); keyboard->enableUTF8(); keyboard->enableMouseSequences(); - keyboard->setTermcapMap (reinterpret_cast(test::fkey)); + + auto ptr = &test::fkey; + const auto& ref = *reinterpret_cast(ptr); + keyboard->setTermcapMap (ref); } //---------------------------------------------------------------------- diff --git a/test/ftermcapquirks-test.cpp b/test/ftermcapquirks-test.cpp index bc82fe26..bdd25f47 100644 --- a/test/ftermcapquirks-test.cpp +++ b/test/ftermcapquirks-test.cpp @@ -56,7 +56,7 @@ namespace test typedef struct { const char* string; - char tname[3]; + char tname[alignof(char*)]; } tcap_map; @@ -222,7 +222,7 @@ void FTermcapQuirksTest::classNameTest() //---------------------------------------------------------------------- void FTermcapQuirksTest::generalTest() { - finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::strings; + auto& caps = finalcut::FTermcap::strings; constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1; for (std::size_t i = 0; i < last_item; i++) @@ -285,7 +285,7 @@ void FTermcapQuirksTest::generalTest() //---------------------------------------------------------------------- void FTermcapQuirksTest::xtermTest() { - finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::strings; + auto& caps = finalcut::FTermcap::strings; constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1; for (std::size_t i = 0; i < last_item; i++) @@ -316,7 +316,7 @@ void FTermcapQuirksTest::xtermTest() //---------------------------------------------------------------------- void FTermcapQuirksTest::freebsdTest() { - finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::strings; + auto& caps = finalcut::FTermcap::strings; constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1; for (std::size_t i = 0; i < last_item; i++) @@ -355,7 +355,7 @@ void FTermcapQuirksTest::freebsdTest() //---------------------------------------------------------------------- void FTermcapQuirksTest::cygwinTest() { - finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::strings; + auto& caps = finalcut::FTermcap::strings; constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1; for (std::size_t i = 0; i < last_item; i++) @@ -380,7 +380,7 @@ void FTermcapQuirksTest::cygwinTest() //---------------------------------------------------------------------- void FTermcapQuirksTest::linuxTest() { - finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::strings; + auto& caps = finalcut::FTermcap::strings; constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1; for (std::size_t i = 0; i < last_item; i++) @@ -452,7 +452,7 @@ void FTermcapQuirksTest::linuxTest() //---------------------------------------------------------------------- void FTermcapQuirksTest::rxvtTest() { - finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::strings; + auto& caps = finalcut::FTermcap::strings; constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1; for (std::size_t i = 0; i < last_item; i++) @@ -493,7 +493,7 @@ void FTermcapQuirksTest::rxvtTest() //---------------------------------------------------------------------- void FTermcapQuirksTest::vteTest() { - finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::strings; + auto& caps = finalcut::FTermcap::strings; constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1; for (std::size_t i = 0; i < last_item; i++) @@ -517,7 +517,7 @@ void FTermcapQuirksTest::vteTest() //---------------------------------------------------------------------- void FTermcapQuirksTest::puttyTest() { - finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::strings; + auto& caps = finalcut::FTermcap::strings; constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1; for (std::size_t i = 0; i < last_item; i++) @@ -607,7 +607,7 @@ void FTermcapQuirksTest::puttyTest() //---------------------------------------------------------------------- void FTermcapQuirksTest::teratermTest() { - finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::strings; + auto& caps = finalcut::FTermcap::strings; constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1; for (std::size_t i = 0; i < last_item; i++) @@ -637,7 +637,7 @@ void FTermcapQuirksTest::teratermTest() //---------------------------------------------------------------------- void FTermcapQuirksTest::sunTest() { - finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::strings; + auto& caps = finalcut::FTermcap::strings; constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1; for (std::size_t i = 0; i < last_item; i++) @@ -755,7 +755,7 @@ void FTermcapQuirksTest::sunTest() //---------------------------------------------------------------------- void FTermcapQuirksTest::screenTest() { - finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::strings; + auto& caps = finalcut::FTermcap::strings; constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1; for (std::size_t i = 0; i < last_item; i++) diff --git a/test/ftermfreebsd-test.cpp b/test/ftermfreebsd-test.cpp index c5b51406..08f37d34 100644 --- a/test/ftermfreebsd-test.cpp +++ b/test/ftermfreebsd-test.cpp @@ -819,11 +819,11 @@ wchar_t ftermfreebsdTest::charEncode (wchar_t c) { wchar_t ch_enc{L'\0'}; - for (std::size_t i{0}; i <= finalcut::fc::last_char_item; i++) + for (auto&& entry : finalcut::fc::character) { - if ( finalcut::fc::character[i][finalcut::fc::UTF8] == uInt(c) ) + if ( entry[finalcut::fc::UTF8] == uInt(c) ) { - ch_enc = wchar_t(finalcut::fc::character[i][finalcut::fc::PC]); + ch_enc = wchar_t(entry[finalcut::fc::PC]); break; } } diff --git a/test/ftermlinux-test.cpp b/test/ftermlinux-test.cpp index 6304adb8..97e50104 100644 --- a/test/ftermlinux-test.cpp +++ b/test/ftermlinux-test.cpp @@ -1446,7 +1446,7 @@ void FSystemTest::initVScreenInfo() void FSystemTest::initFScreenInfo() { char id[16] { "VESA VGA" }; - std::strncpy (fb_terminal_fix_info.id, id, sizeof(id)); + std::strncpy (fb_terminal_fix_info.id, id, sizeof(fb_terminal_fix_info.id)); fb_terminal_fix_info.smem_start = 0xf9000000; fb_terminal_fix_info.smem_len = 0x00500000; fb_terminal_fix_info.type = 0;