mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 21:37:52 -07:00
GraphicsModGroup: Allow heterogenous lookup for GetMod()
Allows using keys that aren't directly std::string as the key. This lets us use std::string_view for the incoming path name, making it more flexible with other string types.
This commit is contained in:
parent
30fdf25f8f
commit
a1879ea099
@ -7,6 +7,8 @@
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
#include <picojson.h>
|
||||
|
||||
#include "Common/CommonPaths.h"
|
||||
#include "Common/FileSearch.h"
|
||||
#include "Common/FileUtil.h"
|
||||
@ -174,7 +176,7 @@ std::vector<GraphicsModConfig>& GraphicsModGroupConfig::GetMods()
|
||||
return m_graphics_mods;
|
||||
}
|
||||
|
||||
GraphicsModConfig* GraphicsModGroupConfig::GetMod(const std::string& absolute_path) const
|
||||
GraphicsModConfig* GraphicsModGroupConfig::GetMod(std::string_view absolute_path) const
|
||||
{
|
||||
if (const auto iter = m_path_to_graphics_mod.find(absolute_path);
|
||||
iter != m_path_to_graphics_mod.end())
|
||||
|
@ -5,10 +5,9 @@
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
#include <picojson.h>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
|
||||
struct GraphicsModConfig;
|
||||
@ -34,7 +33,7 @@ public:
|
||||
const std::vector<GraphicsModConfig>& GetMods() const;
|
||||
std::vector<GraphicsModConfig>& GetMods();
|
||||
|
||||
GraphicsModConfig* GetMod(const std::string& absolute_path) const;
|
||||
GraphicsModConfig* GetMod(std::string_view absolute_path) const;
|
||||
|
||||
const std::string& GetGameID() const;
|
||||
|
||||
@ -42,6 +41,6 @@ private:
|
||||
std::string GetPath() const;
|
||||
std::string m_game_id;
|
||||
std::vector<GraphicsModConfig> m_graphics_mods;
|
||||
std::map<std::string, GraphicsModConfig*> m_path_to_graphics_mod;
|
||||
std::map<std::string, GraphicsModConfig*, std::less<>> m_path_to_graphics_mod;
|
||||
u32 m_change_count = 0;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user