Commit graph

12 commits

Author SHA1 Message Date
Léo Lam
7dca7c237e Config: Fix template deduction for implicit conversions
This excludes the second argument from template deduction.

Otherwise, it is required to manually cast the second argument to
the ConfigInfo type (because implicit conversions won't work).

e.g. to set the value for a ConfigInfo<std::string> from a string
literal, you'd need a ugly `std::string("yourstring")`.
2018-05-12 14:30:18 +02:00
Léo Lam
05c8d229af Config: Handle unknown system strings better
Currently, a simple typo in the system name will trigger an assert
message that complains about a "programming error". This is not
user friendly and misleading.

So this changes GetSystemFromName to return an std::optional, which
allows for callers to check whether the system exists and handle
failures better.
2017-11-26 18:24:01 +01:00
MerryMage
4c24629b95 Config: Flatten structures
Originally, Layer contained a std::map of Sections, which containted a std::map
containing the (key, value) pairs. Here we flattern this structure so that only
one std::map is required, reducing the number of indirections required and
vastly simplifying the code.
2017-11-15 18:04:40 +00:00
MerryMage
ec7b84c5f2 Config: Extract ConfigInfo into own header 2017-11-15 18:04:40 +00:00
MerryMage
c8f970e2b0 Config: Remove recursive layer 2017-11-15 18:04:40 +00:00
Léo Lam
c900e77ac5 Config: Add Get/Set on Layer
For convenience, when getting/setting from ConfigInfos.
2017-08-11 15:28:11 +08:00
MerryMage
31ec3e2501 Config: Missed a line in #5770 2017-08-01 18:07:53 +01:00
Léo Lam
f5fd183571 Config: Fix the loader Load() being called twice
The Config::AddLoadLayer functions call Load on the layer
explicitly, but Load is already called in the constructor,
so they'd cause the loader's Load function to be called twice,
which is potentially expensive considering we have to read an INI
from the host filesystem.

This commit removes the Config::AddLoadLayer functions because
they don't appear to be necessary.
2017-07-31 22:32:05 +08:00
Michael Maltese
8b54ac225b Merge Core/Config/Config.h into Common/Config/Config.h
Allows code in Common to take advantage of the layered config logic.
2017-07-09 16:28:54 -07:00
MerryMage
1e766ab490 Config: Add layers CommandLine and CurrentRun 2017-06-03 18:11:57 +01:00
MerryMage
1548a15c68 Config: Implement Get and Set 2017-06-03 18:11:56 +01:00
Léo Lam
88a21dd2b9 Fix things mentioned during code review
Ref: https://github.com/dolphin-emu/dolphin/pull/4917
2017-02-23 18:15:12 +01:00