chore(developer): add initFileKeyboard() method

This commit is contained in:
Dr Mark C. Sinclair 2024-06-08 12:36:11 +01:00
parent c1d5d45b8f
commit cdb71f4329

View file

@ -43,8 +43,7 @@ class CompilerTest : public testing::Test {
initFileKeyboard(fileKeyboard);
}
void TearDown() override {
initGlobals();
initFileKeyboard(fileKeyboard, false);
deleteFileKeyboard(fileKeyboard);
}
void initGlobals() {
@ -59,15 +58,7 @@ class CompilerTest : public testing::Test {
kmcmp::BeginLine[BEGIN_POSTKEYSTROKE] = -1;
}
void initFileKeyboard(FILE_KEYBOARD &fk, bool isSetUp=true) {
if (!isSetUp) {
if (fk.dpStoreArray) { delete[] fk.dpStoreArray; }
if (fk.dpGroupArray) { delete[] fk.dpGroupArray; }
if (fk.lpBitmap) { delete fk.lpBitmap; }
if (fk.dpDeadKeyArray) { delete[] fk.dpDeadKeyArray; }
if (fk.dpVKDictionary) { delete fk.dpVKDictionary; }
if (fk.extra) { delete fk.extra; }
}
void initFileKeyboard(FILE_KEYBOARD &fk) {
fk.KeyboardID = 0;
fk.version = VERSION_90;
fk.dpStoreArray = nullptr;
@ -93,6 +84,15 @@ class CompilerTest : public testing::Test {
fk.extra = nullptr;
}
void deleteFileKeyboard(FILE_KEYBOARD &fk) {
if (fk.dpStoreArray) { delete[] fk.dpStoreArray; }
if (fk.dpGroupArray) { delete[] fk.dpGroupArray; }
if (fk.lpBitmap) { delete fk.lpBitmap; }
if (fk.dpDeadKeyArray) { delete[] fk.dpDeadKeyArray; }
if (fk.dpVKDictionary) { delete fk.dpVKDictionary; }
if (fk.extra) { delete fk.extra; }
}
public:
static KMX_CHAR szText_stub[];