mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-11-01 00:20:06 +00:00
reverted wfoMap_ to unordered_map and added error checking to getWFOName
This commit is contained in:
parent
ea23986ead
commit
ed00cec4cc
2 changed files with 10 additions and 5 deletions
|
|
@ -31,7 +31,7 @@ typedef std::unordered_map<char, StateMap> FormatMap;
|
||||||
static bool initialized_ {false};
|
static bool initialized_ {false};
|
||||||
static FormatMap countyDatabase_;
|
static FormatMap countyDatabase_;
|
||||||
static std::unordered_map<std::string, std::string> stateMap_;
|
static std::unordered_map<std::string, std::string> stateMap_;
|
||||||
static std::map<std::string, std::string> wfoMap_;
|
static std::unordered_map<std::string, std::string> wfoMap_;
|
||||||
|
|
||||||
void Initialize()
|
void Initialize()
|
||||||
{
|
{
|
||||||
|
|
@ -264,14 +264,20 @@ const std::unordered_map<std::string, std::string>& GetStates()
|
||||||
return stateMap_;
|
return stateMap_;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::map<std::string, std::string>& GetWFOs()
|
const std::unordered_map<std::string, std::string>& GetWFOs()
|
||||||
{
|
{
|
||||||
return wfoMap_;
|
return wfoMap_;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string& GetWFOName(const std::string& wfoId)
|
const std::string& GetWFOName(const std::string& wfoId)
|
||||||
{
|
{
|
||||||
return wfoMap_.at(wfoId);
|
auto wfo = wfoMap_.find(wfoId);
|
||||||
|
if (wfo == wfoMap_.end())
|
||||||
|
{
|
||||||
|
return wfoId;
|
||||||
|
}
|
||||||
|
|
||||||
|
return wfo->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace CountyDatabase
|
} // namespace CountyDatabase
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <map>
|
|
||||||
|
|
||||||
namespace scwx
|
namespace scwx
|
||||||
{
|
{
|
||||||
|
|
@ -20,7 +19,7 @@ std::string GetCountyName(const std::string& id);
|
||||||
std::unordered_map<std::string, std::string>
|
std::unordered_map<std::string, std::string>
|
||||||
GetCounties(const std::string& state);
|
GetCounties(const std::string& state);
|
||||||
const std::unordered_map<std::string, std::string>& GetStates();
|
const std::unordered_map<std::string, std::string>& GetStates();
|
||||||
const std::map<std::string, std::string>& GetWFOs();
|
const std::unordered_map<std::string, std::string>& GetWFOs();
|
||||||
const std::string& GetWFOName(const std::string& wfoId);
|
const std::string& GetWFOName(const std::string& wfoId);
|
||||||
|
|
||||||
} // namespace CountyDatabase
|
} // namespace CountyDatabase
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue