Merge pull request #6220 from leoetlino/utf8

WX: Fix argument parsing
This commit is contained in:
Pierre Bourdon
2017-12-07 15:16:39 +01:00
committed by GitHub
6 changed files with 43 additions and 14 deletions

View File

@ -101,15 +101,14 @@ const std::string& GetSystemName(System system)
return system_to_name.at(system);
}
System GetSystemFromName(const std::string& name)
std::optional<System> GetSystemFromName(const std::string& name)
{
const auto system = std::find_if(system_to_name.begin(), system_to_name.end(),
[&name](const auto& entry) { return entry.second == name; });
if (system != system_to_name.end())
return system->first;
_assert_msg_(COMMON, false, "Programming error! Couldn't convert '%s' to system!", name.c_str());
return System::Main;
return {};
}
const std::string& GetLayerName(LayerType layer)

View File

@ -7,6 +7,7 @@
#include <functional>
#include <map>
#include <memory>
#include <optional>
#include <string>
#include "Common/Config/ConfigInfo.h"
@ -38,7 +39,7 @@ void Shutdown();
void ClearCurrentRunLayer();
const std::string& GetSystemName(System system);
System GetSystemFromName(const std::string& system);
std::optional<System> GetSystemFromName(const std::string& system);
const std::string& GetLayerName(LayerType layer);
LayerType GetActiveLayerForConfig(const ConfigLocation&);