UAVariableType.ts 1012 B

12345678910111213141516171819202122232425262728293031
  1. import { XMLElem } from "@/util/XmlElem";
  2. import type { NamespaceTable } from "./NameSpaceTable";
  3. import { UABaseNode, type UABaseNodeOptions } from "./UABaseNode";
  4. import type { IAddressSpace } from "./IAddressSpace";
  5. export class UAVariableType extends UABaseNode{
  6. public isAbstract: boolean;
  7. constructor(options: UAVariableTypeOptions) {
  8. super(options)
  9. this.isAbstract=options.isAbstract||false;
  10. }
  11. static fromXML(xmlObjType: any, addressSpace: IAddressSpace): UAVariableType{
  12. const bn=super.fromXML(xmlObjType, addressSpace)
  13. const uavt= new UAVariableType(bn as UABaseNodeOptions);
  14. uavt.isAbstract= xmlObjType['@_IsAbstract']==='true';
  15. return uavt;
  16. }
  17. toXML(lnst:NamespaceTable, gnst:NamespaceTable): XMLElem {
  18. const elem =super.toXML(lnst, gnst);
  19. elem.attr('IsAbstract', this.isAbstract);
  20. return elem;
  21. }
  22. }
  23. export interface UAVariableTypeOptions extends UABaseNodeOptions{
  24. isAbstract?: boolean
  25. }