static void WriteIncludeBody(TypeDefinition def, ITextOutput output) { List <string> externalList; List <string> moduleEnumOrInterfaceList; List <string> classList; BuildIncludeList(def, out externalList, out classList, out moduleEnumOrInterfaceList); foreach (var m in classList) { if (m != def.Name) { TypeDefinition type = Util.GetTypeDefinition(def.Module, m); if (CppLanguage.IsNeedWriteHxx(type)) { output.WriteLine("#include <QuantKit/" + m + CppLanguage.HxxFileExtension + ">"); } else { output.WriteLine("#include <QuantKit/" + m + CppLanguage.HppFileExtension + ">"); } } } var tevent = Util.GetTypeDefinition(def.Module, "Event"); if (tevent == def || Util.isInhertFrom(def, tevent)) { if (classList.Count() > 0) { output.WriteLine(); } if (CppLanguage.IsNeedWriteHxx(def)) { output.WriteLine("#include <QuantKit/EventType.h>"); } } }
public static void WriteClass(TypeDefinition def, ITextOutput output) { if (def.IsInterface || Helper.isClassAsEnum(def)) { return; } output.WriteLine("#include <QuantKit/" + def.Name + ".h>"); output.WriteLine(); WriteIncludeBody(def, output); var info = InfoUtil.Info(def); bool isFinalClass = info != null && !info.HasDerivedClass; if (!CppLanguage.IsNeedWriteHxx(def)) { if (info.BaseTypeInModule != null) { output.WriteLine("#include \"" + info.BaseTypeInModule.Name + CppLanguage.HxxFileExtension + "\""); } var tevent = Util.GetTypeDefinition(def.Module, "Event"); if (tevent == def || Util.isInhertFrom(def, tevent)) { if (!CppLanguage.IsNeedWriteHxx(def)) { output.WriteLine("#include <QuantKit/EventType.h>"); } } Hxx.WriteClassBody(def, output); } else { output.WriteLine("#include \"" + def.Name + CppLanguage.HxxFileExtension + "\""); } //output.WriteLine("#include <QuantKit/" + def.Name + CppLanguage.HxxFileExtension + ">"); //output.WriteLine(); //WriteIncludeBody(def, output); output.WriteLine(); output.WriteLine("using namespace QuantKit;"); //output.WriteLine("using namespace QuantKit::Internal;"); output.WriteLine(); //WriteNamespaceStart(def.Namespace, output); //output.WriteLine("namespace Internal {"); //output.WriteLine(); Cxx.WritePrivateClassBody(def, output); //output.WriteLine("} // namespace Internal"); output.WriteLine(); output.WriteLine("// Pubic API "); output.WriteLine(); WriteProxyClassBody(def, output); if (!def.IsInterface && !Helper.isClassAsEnum(def)) { output.WriteLine(); output.WriteLine("QDataStream& " + def.Name + "::operator<<(QDataStream &stream, const " + def.Name + " &" + def.Name.ToLower() + ")"); output.WriteLine("{"); output.Indent(); output.WriteLine("return stream << " + def.Name.ToLower() + ".toString();"); output.Unindent(); output.WriteLine("}"); } output.WriteLine(); //WriteNamespaceEnd(def.Namespace, output); }