22 #ifndef DtCmdLine_DOCBOOKOUTPUT_H
23 #define DtCmdLine_DOCBOOKOUTPUT_H
40 #ifdef DtUSE_UTILITIES_NAMESPACE
41 namespace DtUSE_UTILITIES_NAMESPACE
51 class DocBookOutput :
public CmdLineOutput
62 virtual void usage(CmdLineInterface& c);
69 virtual void version(CmdLineInterface& c);
77 virtual void failure(CmdLineInterface& c,
88 void substituteSpecialChars( std::string& s,
char r, std::string& x );
102 std::vector< std::vector<Arg*> > xorList = xorHandler.
getXorList();
105 std::cout <<
"<?xml version='1.0'?>" << std::endl;
106 std::cout <<
"<!DOCTYPE book PUBLIC \"-//Norman Walsh//DTD DocBk 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 <<
"<book>" << std::endl;
110 std::cout <<
"<cmdsynopsis>" << std::endl;
112 std::cout <<
"<command>" << progName <<
"</command>" << std::endl;
114 std::string lt =
"<";
115 std::string gt =
">";
118 for (
int i = 0; (
unsigned int)i < xorList.size(); i++ )
120 std::cout <<
"<group>" << std::endl;
122 it != xorList[i].end(); it++ )
124 std::string
id = (*it)->shortID();
125 substituteSpecialChars(
id,
'<',lt);
126 substituteSpecialChars(
id,
'>',gt);
127 std::cout <<
"<arg>" <<
id <<
"</arg>" << std::endl;
130 std::cout <<
"</group>" << std::endl;
134 if ( !xorHandler.
contains( (*it) ) )
136 std::string
id = (*it)->shortID();
137 substituteSpecialChars(
id,
'<',lt);
138 substituteSpecialChars(
id,
'>',gt);
139 std::cout <<
"<arg>" <<
id <<
"</arg>" << std::endl;
142 std::cout <<
"</cmdsynopsis>" << std::endl;
143 std::cout <<
"</book>" << std::endl;
150 std::cout << e.
what() << std::endl;
153 inline void DocBookOutput::substituteSpecialChars( std::string& s,
158 while ( (p = s.find_first_of(r)) != std::string::npos )
167 #ifdef DtUSE_UTILITIES_NAMESPACE
This file declares the class DtCmdLine::CmdLineOutput.
std::vector< std::vector< Arg * > > & getXorList()
Definition: cmdXorHandler.h:185
This file declares classes for VR-Link command line parsing utility.
This file declares the class DtCmdLine::CmdLineInterface.
This class handles lists of Arg's that are to be XOR'd on the command line.
Definition: cmdXorHandler.h:48
virtual std::list< Arg * > & getArgList()=0
Returns the argList.
A simple class that defines and argument exception.
Definition: cmdArgException.h:43
virtual XorHandler & getXorHandler()=0
Returns the XorHandler.
virtual std::string & getProgramName()=0
Returns the program name string.
This file declares the class DtCmdLine::XorHandler.
bool contains(const Arg *a)
Simply checks whether the Arg is contained in one of the arg lists.
Definition: cmdXorHandler.h:173
virtual std::string & getVersion()=0
Returns the version string.
std::list< Arg * >::iterator ArgListIterator
Typedef of an Arg list iterator.
Definition: cmdArg.h:342
The base class that manages the command line definition and passes along the parsing to the appropria...
Definition: cmdLineInterface.h:52
std::vector< Arg * >::iterator ArgVectorIterator
Typedef of an Arg vector iterator.
Definition: cmdArg.h:347
const char * what() const
Returns the arg id and error text.
Definition: cmdArgException.h:87