MCPcopy Create free account
hub / github.com/davisking/dlib / main

Function main

tools/htmlify/htmlify.cpp:83–400  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81!*/
82
83int main(int argc, char** argv)
84{
85 if (argc == 1)
86 {
87 cout << "\nTry the -h option for more information.\n";
88 return 0;
89 }
90
91 string file;
92 try
93 {
94 command_line_parser parser;
95 parser.add_option("b","Pretty print in black and white. The default is to pretty print in color.");
96 parser.add_option("n","Number lines.");
97 parser.add_option("h","Displays this information.");
98 parser.add_option("index","Create an index.");
99 parser.add_option("v","Display version.");
100 parser.add_option("man","Display the manual.");
101 parser.add_option("f","Specifies a list of file extensions to process when using the -i option. The list elements should be separated by spaces. The default is \"cpp h c\".",1);
102 parser.add_option("i","Specifies an input directory.",1);
103 parser.add_option("cat","Puts all the output into a single html file with the given name.",1);
104 parser.add_option("depth","Specifies how many directories deep to search when using the i option. The default value is 30.",1);
105 parser.add_option("o","This option causes all the output files to be created inside the given directory. If this option is not given then all output goes to the current working directory.",1);
106 parser.add_option("flatten","When this option is given it prevents the input directory structure from being replicated.");
107 parser.add_option("title","This option specifies a string which is prepended onto the title of the generated HTML",1);
108 parser.add_option("to-xml","Instead of generating HTML output, create a single output file called output.xml that contains "
109 "a simple XML database which lists all documented classes and functions.");
110 parser.add_option("t", "When creating XML output, replace tabs in comments with <arg> spaces.", 1);
111
112
113 parser.parse(argc,argv);
114
115
116 parser.check_incompatible_options("cat","o");
117 parser.check_incompatible_options("cat","flatten");
118 parser.check_incompatible_options("cat","index");
119 parser.check_option_arg_type<unsigned long>("depth");
120 parser.check_option_arg_range("t", 1, 100);
121
122 parser.check_incompatible_options("to-xml", "b");
123 parser.check_incompatible_options("to-xml", "n");
124 parser.check_incompatible_options("to-xml", "index");
125 parser.check_incompatible_options("to-xml", "cat");
126 parser.check_incompatible_options("to-xml", "o");
127 parser.check_incompatible_options("to-xml", "flatten");
128 parser.check_incompatible_options("to-xml", "title");
129
130 const char* singles[] = {"b","n","h","index","v","man","f","cat","depth","o","flatten","title","to-xml", "t"};
131 parser.check_one_time_options(singles);
132
133 const char* i_sub_ops[] = {"f","depth","flatten"};
134 parser.check_sub_options("i",i_sub_ops);
135
136 const char* to_xml_sub_ops[] = {"t"};
137 parser.check_sub_options("to-xml",to_xml_sub_ops);
138
139 const command_line_parser::option_type& b_opt = parser.option("b");
140 const command_line_parser::option_type& n_opt = parser.option("n");

Callers

nothing calls this directly

Calls 15

print_manualFunction · 0.85
generate_xml_markupFunction · 0.85
add_filesFunction · 0.85
errorClass · 0.85
htmlifyFunction · 0.85
parseMethod · 0.80
print_optionsMethod · 0.80
number_of_argumentsMethod · 0.80
countMethod · 0.80
valueMethod · 0.80
findMethod · 0.80
create_directoryFunction · 0.50

Tested by

no test coverage detected