Skip to content

Commit

Permalink
OscTypeTags updated
Browse files Browse the repository at this point in the history
  • Loading branch information
morisil committed Sep 6, 2024
1 parent 71fc06b commit fbbdff4
Showing 1 changed file with 1 addition and 18 deletions.
19 changes: 1 addition & 18 deletions xemantic-osc-api/src/commonMain/kotlin/type/OscTypeTags.kt
Original file line number Diff line number Diff line change
Expand Up @@ -43,24 +43,7 @@ public fun List<*>.oscTypeTags(): String = joinToString(separator = "") {
*
* @throws OscException if this object's type cannot be represented in OSC protocol.
*/
public val Any.oscTypeTag: String get() = when (this) {
is Int -> "i"
is Float -> "f"
is String -> "s"
is ByteArray -> "b"
is Boolean -> oscTypeTag
is OscImpulse -> "I"
is OscTimeTag -> "t"
is Long -> "h"
is Double -> "d"
is Char -> "c"
is OscColor -> "r"
is OscMidiMessage -> "m"
is List<*> -> "[${oscTypeTags()}]"
else -> throw OscException(
"Type unsupported in OSC: ${this::class}"
)
}
public expect val Any.oscTypeTag: String

public fun String.toBooleanOscTypeTag(): Boolean = when (this) {
"T" -> true
Expand Down

0 comments on commit fbbdff4

Please sign in to comment.