remove more duplicate classes; add additional values functions; clean up tests

This commit is contained in:
Tom Hunkapiller
2021-05-24 11:28:10 +03:00
parent a56119e7cd
commit ce2a0fb864
38 changed files with 311 additions and 362 deletions

View File

@ -4,13 +4,20 @@ import { hpsMeasureValue } from "../values";
// This represents element type CT_OnOff, which indicate a boolean value.
//
// A value of 1 or true specifies that the property shall be explicitly applied.
// This is the default value for this attribute, and is implied when the parent
// element is present, but this attribute is omitted.
// A value of 0 or false specifies that the property shall be explicitly turned off.
//
// <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 }));
if (val !== true) {
this.root.push(new Attributes({ val }));
}
}
}
@ -25,3 +32,15 @@ export class HpsMeasureElement extends XmlComponent {
this.root.push(new Attributes({ val: hpsMeasureValue(val) }));
}
}
// This represents element type CT_String, which indicate a string value.
//
// <xsd:complexType name="CT_String">
// <xsd:attribute name="val" type="s:ST_String" use="required"/>
// </xsd:complexType>
export class StringValueElement extends XmlComponent {
constructor(name: string, val: string) {
super(name);
this.root.push(new Attributes({ val }));
}
}