mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-04-10 21:44:28 +00:00
Config: Extract ConfigInfo into own header
This commit is contained in:
parent
c8f970e2b0
commit
ec7b84c5f2
@ -4,6 +4,7 @@ set(SRCS
|
|||||||
ColorUtil.cpp
|
ColorUtil.cpp
|
||||||
CommonFuncs.cpp
|
CommonFuncs.cpp
|
||||||
Config/Config.cpp
|
Config/Config.cpp
|
||||||
|
Config/ConfigInfo.cpp
|
||||||
Config/Layer.cpp
|
Config/Layer.cpp
|
||||||
Config/Section.cpp
|
Config/Section.cpp
|
||||||
Crypto/AES.cpp
|
Crypto/AES.cpp
|
||||||
@ -29,8 +30,8 @@ set(SRCS
|
|||||||
PcapFile.cpp
|
PcapFile.cpp
|
||||||
PerformanceCounter.cpp
|
PerformanceCounter.cpp
|
||||||
Profiler.cpp
|
Profiler.cpp
|
||||||
SettingsHandler.cpp
|
|
||||||
SDCardUtil.cpp
|
SDCardUtil.cpp
|
||||||
|
SettingsHandler.cpp
|
||||||
StringUtil.cpp
|
StringUtil.cpp
|
||||||
SymbolDB.cpp
|
SymbolDB.cpp
|
||||||
SysConf.cpp
|
SysConf.cpp
|
||||||
|
@ -126,21 +126,6 @@ const std::string& GetLayerName(LayerType layer)
|
|||||||
return layer_to_name.at(layer);
|
return layer_to_name.at(layer);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ConfigLocation::operator==(const ConfigLocation& other) const
|
|
||||||
{
|
|
||||||
return std::tie(system, section, key) == std::tie(other.system, other.section, other.key);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ConfigLocation::operator!=(const ConfigLocation& other) const
|
|
||||||
{
|
|
||||||
return !(*this == other);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ConfigLocation::operator<(const ConfigLocation& other) const
|
|
||||||
{
|
|
||||||
return std::tie(system, section, key) < std::tie(other.system, other.section, other.key);
|
|
||||||
}
|
|
||||||
|
|
||||||
LayerType GetActiveLayerForConfig(const ConfigLocation& config)
|
LayerType GetActiveLayerForConfig(const ConfigLocation& config)
|
||||||
{
|
{
|
||||||
for (auto layer : SEARCH_ORDER)
|
for (auto layer : SEARCH_ORDER)
|
||||||
|
@ -9,30 +9,13 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#include "Common/Config/ConfigInfo.h"
|
||||||
#include "Common/Config/Enums.h"
|
#include "Common/Config/Enums.h"
|
||||||
#include "Common/Config/Layer.h"
|
#include "Common/Config/Layer.h"
|
||||||
#include "Common/Config/Section.h"
|
#include "Common/Config/Section.h"
|
||||||
|
|
||||||
namespace Config
|
namespace Config
|
||||||
{
|
{
|
||||||
struct ConfigLocation
|
|
||||||
{
|
|
||||||
System system;
|
|
||||||
std::string section;
|
|
||||||
std::string key;
|
|
||||||
|
|
||||||
bool operator==(const ConfigLocation& other) const;
|
|
||||||
bool operator!=(const ConfigLocation& other) const;
|
|
||||||
bool operator<(const ConfigLocation& other) const;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
struct ConfigInfo
|
|
||||||
{
|
|
||||||
ConfigLocation location;
|
|
||||||
T default_value;
|
|
||||||
};
|
|
||||||
|
|
||||||
using Layers = std::map<LayerType, std::unique_ptr<Layer>>;
|
using Layers = std::map<LayerType, std::unique_ptr<Layer>>;
|
||||||
using ConfigChangedCallback = std::function<void()>;
|
using ConfigChangedCallback = std::function<void()>;
|
||||||
|
|
||||||
|
25
Source/Core/Common/Config/ConfigInfo.cpp
Normal file
25
Source/Core/Common/Config/ConfigInfo.cpp
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
// Copyright 2016 Dolphin Emulator Project
|
||||||
|
// Licensed under GPLv2+
|
||||||
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#include <strings.h>
|
||||||
|
|
||||||
|
#include "Common/Config/ConfigInfo.h"
|
||||||
|
|
||||||
|
namespace Config
|
||||||
|
{
|
||||||
|
bool ConfigLocation::operator==(const ConfigLocation& other) const
|
||||||
|
{
|
||||||
|
return std::tie(system, section, key) == std::tie(other.system, other.section, other.key);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ConfigLocation::operator!=(const ConfigLocation& other) const
|
||||||
|
{
|
||||||
|
return !(*this == other);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ConfigLocation::operator<(const ConfigLocation& other) const
|
||||||
|
{
|
||||||
|
return std::tie(system, section, key) < std::tie(other.system, other.section, other.key);
|
||||||
|
}
|
||||||
|
}
|
30
Source/Core/Common/Config/ConfigInfo.h
Normal file
30
Source/Core/Common/Config/ConfigInfo.h
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
// Copyright 2017 Dolphin Emulator Project
|
||||||
|
// Licensed under GPLv2+
|
||||||
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "Common/Config/Enums.h"
|
||||||
|
|
||||||
|
namespace Config
|
||||||
|
{
|
||||||
|
struct ConfigLocation
|
||||||
|
{
|
||||||
|
System system;
|
||||||
|
std::string section;
|
||||||
|
std::string key;
|
||||||
|
|
||||||
|
bool operator==(const ConfigLocation& other) const;
|
||||||
|
bool operator!=(const ConfigLocation& other) const;
|
||||||
|
bool operator<(const ConfigLocation& other) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
struct ConfigInfo
|
||||||
|
{
|
||||||
|
ConfigLocation location;
|
||||||
|
T default_value;
|
||||||
|
};
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user