mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-05-26 21:52:59 +00:00
Remove Win32 types from WstringLookup
This commit is contained in:
parent
3880df481a
commit
88ffcab9a1
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue