30 #ifndef TCLAP_DOCBOOKOUTPUT_H 31 #define TCLAP_DOCBOOKOUTPUT_H 105 std::vector< std::vector<Arg*> > xorList = xorHandler.
getXorList();
108 std::cout <<
"<?xml version='1.0'?>" << std::endl;
109 std::cout <<
"<!DOCTYPE book PUBLIC \"-//Norman Walsh//DTD DocBk XML V4.2//EN\"" << std::endl;
110 std::cout <<
"\t\"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd\">" << std::endl << std::endl;
112 std::cout <<
"<book>" << std::endl;
113 std::cout <<
"<refentry>" << std::endl;
115 std::cout <<
"<refmeta>" << std::endl;
116 std::cout <<
"<refentrytitle>" << std::endl;
117 std::cout << progName << std::endl;
118 std::cout <<
"</refentrytitle>" << std::endl;
119 std::cout <<
"<manvolnum>1</manvolnum>" << std::endl;
120 std::cout <<
"</refmeta>" << std::endl;
122 std::cout <<
"<refnamediv>" << std::endl;
123 std::cout <<
"<refname>" << std::endl;
124 std::cout << progName << std::endl;
125 std::cout <<
"</refname>" << std::endl;
126 std::cout <<
"</refnamediv>" << std::endl;
128 std::cout <<
"<cmdsynopsis>" << std::endl;
130 std::cout <<
"<command>" << progName <<
"</command>" << std::endl;
133 for (
int i = 0; (
unsigned int)i < xorList.size(); i++ )
135 std::cout <<
"<group choice='req'>" << std::endl;
137 it != xorList[i].end(); it++ )
140 std::cout <<
"</group>" << std::endl;
145 if ( !xorHandler.
contains( (*it) ) )
148 std::cout <<
"</cmdsynopsis>" << std::endl;
150 std::cout <<
"<refsect1>" << std::endl;
151 std::cout <<
"<title>Description</title>" << std::endl;
152 std::cout <<
"<para>" << std::endl;
154 std::cout <<
"</para>" << std::endl;
155 std::cout <<
"</refsect1>" << std::endl;
157 std::cout <<
"<refsect1>" << std::endl;
158 std::cout <<
"<title>Options</title>" << std::endl;
159 std::cout <<
"<para>" << std::endl;
160 std::cout <<
"<itemizedlist>" << std::endl;
162 for (
int i = 0; (
unsigned int)i < xorList.size(); i++ )
164 std::cout <<
"<itemizedlist>" << std::endl;
165 size_t xlen = xorList.size() - 1;
168 it != xorList[i].end(); it++, xcount++ )
172 std::cout <<
"<listitem>OR</listitem>" << std::endl;
175 std::cout <<
"</itemizedlist>" << std::endl;
180 if ( !xorHandler.
contains( (*it) ) )
183 std::cout <<
"</itemizedlist>" << std::endl;
184 std::cout <<
"</para>" << std::endl;
185 std::cout <<
"</refsect1>" << std::endl;
187 std::cout <<
"<refsect1>" << std::endl;
188 std::cout <<
"<title>Version</title>" << std::endl;
189 std::cout <<
"<para>" << std::endl;
190 std::cout << version << std::endl;
191 std::cout <<
"</para>" << std::endl;
192 std::cout <<
"</refsect1>" << std::endl;
194 std::cout <<
"</refentry>" << std::endl;
195 std::cout <<
"</book>" << std::endl;
202 std::cout << e.
what() << std::endl;
210 while ( (p = s.find_first_of(r)) != std::string::npos )
220 while ( (p = s.find_first_of(r)) != std::string::npos )
228 std::string lt =
"<";
229 std::string gt =
">";
237 std::string choice =
"opt";
241 std::string repeat =
"norepeat";
247 std::cout <<
"<arg choice='" << choice
248 <<
"' repeat='" << repeat <<
"'>" 249 <<
id <<
"</arg>" << std::endl;
255 std::string lt =
"<";
256 std::string gt =
">";
258 std::string
id = a->
longID();
268 std::cout <<
"<simplelist>" << std::endl;
270 std::cout <<
"<member>" << std::endl;
271 std::cout <<
id << std::endl;
272 std::cout <<
"</member>" << std::endl;
274 std::cout <<
"<member>" << std::endl;
275 std::cout << desc << std::endl;
276 std::cout <<
"</member>" << std::endl;
278 std::cout <<
"</simplelist>" << std::endl;
virtual XorHandler & getXorHandler()=0
Returns the XorHandler.
The interface that any output object must implement.
void printShortArg(Arg *it)
std::list< Arg * >::iterator ArgListIterator
Typedef of an Arg list iterator.
EIGEN_STRONG_INLINE iterator begin()
This class handles lists of Arg's that are to be XOR'd on the command line.
virtual bool acceptsMultipleValues()
std::vector< std::vector< Arg * > > & getXorList()
virtual std::string & getMessage()=0
Returns the message string.
virtual void version(CmdLineInterface &c)
Prints the version to stdout.
virtual std::string & getVersion()=0
Returns the version string.
A virtual base class that defines the essential data for all arguments.
void printLongArg(Arg *it)
std::vector< Arg * >::iterator ArgVectorIterator
Typedef of an Arg vector iterator.
const char * what() const
Returns the arg id and error text.
virtual std::string shortID(const std::string &valueId="val") const
Returns a short ID for the usage.
A class that generates DocBook output for usage() method for the given CmdLine and its Args...
void substituteSpecialChars(std::string &s, char r, std::string &x)
Substitutes the char r for string x in string s.
virtual bool isRequired() const
Indicates whether the argument is required.
std::string getDescription() const
Returns the argument description.
virtual std::string longID(const std::string &valueId="val") const
Returns a long ID for the usage.
virtual std::string & getProgramName()=0
Returns the program name string.
bool contains(const Arg *a)
Simply checks whether the Arg is contained in one of the arg lists.
virtual void failure(CmdLineInterface &c, ArgException &e)
Prints (to stderr) an error message, short usage Can be overridden to produce alternative behavior...
virtual std::list< Arg * > & getArgList()=0
Returns the argList.
A simple class that defines and argument exception.
virtual void usage(CmdLineInterface &c)
Prints the usage to stdout.
void removeChar(std::string &s, char r)
The base class that manages the command line definition and passes along the parsing to the appropria...