All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.lightningkite.khrysalis.util.StringChain.kt Maven / Gradle / Ivy

The newest version!
package com.lightningkite.khrysalis.util

interface Appending {
    fun appendTo(appendable: Appendable)
}
fun Appendable.appendPlus(part: Any){
    if(part is Appending) {
        part.appendTo(this)
    } else {
        append(part.toString())
    }
}

class AppendingChain(val parts: ArrayList): Appending {
    override fun toString(): String = buildString {
        for(part in parts){
            append(part)
        }
    }

    override fun appendTo(appendable: Appendable) {
        for(part in parts){
            appendable.appendPlus(part)
        }
    }
}

/*

fun KtClass.swift(out: Out) {
    when {
        x -> { swiftEnum(); return }
        y -> { swiftDataClass(); return }
    }
    out.appendln(name)
    out.appendln("{")
}


 */




© 2015 - 2024 Weber Informatics LLC | Privacy Policy