summaryrefslogtreecommitdiffstats
path: root/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/Setting.java
blob: 28003078abe07b9bc9e030c69dccff74b830b9ab (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package org.yuzu.yuzu_emu.features.settings.model;

/**
 * Abstraction for a setting item as read from / written to yuzu's configuration ini files.
 * These files generally consist of a key/value pair, though the type of value is ambiguous and
 * must be inferred at read-time. The type of value determines which child of this class is used
 * to represent the Setting.
 */
public abstract class Setting {
    private String mKey;
    private String mSection;

    /**
     * Base constructor.
     *
     * @param key     Everything to the left of the = in a line from the ini file.
     * @param section The corresponding recent section header; e.g. [Core] or [Enhancements] without the brackets.
     */
    public Setting(String key, String section) {
        mKey = key;
        mSection = section;
    }

    /**
     * @return The identifier used to write this setting to the ini file.
     */
    public String getKey() {
        return mKey;
    }

    /**
     * @return The name of the header under which this Setting should be written in the ini file.
     */
    public String getSection() {
        return mSection;
    }

    /**
     * @return A representation of this Setting's backing value converted to a String (e.g. for serialization).
     */
    public abstract String getValueAsString();
}