Skip to content

Commit 8a9f8d6

Browse files
committed
support for Android API Level <30 (Space characters) issue #41
1 parent 4bef773 commit 8a9f8d6

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/main/kotlin/de/gmuth/ipp/core/IppAttributesGroup.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class IppAttributesGroup(val tag: IppTag) : LinkedHashMap<String, IppAttribute<*
5252

5353
@Suppress("UNCHECKED_CAST")
5454
fun <T> getValueOrNull(name: String): T? = get(name)?.run {
55-
if (tag.`is ValueTag and is not OutOfBandTag`()) {
55+
if (tag.isValueTagAndIsNotOutOfBandTag()) {
5656
if (values.size == 1) value as T?
5757
else {
5858
logger.warning { "For '$name' one value was expected but found ${values.size} values: $values (ignoring all)" }
@@ -63,19 +63,19 @@ class IppAttributesGroup(val tag: IppTag) : LinkedHashMap<String, IppAttribute<*
6363

6464
@Suppress("UNCHECKED_CAST")
6565
fun <T> getValuesOrNull(name: String): T? = get(name)?.run {
66-
if (tag.`is ValueTag and is not OutOfBandTag`()) values as T?
66+
if (tag.isValueTagAndIsNotOutOfBandTag()) values as T?
6767
else null
6868
}
6969

7070
@Suppress("UNCHECKED_CAST")
7171
fun <T> getValue(name: String): T = get(name)?.run {
72-
if (tag.`is ValueTag and is not OutOfBandTag`()) value as T
72+
if (tag.isValueTagAndIsNotOutOfBandTag()) value as T
7373
else throw IppException("'$name' value is out-of-band: tag=$tag")
7474
} ?: throwIppAttributeNotFoundException(name)
7575

7676
@Suppress("UNCHECKED_CAST")
7777
fun <T> getValues(name: String): T = get(name)?.run {
78-
if (tag.`is ValueTag and is not OutOfBandTag`()) values as T
78+
if (tag.isValueTagAndIsNotOutOfBandTag()) values as T
7979
else throw IppException("'$name' values are out-of-band: tag=$tag")
8080
} ?: throwIppAttributeNotFoundException(name)
8181

@@ -98,8 +98,8 @@ class IppAttributesGroup(val tag: IppTag) : LinkedHashMap<String, IppAttribute<*
9898
private fun throwIppAttributeNotFoundException(attributeName: String): Nothing =
9999
throw IppAttributeNotFoundException(attributeName, tag)
100100

101-
fun `remove attributes where tag is not ValueTag or tag is OutOfBandTag`() = values
102-
.filter { !it.tag.`is ValueTag and is not OutOfBandTag`() }
101+
fun removeAttributesWhereTagIsNotValueTagOrTagIsOutOfBandTag() = values
102+
.filter { !it.tag.isValueTagAndIsNotOutOfBandTag() }
103103
.map { remove(it.name) }
104104
.onEach { logger.finer { "$name: Removed attribute $it" } }
105105
.apply { if (isNotEmpty()) logger.fine { "$name: Removed $size attributes ${joinToString(",") { it!!.name }}" } }

src/main/kotlin/de/gmuth/ipp/core/IppTag.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package de.gmuth.ipp.core
22

33
/**
4-
* Copyright (c) 2020-2023 Gerhard Muth
4+
* Copyright (c) 2020-2025 Gerhard Muth
55
*/
66

77
// RFC 8010 and RFC 3380
@@ -68,7 +68,7 @@ enum class IppTag(
6868
fun isOutOfBandTag() = code in 0x10..0x1f
6969
fun isMemberAttrName() = this == MemberAttrName
7070
fun isMemberAttrValue() = this != MemberAttrName && isValueTag() && this != EndCollection
71-
fun `is ValueTag and is not OutOfBandTag`() = isValueTag() && !isOutOfBandTag()
71+
fun isValueTagAndIsNotOutOfBandTag() = isValueTag() && !isOutOfBandTag()
7272

7373
override fun toString() = registeredName
7474

0 commit comments

Comments
 (0)