106 lines
3.1 KiB
Swift
106 lines
3.1 KiB
Swift
//
|
|
// Meter.swift
|
|
// HTMLStandard
|
|
//
|
|
// Generated on 09/23/2025.
|
|
// THIS FILE IS GENERATED. DO NOT EDIT.
|
|
//
|
|
import Foundation
|
|
|
|
/// <meter> Gauge
|
|
public class Meter : HTMLNode, IFlow, ILabelable, IPalpable, IPhrasing {
|
|
|
|
/// Low limit of high range. Valid floating-point number. The actual rules are more complicated than indicated.
|
|
public var high:Float? = nil
|
|
|
|
/// High limit of low range. Valid floating-point number. The actual rules are more complicated than indicated.
|
|
public var low:Float? = nil
|
|
|
|
/// Upper bound of range. Valid floating-point number. The actual rules are more complicated than indicated.
|
|
public var max:Float? = nil
|
|
|
|
/// Lower bound of range. Valid floating-point number. The actual rules are more complicated than indicated.
|
|
public var min:Float? = nil
|
|
|
|
/// Optimum value in gauge. Valid floating-point number. The actual rules are more complicated than indicated.
|
|
public var optimum:Float? = nil
|
|
|
|
/// Current value of the element. Valid floating-point number.
|
|
public var value:Float? = nil
|
|
|
|
|
|
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
|
var globalAttr = GlobalAttributesBuilder()
|
|
for (key, attValue) in attributes {
|
|
switch (key) {
|
|
case "high":
|
|
high = Float(attValue)
|
|
continue
|
|
case "low":
|
|
low = Float(attValue)
|
|
continue
|
|
case "max":
|
|
max = Float(attValue)
|
|
continue
|
|
case "min":
|
|
min = Float(attValue)
|
|
continue
|
|
case "optimum":
|
|
optimum = Float(attValue)
|
|
continue
|
|
case "value":
|
|
value = Float(attValue)
|
|
continue
|
|
|
|
default: break
|
|
}
|
|
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
|
continue
|
|
}
|
|
throw AppError("Unexpected attribute: \(key)")
|
|
}
|
|
var allItems:[HTMLNode] = []
|
|
while let obj = try parser?.readObject(endTag: "meter", xmlToHtmlMapper) {
|
|
allItems.append(obj)
|
|
}
|
|
super.init(globalAttr, allItems)
|
|
}
|
|
|
|
|
|
public func addChild(_ someElement:IPhrasing) {
|
|
children.append(someElement)
|
|
}
|
|
|
|
public override func renderAttributes() -> String {
|
|
var result = super.renderAttributes()
|
|
if let high = high {
|
|
result += " high='\(high)'"
|
|
}
|
|
if let low = low {
|
|
result += " low='\(low)'"
|
|
}
|
|
if let max = max {
|
|
result += " max='\(max)'"
|
|
}
|
|
if let min = min {
|
|
result += " min='\(min)'"
|
|
}
|
|
if let optimum = optimum {
|
|
result += " optimum='\(optimum)'"
|
|
}
|
|
if let value = value {
|
|
result += " value='\(value)'"
|
|
}
|
|
|
|
|
|
return result
|
|
}
|
|
|
|
override var nodeName: String {
|
|
return "meter"
|
|
}
|
|
|
|
override var isVoidElement: Bool {
|
|
return false
|
|
}
|
|
} |