From db633c02b9a9d6da8a95edaceba37aefc9f511d2 Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Thu, 28 Nov 2024 11:51:54 +0100 Subject: Remove even more elements --- src/main/kotlin/moe/nea/firm/EnumRenderer.kt | 8 +------- src/main/kotlin/moe/nea/firm/ManagedConfig.kt | 8 +++----- src/main/kotlin/moe/nea/firm/ManagedOption.kt | 10 ---------- src/main/kotlin/moe/nea/firm/User.kt | 19 ------------------- 4 files changed, 4 insertions(+), 41 deletions(-) delete mode 100644 src/main/kotlin/moe/nea/firm/ManagedOption.kt delete mode 100644 src/main/kotlin/moe/nea/firm/User.kt diff --git a/src/main/kotlin/moe/nea/firm/EnumRenderer.kt b/src/main/kotlin/moe/nea/firm/EnumRenderer.kt index 3ffd6d3..03f5f95 100644 --- a/src/main/kotlin/moe/nea/firm/EnumRenderer.kt +++ b/src/main/kotlin/moe/nea/firm/EnumRenderer.kt @@ -1,13 +1,7 @@ package moe.nea.firm interface EnumRenderer { - fun getName(option: ManagedOption, value: E): String companion object { - fun > default() = object: EnumRenderer { - override fun getName(option: ManagedOption, value: E): String { - return value.name.lowercase() - } - - } + fun > default() = object: EnumRenderer {} } } \ No newline at end of file diff --git a/src/main/kotlin/moe/nea/firm/ManagedConfig.kt b/src/main/kotlin/moe/nea/firm/ManagedConfig.kt index 0c2b8b4..741d6aa 100644 --- a/src/main/kotlin/moe/nea/firm/ManagedConfig.kt +++ b/src/main/kotlin/moe/nea/firm/ManagedConfig.kt @@ -4,16 +4,14 @@ import ext.StringIdentifiable import kotlin.enums.enumEntries -abstract class ManagedConfig(val identifier: String) { +abstract class ManagedConfig { protected fun choice( codec: Codec, renderer: EnumRenderer, - ): ManagedOption { - return TODO() - } + ) {} protected inline fun choice( - ): ManagedOption where E : Enum, E : StringIdentifiable { + ) where E : Enum, E : StringIdentifiable { return choice( StringIdentifiable.createCodec { enumValues() }, EnumRenderer.default(), diff --git a/src/main/kotlin/moe/nea/firm/ManagedOption.kt b/src/main/kotlin/moe/nea/firm/ManagedOption.kt deleted file mode 100644 index d51d693..0000000 --- a/src/main/kotlin/moe/nea/firm/ManagedOption.kt +++ /dev/null @@ -1,10 +0,0 @@ -package moe.nea.firm - -import kotlin.properties.ReadOnlyProperty -import kotlin.reflect.KProperty - -class ManagedOption : ReadOnlyProperty { - override fun getValue(thisRef: Any?, property: KProperty<*>): T { - return TODO() - } -} diff --git a/src/main/kotlin/moe/nea/firm/User.kt b/src/main/kotlin/moe/nea/firm/User.kt deleted file mode 100644 index 080f93a..0000000 --- a/src/main/kotlin/moe/nea/firm/User.kt +++ /dev/null @@ -1,19 +0,0 @@ -package moe.nea.firm - -import ext.StringIdentifiable -import kotlin.enums.enumEntries - -object User : ManagedConfig("test") { - val option by choice() - val optionAlt by choice(enumEntries(), - StringIdentifiable.createCodec { enumValues() }, - EnumRenderable.default(), - ) - - enum class TestEnum : StringIdentifiable { - A, B, C; - } -} -fun main() { - User.option -} -- cgit