More direct static access

This commit is contained in:
Markus Gans 2021-06-27 00:30:21 +02:00
parent 45110c5b21
commit 3bf9713d23
8 changed files with 16 additions and 17 deletions

View File

@ -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);

View File

@ -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<uChar, uChar> 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;
}

View File

@ -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()

View File

@ -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;

View File

@ -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++)

View File

@ -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;
}

View File

@ -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);

View File

@ -235,7 +235,7 @@ inline void FKeyboard::setTermcapMap (const T& keymap)
inline void FKeyboard::setTermcapMap ()
{
using type = FKeyMap::KeyCapMapType;
key_map = std::make_shared<type>(FKeyMap::getInstance().getKeyCapMap());
key_map = std::make_shared<type>(FKeyMap::getKeyCapMap());
}
//----------------------------------------------------------------------