void WriteIncludes() { string deplist = "CPPDependencies"; WriteIncludes(deplist); string header = "\"" + OutputPath + ".h\""; FileContents.Insert(1, "#include " + header); NewLine(); }
// Create the pre-processor header guards void WriteHeaderGuard() { string headermacro = null; string format = ConfigFile.Get().GetString("HeaderGuardFormat"); // Check for a flag indicator if (format.Contains('<')) { int beg = format.IndexOf('<'); int end = format.IndexOf('>'); headermacro = format.Substring(0, beg); // Parse the flag string flag = format.Substring(beg + 1, end - beg - 1); if (flag.CompareTo("filename") == 0) { // "file" = filename headermacro = headermacro + OutputPath.ToUpper(); } headermacro = headermacro + format.Substring(end + 1, format.Length - (end + 1)); } else { // Default macro definition headermacro = "INCLUDED_" + OutputPath.ToUpper() + "_H"; } string endif = "#endif"; string hguardIF = "#ifndef " + headermacro; string hguardDEF = "#define " + headermacro; // Insert the header guard macro definitions at the beginning of the file FileContents.Insert(0, hguardIF); FileContents.Insert(1, hguardDEF + Format.endl); // Close the preprocessor definition at the end of the file NewLine(); FileContents.Add(endif + " " + "//" + hguardIF); }