|
@@ -0,0 +1,45 @@
|
|
|
+import { XMLElem, type IToXML } from "@/util/XmlElem";
|
|
|
+import type { NamespaceTable } from "./NameSpaceTable";
|
|
|
+import type { IAddressSpace } from "./IAddressSpace";
|
|
|
+export class Definition implements IToXML {
|
|
|
+ public name:string;
|
|
|
+ public symbolicName:string|undefined;
|
|
|
+ public isUnion:boolean;
|
|
|
+ public IsOptionSet:boolean;
|
|
|
+ public baseType:string;
|
|
|
+
|
|
|
+ constructor(options: DefinitionOptions) {
|
|
|
+ this.name=options.name;
|
|
|
+ this.symbolicName=options.symbolicName;
|
|
|
+ this.isUnion=(options.isUnion===undefined?false:Boolean(options.isUnion));
|
|
|
+ this.IsOptionSet=(options.IsOptionSet===undefined?false:Boolean(options.IsOptionSet));
|
|
|
+ this.baseType=options.baseType||"";
|
|
|
+ }
|
|
|
+
|
|
|
+ toXML(_lnst:NamespaceTable, _gnst:NamespaceTable): XMLElem {
|
|
|
+ return new XMLElem("Definition")
|
|
|
+ .attr("Name", this.name)
|
|
|
+ .attr('SymbolicName', this.symbolicName)
|
|
|
+ .attr('IsUnion', this.isUnion)
|
|
|
+ .attr('IsOptionSet', this.IsOptionSet)
|
|
|
+ .attr('BaseType', this.baseType);
|
|
|
+ }
|
|
|
+
|
|
|
+ static fromXML(xmlDefinition: any, _addressSpace: IAddressSpace): Definition{
|
|
|
+ return new Definition({
|
|
|
+ name: xmlDefinition['@_Name'],
|
|
|
+ symbolicName: xmlDefinition['@_SymbolicName'],
|
|
|
+ isUnion: xmlDefinition['@_IsUnion'],
|
|
|
+ IsOptionSet: xmlDefinition['@_IsOptionSet'],
|
|
|
+ baseType: xmlDefinition['@_BaseType']
|
|
|
+ });
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+export interface DefinitionOptions{
|
|
|
+ name: string;
|
|
|
+ symbolicName?: string;
|
|
|
+ isUnion?: boolean;
|
|
|
+ IsOptionSet?: boolean;
|
|
|
+ baseType?:string;
|
|
|
+}
|