aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/moe/nea')
-rw-r--r--src/main/kotlin/moe/nea/firm/EnumRenderer.kt8
-rw-r--r--src/main/kotlin/moe/nea/firm/ManagedConfig.kt8
-rw-r--r--src/main/kotlin/moe/nea/firm/ManagedOption.kt10
-rw-r--r--src/main/kotlin/moe/nea/firm/User.kt19
4 files changed, 4 insertions, 41 deletions
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<E: Any> {
- fun getName(option: ManagedOption<E>, value: E): String
companion object {
- fun <E: Enum<E>> default() = object: EnumRenderer<E> {
- override fun getName(option: ManagedOption<E>, value: E): String {
- return value.name.lowercase()
- }
-
- }
+ fun <E: Enum<E>> default() = object: EnumRenderer<E> {}
}
} \ 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 <E : Any> choice(
codec: Codec<E>,
renderer: EnumRenderer<E>,
- ): ManagedOption<E> {
- return TODO()
- }
+ ) {}
protected inline fun <reified E> choice(
- ): ManagedOption<E> where E : Enum<E>, E : StringIdentifiable {
+ ) where E : Enum<E>, E : StringIdentifiable {
return choice(
StringIdentifiable.createCodec { enumValues<E>() },
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<T : Any> : ReadOnlyProperty<Any?, T> {
- 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<TestEnum>()
- val optionAlt by choice<TestEnum>(enumEntries<TestEnum>(),
- StringIdentifiable.createCodec { enumValues<TestEnum>() },
- EnumRenderable.default(),
- )
-
- enum class TestEnum : StringIdentifiable {
- A, B, C;
- }
-}
-fun main() {
- User.option
-}