Use the Singleton design pattern to get a single object instance via FTerm

This commit is contained in:
Markus Gans 2019-05-27 01:10:10 +02:00
parent 22e47adbcb
commit 5e436e91dc
2 changed files with 11 additions and 12 deletions

View File

@ -64,7 +64,6 @@
// FTermcap string macro // FTermcap string macro
//#define TCAP(...) tcap_strings[__VA_ARGS__].string
#define TCAP(...) FTermcap::strings[__VA_ARGS__].string #define TCAP(...) FTermcap::strings[__VA_ARGS__].string
namespace finalcut namespace finalcut

View File

@ -227,7 +227,7 @@ void FTermcapQuirksTest::classNameTest()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermcapQuirksTest::generalTest() void FTermcapQuirksTest::generalTest()
{ {
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapStrings(); finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::strings;
constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1; constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
for (std::size_t i = 0; i < last_item; i++) for (std::size_t i = 0; i < last_item; i++)
@ -290,7 +290,7 @@ void FTermcapQuirksTest::generalTest()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermcapQuirksTest::xtermTest() void FTermcapQuirksTest::xtermTest()
{ {
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapStrings(); finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::strings;
constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1; constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
for (std::size_t i = 0; i < last_item; i++) for (std::size_t i = 0; i < last_item; i++)
@ -321,7 +321,7 @@ void FTermcapQuirksTest::xtermTest()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermcapQuirksTest::freebsdTest() void FTermcapQuirksTest::freebsdTest()
{ {
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapStrings(); finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::strings;
constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1; constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
for (std::size_t i = 0; i < last_item; i++) for (std::size_t i = 0; i < last_item; i++)
@ -360,7 +360,7 @@ void FTermcapQuirksTest::freebsdTest()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermcapQuirksTest::cygwinTest() void FTermcapQuirksTest::cygwinTest()
{ {
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapStrings(); finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::strings;
constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1; constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
for (std::size_t i = 0; i < last_item; i++) for (std::size_t i = 0; i < last_item; i++)
@ -385,7 +385,7 @@ void FTermcapQuirksTest::cygwinTest()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermcapQuirksTest::linuxTest() void FTermcapQuirksTest::linuxTest()
{ {
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapStrings(); finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::strings;
constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1; constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
for (std::size_t i = 0; i < last_item; i++) for (std::size_t i = 0; i < last_item; i++)
@ -457,7 +457,7 @@ void FTermcapQuirksTest::linuxTest()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermcapQuirksTest::rxvtTest() void FTermcapQuirksTest::rxvtTest()
{ {
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapStrings(); finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::strings;
constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1; constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
for (std::size_t i = 0; i < last_item; i++) for (std::size_t i = 0; i < last_item; i++)
@ -498,7 +498,7 @@ void FTermcapQuirksTest::rxvtTest()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermcapQuirksTest::vteTest() void FTermcapQuirksTest::vteTest()
{ {
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapStrings(); finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::strings;
constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1; constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
for (std::size_t i = 0; i < last_item; i++) for (std::size_t i = 0; i < last_item; i++)
@ -522,7 +522,7 @@ void FTermcapQuirksTest::vteTest()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermcapQuirksTest::puttyTest() void FTermcapQuirksTest::puttyTest()
{ {
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapStrings(); finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::strings;
constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1; constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
for (std::size_t i = 0; i < last_item; i++) for (std::size_t i = 0; i < last_item; i++)
@ -612,7 +612,7 @@ void FTermcapQuirksTest::puttyTest()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermcapQuirksTest::teratermTest() void FTermcapQuirksTest::teratermTest()
{ {
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapStrings(); finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::strings;
constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1; constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
for (std::size_t i = 0; i < last_item; i++) for (std::size_t i = 0; i < last_item; i++)
@ -642,7 +642,7 @@ void FTermcapQuirksTest::teratermTest()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermcapQuirksTest::sunTest() void FTermcapQuirksTest::sunTest()
{ {
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapStrings(); finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::strings;
constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1; constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
for (std::size_t i = 0; i < last_item; i++) for (std::size_t i = 0; i < last_item; i++)
@ -760,7 +760,7 @@ void FTermcapQuirksTest::sunTest()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermcapQuirksTest::screenTest() void FTermcapQuirksTest::screenTest()
{ {
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapStrings(); finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::strings;
constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1; constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
for (std::size_t i = 0; i < last_item; i++) for (std::size_t i = 0; i < last_item; i++)