From 3bf9713d23e5bf3b29aa8ec88f2d5df2b3285219 Mon Sep 17 00:00:00 2001 From: Markus Gans Date: Sun, 27 Jun 2021 00:30:21 +0200 Subject: [PATCH] More direct static access --- src/fkeyboard.cpp | 5 ++--- src/fterm.cpp | 10 +++++----- src/fterm_functions.cpp | 8 ++++---- src/ftermcap.cpp | 2 +- src/ftermcapquirks.cpp | 2 +- src/ftermfreebsd.cpp | 2 +- src/ftermlinux.cpp | 2 +- src/include/final/fkeyboard.h | 2 +- 8 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/fkeyboard.cpp b/src/fkeyboard.cpp index 6b54c128..776d4818 100644 --- a/src/fkeyboard.cpp +++ b/src/fkeyboard.cpp @@ -91,8 +91,7 @@ void FKeyboard::fetchKeyCode() //---------------------------------------------------------------------- FString FKeyboard::getKeyName (const FKey keynum) const { - const auto& fkeyname = FKeyMap::getInstance().getKeyName(); - + const auto& fkeyname = FKeyMap::getKeyName(); const auto& found_key = std::find_if ( fkeyname.cbegin(), @@ -317,7 +316,7 @@ inline FKey FKeyboard::getKnownKey() assert ( FIFO_BUF_SIZE > 0 ); - for (auto&& entry : FKeyMap::getInstance().getKeyMap()) + for (auto&& entry : FKeyMap::getKeyMap()) { const char* kstr = entry.string; // The string is never null const std::size_t len = stringLength(kstr); diff --git a/src/fterm.cpp b/src/fterm.cpp index db1c8d1a..64b648c5 100644 --- a/src/fterm.cpp +++ b/src/fterm.cpp @@ -927,7 +927,7 @@ wchar_t FTerm::charEncode (wchar_t c) wchar_t FTerm::charEncode (wchar_t c, Encoding enc) { wchar_t ch_enc = c; - auto& character = FCharMap::getInstance().getCharEncodeMap(); + auto& character = FCharMap::getCharEncodeMap(); auto found = std::find_if ( character.begin() , character.end() , [&c] (const FCharMap::CharEncodeMap& entry) @@ -1135,7 +1135,7 @@ void FTerm::init_alt_charset() // Read the used VT100 pairs std::unordered_map vt100_alt_char; - auto& character = FCharMap::getInstance().getCharEncodeMap(); + auto& character = FCharMap::getCharEncodeMap(); if ( TCAP(t_acs_chars) ) { @@ -1149,7 +1149,7 @@ void FTerm::init_alt_charset() } // Update array 'character' with discovered VT100 pairs - for (auto&& pair : FCharMap::getInstance().getDECSpecialGraphics()) + for (auto&& pair : FCharMap::getDECSpecialGraphics()) { const auto keyChar = uChar(pair.key); const auto altChar = wchar_t(vt100_alt_char[keyChar]); @@ -1234,7 +1234,7 @@ void FTerm::init_cygwin_charmap() return; // PC encoding changes - for (auto&& entry : FCharMap::getInstance().getCharEncodeMap()) + for (auto&& entry : FCharMap::getCharEncodeMap()) { if ( entry.unicode == UniChar::BlackUpPointingTriangle ) // ▲ entry.pc = 0x18; @@ -1289,7 +1289,7 @@ void FTerm::init_teraterm_charmap() if ( ! isTeraTerm() ) return; - for (auto&& entry : FCharMap::getInstance().getCharEncodeMap()) + for (auto&& entry : FCharMap::getCharEncodeMap()) if ( entry.pc < 0x20 ) entry.pc = entry.ascii; } diff --git a/src/fterm_functions.cpp b/src/fterm_functions.cpp index b0ec7984..08fac55a 100644 --- a/src/fterm_functions.cpp +++ b/src/fterm_functions.cpp @@ -284,7 +284,7 @@ wchar_t cp437_to_unicode (uChar c) { constexpr std::size_t CP437 = 0; constexpr std::size_t UNICODE = 1; - const auto& cp437_ucs = FCharMap::getInstance().getCP437UCSMap(); + const auto& cp437_ucs = FCharMap::getCP437UCSMap(); wchar_t ucs = c; auto found = std::find_if ( cp437_ucs.begin() , cp437_ucs.end() @@ -304,7 +304,7 @@ uChar unicode_to_cp437 (wchar_t ucs) { constexpr std::size_t CP437 = 0; constexpr std::size_t UNICODE = 1; - const auto& cp437_ucs = FCharMap::getInstance().getCP437UCSMap(); + const auto& cp437_ucs = FCharMap::getCP437UCSMap(); uChar c{'?'}; auto found = std::find_if ( cp437_ucs.begin() , cp437_ucs.end() @@ -327,7 +327,7 @@ FString getFullWidth (const FString& str) FString s{str}; auto table_search = [] (wchar_t& c) { - const auto& halfwidth_fullwidth = FCharMap::getInstance().getHalfFullWidthMap(); + const auto& halfwidth_fullwidth = FCharMap::getHalfFullWidthMap(); constexpr std::size_t HALF = 0; constexpr std::size_t FULL = 1; auto found = std::find_if ( halfwidth_fullwidth.begin() @@ -360,7 +360,7 @@ FString getHalfWidth (const FString& str) FString s{str}; auto table_search = [] (wchar_t& c) { - const auto& halfwidth_fullwidth = FCharMap::getInstance().getHalfFullWidthMap(); + const auto& halfwidth_fullwidth = FCharMap::getHalfFullWidthMap(); constexpr std::size_t HALF = 0; constexpr std::size_t FULL = 1; auto found = std::find_if ( halfwidth_fullwidth.begin() diff --git a/src/ftermcap.cpp b/src/ftermcap.cpp index 9d239a1a..7a4a5aa9 100644 --- a/src/ftermcap.cpp +++ b/src/ftermcap.cpp @@ -426,7 +426,7 @@ void FTermcap::termcapKeys() // Get termcap keys // Read termcap key sequences up to the self-defined values - for (auto&& entry : FKeyMap::getInstance().getKeyCapMap()) + for (auto&& entry : FKeyMap::getKeyCapMap()) { if ( entry.string != nullptr ) // String is already set break; diff --git a/src/ftermcapquirks.cpp b/src/ftermcapquirks.cpp index 0ce0ed5b..46f93280 100644 --- a/src/ftermcapquirks.cpp +++ b/src/ftermcapquirks.cpp @@ -370,7 +370,7 @@ void FTermcapQuirks::sunConsole() TCAP(t_parm_down_cursor) = CSI "%p1%dB"; TCAP(t_parm_right_cursor) = CSI "%p1%dC"; TCAP(t_parm_left_cursor) = CSI "%p1%dD"; - auto& fkey_cap_table = FKeyMap::getInstance().getKeyCapMap(); + auto& fkey_cap_table = FKeyMap::getKeyCapMap(); // Sun Microsystems workstation console keys for (std::size_t i{0}; fkey_cap_table[i].tname[0] != 0; i++) diff --git a/src/ftermfreebsd.cpp b/src/ftermfreebsd.cpp index a3b58236..4228145b 100644 --- a/src/ftermfreebsd.cpp +++ b/src/ftermfreebsd.cpp @@ -155,7 +155,7 @@ void FTermFreeBSD::initCharMap() if ( ! isFreeBSDConsole() ) return; - for (auto&& entry : FCharMap::getInstance().getCharEncodeMap()) + for (auto&& entry : FCharMap::getCharEncodeMap()) if ( entry.pc < 0x1c ) entry.pc = entry.ascii; } diff --git a/src/ftermlinux.cpp b/src/ftermlinux.cpp index bb7c3ad4..5dc007ac 100644 --- a/src/ftermlinux.cpp +++ b/src/ftermlinux.cpp @@ -215,7 +215,7 @@ void FTermLinux::initCharMap() const if ( screen_unicode_map.entry_ct > 0 && screen_unicode_map.entries ) { - for (auto&& entry : FCharMap::getInstance().getCharEncodeMap()) + for (auto&& entry : FCharMap::getCharEncodeMap()) { const auto ucs = entry.unicode; const sInt16 fontpos = getFontPos(ucs); diff --git a/src/include/final/fkeyboard.h b/src/include/final/fkeyboard.h index 15fb8d83..f57142d5 100644 --- a/src/include/final/fkeyboard.h +++ b/src/include/final/fkeyboard.h @@ -235,7 +235,7 @@ inline void FKeyboard::setTermcapMap (const T& keymap) inline void FKeyboard::setTermcapMap () { using type = FKeyMap::KeyCapMapType; - key_map = std::make_shared(FKeyMap::getInstance().getKeyCapMap()); + key_map = std::make_shared(FKeyMap::getKeyCapMap()); } //----------------------------------------------------------------------