MCPcopy Create free account
hub / github.com/andreasfertig/cppinsights / CreateFile

Function CreateFile

docs/OptionDocumentationGenerator.cpp:17–44  ·  view source on GitHub ↗

\brief Create a markdown file which contains the information about the option.

Source from the content-addressed store, hash-verified

15
16/// \brief Create a markdown file which contains the information about the option.
17static bool CreateFile(const std::string& optionName, bool optionDefault, const char* description)
18{
19 const std::string mdFileName{"opt-" + optionName + ".md"};
20 ofstream mdFile{mdFileName};
21
22 if(not mdFile.is_open()) {
23 return false;
24 }
25
26 cout << "Generating: " << mdFileName << "\n";
27 std::string linkName{optionName};
28 std::replace(linkName.begin(), linkName.end(), '-', '_');
29
30 mdFile << "# " << optionName << " {#" << linkName << "}\n";
31 mdFile << description << "\n\n";
32 mdFile << "__Default:__ " << (optionDefault ? "On" : "Off") << "\n\n";
33 mdFile << "__Examples:__\n\n";
34 mdFile << "```.cpp\n";
35 mdFile << optionName << "-source\n";
36 mdFile << "```\n\n";
37 mdFile << "transforms into this:\n\n";
38 mdFile << "```.cpp\n";
39 mdFile << optionName << "-transformed\n";
40 mdFile << "```\n";
41 mdFile.close();
42
43 return true;
44}
45
46int main()
47{

Callers

nothing calls this directly

Calls 2

beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected