mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-08 18:05:32 +00:00
chore(developer): refactor CompMsg.cpp to use a std::map
This commit is contained in:
parent
a099c86ad8
commit
5ea3f6ec16
1 changed files with 5 additions and 15 deletions
|
|
@ -1,11 +1,7 @@
|
|||
#include <CompMsg.h>
|
||||
#include <map>
|
||||
|
||||
struct CompilerError {
|
||||
KMX_DWORD ErrorCode;
|
||||
const KMX_CHAR* Text;
|
||||
};
|
||||
|
||||
const struct CompilerError CompilerErrors[] = {
|
||||
std::map<KMX_DWORD, const KMX_CHAR*> CompilerErrorMap = {
|
||||
{ CERR_InvalidLayoutLine , "Invalid 'layout' command"},
|
||||
{ CERR_NoVersionLine , "No version line found for file"},
|
||||
{ CERR_InvalidGroupLine , "Invalid 'group' command"},
|
||||
|
|
@ -150,14 +146,8 @@ const struct CompilerError CompilerErrors[] = {
|
|||
{ CWARN_VirtualKeyInOutput , "Virtual keys are not supported in output"},
|
||||
|
||||
{ 0, nullptr }
|
||||
};
|
||||
};
|
||||
|
||||
KMX_CHAR *GetCompilerErrorString(KMX_DWORD code)
|
||||
{
|
||||
for(int i = 0; CompilerErrors[i].ErrorCode; i++) {
|
||||
if(CompilerErrors[i].ErrorCode == code) {
|
||||
return ( KMX_CHAR*) CompilerErrors[i].Text;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
KMX_CHAR *GetCompilerErrorString(KMX_DWORD code) {
|
||||
return (KMX_CHAR*) CompilerErrorMap[code];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue