17 static bool CreateFile(
const std::string& optionName,
bool optionDefault,
const char* description)
19 const std::string mdFileName{
"opt-" + optionName +
".md"};
20 ofstream mdFile{mdFileName};
22 if(not mdFile.is_open()) {
26 cout <<
"Generating: " << mdFileName <<
"\n";
27 std::string linkName{optionName};
28 std::replace(linkName.begin(), linkName.end(),
'-',
'_');
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";
37 mdFile <<
"transforms into this:\n\n";
38 mdFile <<
"```.cpp\n";
39 mdFile << optionName <<
"-transformed\n";
48 #define INSIGHTS_OPT(opt, name, deflt, description, category) CreateFile(opt, deflt, description);
49 #include "../InsightsOptions.def"
53 ofstream mdFile{
"CommandLineOptions.md"};
55 if(not mdFile.is_open()) {
59 mdFile <<
"# C++ Insights command line options {#command_line_options}\n\n";
61 std::vector<std::string> options{};
63 #define INSIGHTS_OPT(opt, name, deflt, description, category) options.emplace_back(opt);
64 #include "../InsightsOptions.def"
66 sort(options.begin(), options.end());
68 for(
const auto& opt : options) {
69 std::string linkName{opt};
70 std::replace(linkName.begin(), linkName.end(),
'-',
'_');
73 mdFile <<
"* [" << opt <<
"](@ref " << linkName <<
")\n";
static bool CreateFile(const std::string &optionName, bool optionDefault, const char *description)
Create a markdown file which contains the information about the option.