private void CreateManagedForwardDeclares_h()
        {
            string filename = GetHeaderFile(ForwardDeclHeaderName);
            using (ClassCreator cc = new ClassCreator())
            {
                cc.AddOutputFile(filename);
                CodeFormatter cf = cc.GetOutputFile("h");
                cf.WriteLine("#pragma once");
                cf.BeginNamespace(GenerationContext.Options.DestinationNamespace);
                foreach (string s in m_classNames)
                {
                    cf.FormatLine("class {0};", s);

                }
// Additional manually added converters
                cf.FormatLine("class RTFlist_List_Converter;");

                cf.EndNamespace();

            }
        }
예제 #2
0
        protected  override void WriteCppFile(ClassCreator cc)
        {
            CodeFormatter cppFile = BeginCppFile(cc);

            AddImplementationIncludes(cppFile);
            if (!UseManagedCtor)
                AddForeignToFCSPopulate(cppFile);
            AddFCSToForeignPopulate(cppFile);
            AddForeignToFCSConstruct(cppFile);
            AddFCSToForeignConstruct(cppFile);

            List<string> FCSProperties = ReflectionProvider.GetPropertiesForClass(this.FCSType.Name);
            List<string> handledMembers = CollectHandledMembers();

            foreach (string sProp in FCSProperties)
            {
                if (!handledMembers.Contains(sProp))
                    cppFile.FormatLine("// {0} : Unhandled FCS Property", sProp);

            }
        }
예제 #3
0
        public void GenerateHandlerClass()
        {
            using (ClassCreator cc = new ClassCreator())
            {
                cc.AddOutputFile(GetOutputFileName());
                CodeFormatter cf = cc.GetOutputFile("cs");

                cf.WriteLine("using System;");
                cf.WriteLine("using System.Collections.Generic;");
                cf.WriteLine("using System.Text;");
                cf.WriteLine("using System.Diagnostics;");
                //                cf.WriteLine("using System.Xml;");
                cf.WriteLine("using Workshare.Fcs.DocObjects.WordProcessor;");
                cf.WriteLine("using Workshare.Fcs.Base;");
                cf.WriteLine("");
                cf.FormatLine("namespace {0}", GenerationContext.TargetNamespace);
                cf.WriteLine("{");
                cf.FormatLine("partial class {0} : XMLConsumer", GetClassName());
                cf.WriteLine("{");

                EmitConstructors(cf);

                EmitStartNodeHandler(cf);

                EmitHandleNode(cf);

                EmitHandleEponymousNode(cf);

                EmitEnumeratedAttributeHandlers(cf);

                EmitOnSubConsumerComplete(cf);

                EmitPostProcess(cf);

                EmitMemberVariables(cf);
                cf.WriteLine("}");
                cf.WriteLine("}");
            }
        }
예제 #4
0
 protected override void WriteHeaderFile(ClassCreator cc)
 {
     CodeFormatter headerFile = BeginHeaderFile(cc);
     InsertConversionMethods(headerFile);
     EndHeaderFile(headerFile);
 }
예제 #5
0
 protected override void WriteCppFile(ClassCreator cc)
 {
     CodeFormatter cppFile = BeginCppFile(cc);
     AddForeignToFCSConvert(cppFile);
     AddFCSToForeignConvert(cppFile);
 }
예제 #6
0
        protected ClassCreator BuildClassCreator()
        {
            ClassCreator cc = new ClassCreator();

            string baseFileName = BuildBaseFileName(GenerationContext.Options.OutputDirectory);
            cc.AddOutputFile(baseFileName + ".h");
            cc.AddOutputFile(baseFileName + ".cpp");
            GenerationContext.AddNewFile(baseFileName + ".h");
            GenerationContext.AddNewFile(baseFileName + ".cpp");

            return cc;
        }
예제 #7
0
        protected CodeFormatter BeginCppFile(ClassCreator cc)
        {
            CodeFormatter cppFile = cc.GetOutputFile("cpp");
            cppFile.InsertDontEditDisclaimer();
            cppFile.AddInclude("stdafx.h");
            cppFile.AddInclude(GetClassName() + ".h");

            cppFile.FormatLine("using namespace {0};", GenerationContext.Options.DestinationNamespace);
            return cppFile;
        }
예제 #8
0
 protected abstract void WriteHeaderFile(ClassCreator cc);
예제 #9
0
 protected abstract void WriteCppFile(ClassCreator cc);
예제 #10
0
 protected CodeFormatter BeginHeaderFile(ClassCreator cc)
 {
     CodeFormatter headerFile = cc.GetOutputFile("h");
     headerFile.InsertDontEditDisclaimer();
     headerFile.WriteLine("#pragma once");
     InsertHeaderIncludes(headerFile);
     InsertReferencedNamespaces(headerFile, GenerationContext.Options.ReferencedNamespaces);
     headerFile.BeginNamespace(GenerationContext.Options.DestinationNamespace);
     headerFile.FormatLine("class {0}", GetClassName());
     headerFile.WriteLine("{");
     headerFile.DecreaseIndent();
     headerFile.WriteLine("public:");
     headerFile.IncreaseIndent();
     return headerFile;
 }