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(); } }
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); } }
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("}"); } }
protected override void WriteHeaderFile(ClassCreator cc) { CodeFormatter headerFile = BeginHeaderFile(cc); InsertConversionMethods(headerFile); EndHeaderFile(headerFile); }
protected override void WriteCppFile(ClassCreator cc) { CodeFormatter cppFile = BeginCppFile(cc); AddForeignToFCSConvert(cppFile); AddFCSToForeignConvert(cppFile); }
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; }
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; }
protected abstract void WriteHeaderFile(ClassCreator cc);
protected abstract void WriteCppFile(ClassCreator cc);
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; }