private void GenClass(TypeDescription t, CsFile target) { Console.WriteLine ("create class " + t.Name); target.emit (1, "public class " + t.Name + " {"); foreach (MemberDescription m in t.Members) GenMember (m, target); target.emit (1, "}"); target.emit (1, ""); }
public Generate(string source, string targetDir) { CsFile SegmentFile = new CsFile (targetDir + "Seg.cs"); CsFile DocFile = new CsFile (targetDir + "Doc.cs"); if (source.EndsWith (".meta.xsd")) { GenCs (new TkXsd (source).SequenceDefs (), SegmentFile); GenCs (new TkXsd (source).DocDefs (), DocFile); } else { GenCs (new TkMetaFld (source + "MetaFld").SequenceDefs (), SegmentFile); GenCs (new TkMetaSeg (source + "MetaSeg").DocDefs (), DocFile); } }
private void GenCs(IEnumerable<TypeDescription> source, CsFile target) { target.emit (0, "using System;"); target.emit (0, "using System.Collections.Generic;"); target.emit (0, "using TkMeta.TkBaseTypes;"); target.emit (0, ""); target.emit (0, "namespace TkMeta"); target.emit (0, "{"); target.emit (0, ""); GenClasses (source, target); target.emit (0, ""); target.emit (0, "}"); target.flush (); }
private void GenMember(MemberDescription m, CsFile target) { target.emit (2, "public " + OfCardinality (m) + ResolveKeywords (m.Name) + " { get; set; }"); }
private void GenClasses(IEnumerable<TypeDescription> source, CsFile target) { foreach (TypeDescription typeDef in source) GenClass (typeDef, target); }