com.hp.jipp.encoding.ResolutionUnit.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jipp-core Show documentation
Show all versions of jipp-core Show documentation
IPP packet builder/parser
// Copyright 2017 HP Development Company, L.P.
// SPDX-License-Identifier: MIT
package com.hp.jipp.encoding
/** A unit of measurement used to describe resolution. */
data class ResolutionUnit(override val code: Int, override val name: String) : Enum() {
override fun toString() = super.toString()
/** Raw codes which may be used for direct comparisons. */
object Code {
const val dotsPerInch = 3
const val dotsPerCentimeter = 4
}
companion object {
@JvmField val dotsPerInch = ResolutionUnit(Code.dotsPerInch, "dpi")
@JvmField val dotsPerCentimeter = ResolutionUnit(Code.dotsPerCentimeter, "dpcm")
/** All known resolution values */
@JvmField val all = listOf(dotsPerInch, dotsPerCentimeter).map { it.code to it }.toMap()
operator fun get(value: Int): ResolutionUnit =
all[value] ?: ResolutionUnit(value, "???")
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy