23 #ifndef TCLAP_DOCBOOKOUTPUT_H
24 #define TCLAP_DOCBOOKOUTPUT_H
102 std::vector< std::vector<Arg*> > xorList = xorHandler.
getXorList();
105 std::cout <<
"<?xml version='1.0'?>" << std::endl;
106 std::cout <<
"<!DOCTYPE refentry PUBLIC \"-//OASIS//DTD DocBook XML V4.2//EN\"" << std::endl;
107 std::cout <<
"\t\"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd\">" << std::endl << std::endl;
109 std::cout <<
"<refentry>" << std::endl;
111 std::cout <<
"<refmeta>" << std::endl;
112 std::cout <<
"<refentrytitle>" << progName <<
"</refentrytitle>" << std::endl;
113 std::cout <<
"<manvolnum>1</manvolnum>" << std::endl;
114 std::cout <<
"</refmeta>" << std::endl;
116 std::cout <<
"<refnamediv>" << std::endl;
117 std::cout <<
"<refname>" << progName <<
"</refname>" << std::endl;
118 std::cout <<
"<refpurpose>" << _cmd.
getMessage() <<
"</refpurpose>" << std::endl;
119 std::cout <<
"</refnamediv>" << std::endl;
121 std::cout <<
"<refsynopsisdiv>" << std::endl;
122 std::cout <<
"<cmdsynopsis>" << std::endl;
124 std::cout <<
"<command>" << progName <<
"</command>" << std::endl;
127 for (
int i = 0; (
unsigned int)i < xorList.size(); i++ )
129 std::cout <<
"<group choice='req'>" << std::endl;
131 it != xorList[i].end(); it++ )
134 std::cout <<
"</group>" << std::endl;
139 if ( !xorHandler.
contains( (*it) ) )
142 std::cout <<
"</cmdsynopsis>" << std::endl;
143 std::cout <<
"</refsynopsisdiv>" << std::endl;
145 std::cout <<
"<refsect1>" << std::endl;
146 std::cout <<
"<title>Description</title>" << std::endl;
147 std::cout <<
"<para>" << std::endl;
149 std::cout <<
"</para>" << std::endl;
150 std::cout <<
"</refsect1>" << std::endl;
152 std::cout <<
"<refsect1>" << std::endl;
153 std::cout <<
"<title>Options</title>" << std::endl;
155 std::cout <<
"<variablelist>" << std::endl;
160 std::cout <<
"</variablelist>" << std::endl;
161 std::cout <<
"</refsect1>" << std::endl;
163 std::cout <<
"<refsect1>" << std::endl;
164 std::cout <<
"<title>Version</title>" << std::endl;
165 std::cout <<
"<para>" << std::endl;
166 std::cout << version << std::endl;
167 std::cout <<
"</para>" << std::endl;
168 std::cout <<
"</refsect1>" << std::endl;
170 std::cout <<
"</refentry>" << std::endl;
177 static_cast<void>(_cmd);
178 std::cout << e.
what() << std::endl;
187 while ( (p = s.find_first_of(r)) != std::string::npos )
197 while ( (p = s.find_first_of(r)) != std::string::npos )
205 size_t p = s.find_last_of(
'/');
206 if ( p != std::string::npos )
214 std::string lt =
"<";
215 std::string gt =
">";
223 std::string choice =
"opt";
227 std::cout <<
"<arg choice='" << choice <<
'\'';
229 std::cout <<
" rep='repeat'";
233 if ( !a->getFlag().empty() )
234 std::cout << a->flagStartChar() << a->getFlag();
236 std::cout << a->nameStartString() << a->getName();
237 if ( a->isValueRequired() )
239 std::string arg = a->shortID();
244 arg.erase(0, arg.find_last_of(theDelimiter) + 1);
245 std::cout << theDelimiter;
246 std::cout << "<replaceable>" << arg << "</replaceable>";
248 std::cout << "</arg>" << std::endl;
252 inline void DocBookOutput::printLongArg(Arg* a)
254 std::string lt = "<";
255 std::string gt = ">";
257 std::string desc = a->getDescription();
258 substituteSpecialChars(desc,'<
',lt);
259 substituteSpecialChars(desc,'>
',gt);
261 std::cout << "<varlistentry>" << std::endl;
263 if ( !a->getFlag().empty() )
265 std::cout << "<term>" << std::endl;
266 std::cout << "<option>";
267 std::cout << a->flagStartChar() << a->getFlag();
268 std::cout << "</option>" << std::endl;
269 std::cout << "</term>" << std::endl;
272 std::cout << "<term>" << std::endl;
273 std::cout << "<option>";
274 std::cout << a->nameStartString() << a->getName();
275 if ( a->isValueRequired() )
277 std::string arg = a->shortID();
282 arg.erase(0, arg.find_last_of(theDelimiter) + 1);
283 std::cout << theDelimiter;
284 std::cout << "<replaceable>" << arg << "</replaceable>";
286 std::cout << "</option>" << std::endl;
287 std::cout << "</term>" << std::endl;
289 std::cout << "<listitem>" << std::endl;
290 std::cout << "<para>" << std::endl;
291 std::cout << desc << std::endl;
292 std::cout << "</para>" << std::endl;
293 std::cout << "</listitem>" << std::endl;
295 std::cout << "</varlistentry>" << std::endl;