diff options
Diffstat (limited to 'kvision-modules/kvision-common-types')
3 files changed, 72 insertions, 0 deletions
diff --git a/kvision-modules/kvision-common-types/build.gradle b/kvision-modules/kvision-common-types/build.gradle new file mode 100644 index 00000000..af3703e6 --- /dev/null +++ b/kvision-modules/kvision-common-types/build.gradle @@ -0,0 +1,10 @@ +apply plugin: 'kotlin-platform-common' +apply plugin: 'kotlinx-serialization' + +dependencies { + compile "org.jetbrains.kotlin:kotlin-stdlib-common:$kotlinVersion" + compile "org.jetbrains.kotlinx:kotlinx-serialization-runtime-common:$serializationVersion" + compile "org.jetbrains.kotlinx:kotlinx-coroutines-core-common:$coroutinesVersion" + testCompile "org.jetbrains.kotlin:kotlin-test-common:$kotlinVersion" + testCompile "org.jetbrains.kotlin:kotlin-test-annotations-common:$kotlinVersion" +} diff --git a/kvision-modules/kvision-common-types/src/main/kotlin/pl/treksoft/kvision/types/Date.kt b/kvision-modules/kvision-common-types/src/main/kotlin/pl/treksoft/kvision/types/Date.kt new file mode 100644 index 00000000..86a72b33 --- /dev/null +++ b/kvision-modules/kvision-common-types/src/main/kotlin/pl/treksoft/kvision/types/Date.kt @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2017-present Robert Jaros + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +package pl.treksoft.kvision.types + +expect class Date + +expect fun String.toDateF(format: String = "YYYY-MM-DD HH:mm:ss"): Date + +expect fun Date.toStringF(format: String = "YYYY-MM-DD HH:mm:ss"): String diff --git a/kvision-modules/kvision-common-types/src/main/kotlin/pl/treksoft/kvision/types/KFile.kt b/kvision-modules/kvision-common-types/src/main/kotlin/pl/treksoft/kvision/types/KFile.kt new file mode 100644 index 00000000..ce4adca4 --- /dev/null +++ b/kvision-modules/kvision-common-types/src/main/kotlin/pl/treksoft/kvision/types/KFile.kt @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2017-present Robert Jaros + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +package pl.treksoft.kvision.types + +import kotlinx.serialization.Serializable + +/** + * A serializable class for a multiplatform File type. + */ +@Serializable +data class KFile( + val name: String, + val size: Int, + val content: String? = null +) |