15 #ifndef TCLAP_DOCBOOKOUTPUT_H 16 #define TCLAP_DOCBOOKOUTPUT_H 37 class DocBookOutput :
public CmdLineOutput
47 virtual void usage(CmdLineInterface& c);
54 virtual void version(CmdLineInterface& c);
62 virtual void failure(CmdLineInterface& c,
83 std::cout << _cmd.getVersion() <<
std::endl;
88 std::list<Arg*> argList = _cmd.getArgList();
89 std::string progName = _cmd.getProgramName();
90 std::string
version = _cmd.getVersion();
91 XorHandler xorHandler = _cmd.getXorHandler();
92 std::vector< std::vector<Arg*> > xorList = xorHandler.getXorList();
95 std::cout <<
"<?xml version='1.0'?>" <<
std::endl;
96 std::cout <<
"<!DOCTYPE book PUBLIC \"-//Norman Walsh//DTD DocBk XML V4.2//EN\"" <<
std::endl;
97 std::cout <<
"\t\"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd\">" << std::endl <<
std::endl;
103 std::cout <<
"<refentrytitle>" <<
std::endl;
105 std::cout <<
"</refentrytitle>" <<
std::endl;
106 std::cout <<
"<manvolnum>1</manvolnum>" <<
std::endl;
109 std::cout <<
"<refnamediv>" <<
std::endl;
113 std::cout <<
"</refnamediv>" <<
std::endl;
115 std::cout <<
"<cmdsynopsis>" <<
std::endl;
117 std::cout <<
"<command>" << progName <<
"</command>" <<
std::endl;
120 for (
int i = 0; (
unsigned int)i < xorList.size(); i++ )
122 std::cout <<
"<group choice='req'>" <<
std::endl;
124 it != xorList[i].end(); it++ )
132 if ( !xorHandler.contains( (*it) ) )
135 std::cout <<
"</cmdsynopsis>" <<
std::endl;
138 std::cout <<
"<title>Description</title>" <<
std::endl;
140 std::cout << _cmd.getMessage() <<
std::endl;
145 std::cout <<
"<title>Options</title>" <<
std::endl;
147 std::cout <<
"<itemizedlist>" <<
std::endl;
149 for (
int i = 0; (
unsigned int)i < xorList.size(); i++ )
151 std::cout <<
"<itemizedlist>" <<
std::endl;
152 size_t xlen = xorList.size() - 1;
155 it != xorList[i].end(); it++, xcount++ )
159 std::cout <<
"<listitem>OR</listitem>" <<
std::endl;
162 std::cout <<
"</itemizedlist>" <<
std::endl;
167 if ( !xorHandler.contains( (*it) ) )
170 std::cout <<
"</itemizedlist>" <<
std::endl;
175 std::cout <<
"<title>Version</title>" <<
std::endl;
197 while ( (p = s.find_first_of(r)) != std::string::npos )
207 while ( (p = s.find_first_of(r)) != std::string::npos )
215 std::string lt =
"<";
216 std::string gt =
">";
218 std::string
id = a->shortID();
224 std::string choice =
"opt";
225 if ( a->isRequired() )
228 std::string repeat =
"norepeat";
229 if ( a->acceptsMultipleValues() )
234 std::cout <<
"<arg choice='" << choice
235 <<
"' repeat='" << repeat <<
"'>" 242 std::string lt =
"<";
243 std::string gt =
">";
245 std::string
id = a->longID();
251 std::string desc = a->getDescription();
255 std::cout <<
"<simplelist>" <<
std::endl;
265 std::cout <<
"</simplelist>" <<
std::endl;
void printShortArg(Arg *it)
virtual void version(CmdLineInterface &c)
virtual void usage(CmdLineInterface &c)
void printLongArg(Arg *it)
std::list< Arg * >::iterator ArgListIterator
virtual void failure(CmdLineInterface &c, ArgException &e)
void removeChar(std::string &s, char r)
std::vector< Arg * >::iterator ArgVectorIterator
void substituteSpecialChars(std::string &s, char r, std::string &x)