Simplify run format properties, removing duplicate classes. Add values functions, which check and clean up values for specific defined types from the schema

This commit is contained in:
Tom Hunkapiller
2021-05-24 08:20:08 +03:00
parent 449e1ed963
commit ee105cdb83
13 changed files with 274 additions and 265 deletions

View File

@ -0,0 +1,27 @@
import { Attributes, XmlComponent } from "file/xml-components";
import { hpsMeasureValue } from "../values";
// This represents element type CT_OnOff, which indicate a boolean value.
//
// <xsd:complexType name="CT_OnOff">
// <xsd:attribute name="val" type="s:ST_OnOff"/>
// </xsd:complexType>
export class OnOffElement extends XmlComponent {
constructor(name: string, val: boolean | undefined = true) {
super(name);
this.root.push(new Attributes({ val }));
}
}
// This represents element type CT_HpsMeasure, which indicate an unsigned int or a measurement with unit.
//
// <xsd:complexType name="CT_HpsMeasure">
// <xsd:attribute name="val" type="ST_HpsMeasure" use="required"/>
// </xsd:complexType>
export class HpsMeasureElement extends XmlComponent {
constructor(name: string, val: number | string) {
super(name);
this.root.push(new Attributes({ val: hpsMeasureValue(val) }));
}
}