Skip to content

Commit

Permalink
Improved Kotlin sample
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanOltmann committed Mar 28, 2024
1 parent b2c1561 commit a39638a
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions examples/xmpcore-kotlin-jvm-sample/src/main/kotlin/Main.kt
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import com.ashampoo.xmp.XMPConst
import com.ashampoo.xmp.XMPMetaFactory.create
import com.ashampoo.xmp.XMPMetaFactory.parseFromString
import com.ashampoo.xmp.XMPMetaFactory.serializeToString
import com.ashampoo.xmp.XMPMetaFactory
import com.ashampoo.xmp.options.ParseOptions
import com.ashampoo.xmp.options.PropertyOptions
import com.ashampoo.xmp.options.SerializeOptions

private val xmpSerializeOptionsCompact = SerializeOptions()
Expand All @@ -18,7 +15,7 @@ private val xmpParseOptions = ParseOptions()

fun main() {

val newXmpMeta = create()
val newXmpMeta = XMPMetaFactory.create()

/*
* Regular Adobe XMP Core API.
Expand All @@ -27,16 +24,15 @@ fun main() {
newXmpMeta.setPropertyInteger(
XMPConst.NS_XMP,
"Rating",
3,
PropertyOptions()
3
)

/* Ashampoo XMP Core convenience method. */
newXmpMeta.setKeywords(
setOf("cat", "cute", "animal")
)

val xmp = serializeToString(
val xmp = XMPMetaFactory.serializeToString(
newXmpMeta,
xmpSerializeOptionsCompact
)
Expand Down Expand Up @@ -64,7 +60,7 @@ fun main() {
""".trimIndent()

val oldXmpMeta =
parseFromString(oldXmp, xmpParseOptions)
XMPMetaFactory.parseFromString(oldXmp, xmpParseOptions)

println("---")

Expand Down

0 comments on commit a39638a

Please sign in to comment.