Exemple #1
0
        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, "");
        }
Exemple #2
0
        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);
            }
        }
Exemple #3
0
        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 ();
        }
Exemple #4
0
 private void GenMember(MemberDescription m, CsFile target)
 {
     target.emit (2, "public " + OfCardinality (m) + ResolveKeywords (m.Name) + " { get; set; }");
 }
Exemple #5
0
 private void GenClasses(IEnumerable<TypeDescription> source, CsFile target)
 {
     foreach (TypeDescription typeDef in source)
         GenClass (typeDef, target);
 }