From 6f80f9d5b0f2559508783bbdc239bee27deb2568 Mon Sep 17 00:00:00 2001 From: Charles Lombardo Date: Tue, 7 Mar 2023 17:20:06 -0500 Subject: android: Convert Setting to Kotlin --- .../yuzu_emu/features/settings/model/Setting.java | 42 ---------------------- .../yuzu_emu/features/settings/model/Setting.kt | 24 +++++++++++++ 2 files changed, 24 insertions(+), 42 deletions(-) delete mode 100644 src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/Setting.java create mode 100644 src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/Setting.kt (limited to 'src') diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/Setting.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/Setting.java deleted file mode 100644 index 28003078a..000000000 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/Setting.java +++ /dev/null @@ -1,42 +0,0 @@ -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(); -} diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/Setting.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/Setting.kt new file mode 100644 index 000000000..11cd10a1e --- /dev/null +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/Setting.kt @@ -0,0 +1,24 @@ +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. + */ +abstract class Setting( + /** + * @return The identifier used to write this setting to the ini file. + */ + val key: String, + /** + * @return The name of the header under which this Setting should be written in the ini file. + */ + val section: String +) { + + /** + * @return A representation of this Setting's backing value converted to a String (e.g. for serialization). + */ + abstract val valueAsString: String +} -- cgit v1.2.3