Remove Win32 types from WstringLookup

This commit is contained in:
notmatthewbeshay 2026-03-10 00:06:01 +11:00
parent 3880df481a
commit 88ffcab9a1
2 changed files with 15 additions and 14 deletions

View file

@ -8,7 +8,7 @@ WstringLookup::WstringLookup()
numIDs = 0;
}
std::wstring WstringLookup::lookup(UINT id)
std::wstring WstringLookup::lookup(unsigned int id)
{
// TODO
//if (id > currentMaxID)
@ -17,12 +17,12 @@ std::wstring WstringLookup::lookup(UINT id)
return int2str.at(id);
}
UINT WstringLookup::lookup(std::wstring str)
unsigned int WstringLookup::lookup(std::wstring str)
{
if (str2int.find(str) == str2int.end())
{
std::pair<std::wstring,UINT> p =
std::pair<std::wstring,UINT>(str, numIDs);
std::pair<std::wstring, unsigned int> p =
std::pair<std::wstring, unsigned int>(str, numIDs);
str2int.insert( p );
int2str.push_back( str );
@ -35,14 +35,15 @@ UINT WstringLookup::lookup(std::wstring str)
}
}
VOID WstringLookup::getTable(std::wstring **lookup, UINT *len)
void WstringLookup::getTable(std::wstring **lookup, unsigned int *len)
{
// Outputs
std::wstring *out_lookup; UINT out_len;
std::wstring *out_lookup;
unsigned int out_len;
// Fill lookup.
out_lookup = new std::wstring[int2str.size()];
for (UINT i = 0; i < numIDs; i++)
for (unsigned int i = 0; i < numIDs; i++)
out_lookup[i] = int2str.at(i);
out_len = numIDs;
@ -51,4 +52,4 @@ VOID WstringLookup::getTable(std::wstring **lookup, UINT *len)
*lookup = out_lookup;
*len = out_len;
return;
}
}

View file

@ -5,16 +5,16 @@
class WstringLookup
{
private:
UINT numIDs;
std::unordered_map<std::wstring, UINT> str2int;
unsigned int numIDs;
std::unordered_map<std::wstring, unsigned int> str2int;
std::vector<std::wstring> int2str;
public:
WstringLookup();
std::wstring lookup(UINT id);
std::wstring lookup(unsigned int id);
UINT lookup(std::wstring);
unsigned int lookup(std::wstring);
VOID getTable(std::wstring **lookup, UINT *len);
};
void getTable(std::wstring **lookup, unsigned int *len);
};