#include "stdafx.h" #include "UICustomStrings.h" #include namespace { std::deque &Table() { static std::deque s_table; return s_table; } } int UICustomStrings::Get(const wchar_t *text) { if (text == nullptr) return -1; std::deque &table = Table(); for (size_t i = 0; i < table.size(); ++i) { if (table[i] == text) return BASE_ID + static_cast(i); } table.push_back(text); return BASE_ID + static_cast(table.size() - 1); } const wchar_t *UICustomStrings::Lookup(int id) { if (id < BASE_ID) return nullptr; std::deque &table = Table(); size_t index = static_cast(id - BASE_ID); if (index >= table.size()) return nullptr; return table[index].c_str(); }