Functions
docbookgen.h File Reference

Go to the source code of this file.

Functions

void generateDocbook ()
 

Function Documentation

void generateDocbook ( )

MAINPAGE DOCUMENTATION

MODULE GROUP DOCUMENTATION

Definition at line 1760 of file docbookgen.cpp.

1761 {
1762 
1763  // + classes
1764  // + namespaces
1765  // + files
1766  // + groups
1767  // + related pages
1768  // - examples
1769 
1770  QCString outputDirectory = Config_getString("DOCBOOK_OUTPUT");
1771  if (outputDirectory.isEmpty())
1772  {
1773  outputDirectory=QDir::currentDirPath().utf8();
1774  }
1775  else
1776  {
1777  QDir dir(outputDirectory);
1778  if (!dir.exists())
1779  {
1780  dir.setPath(QDir::currentDirPath());
1781  if (!dir.mkdir(outputDirectory))
1782  {
1783  err("tag DOCBOOK_OUTPUT: Output directory `%s' does not "
1784  "exist and cannot be created\n",outputDirectory.data());
1785  exit(1);
1786  }
1787  else
1788  {
1789  msg("Notice: Output directory `%s' does not exist. "
1790  "I have created it for you.\n", outputDirectory.data());
1791  }
1792  dir.cd(outputDirectory);
1793  }
1794  outputDirectory=dir.absPath().utf8();
1795  }
1796 
1797  QDir dir(outputDirectory);
1798  if (!dir.exists())
1799  {
1800  dir.setPath(QDir::currentDirPath());
1801  if (!dir.mkdir(outputDirectory))
1802  {
1803  err("Cannot create directory %s\n",outputDirectory.data());
1804  return;
1805  }
1806  }
1807  QDir docbookDir(outputDirectory);
1808  createSubDirs(docbookDir);
1809 
1810  QCString fileName=outputDirectory+"/index.xml";
1811  QCString dbk_projectName = Config_getString("PROJECT_NAME");
1812  QFile f(fileName);
1813 
1814  f.setName(fileName);
1815  if (!f.open(IO_WriteOnly))
1816  {
1817  err("Cannot open file %s for writing!\n",fileName.data());
1818  return;
1819  }
1820  FTextStream t(&f);
1821  //t.setEncoding(FTextStream::UnicodeUTF8);
1822 
1823  // write index header for Docbook which calls the structure file
1824  t << "<?xml version='1.0' encoding='UTF-8' standalone='no'?>" << endl;;
1825  t << "<book xmlns=\"http://docbook.org/ns/docbook\" version=\"5.0\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">" << endl;
1826  t << " <info>" << endl;
1827  t << " <title>" << dbk_projectName << "</title>" << endl;
1828  t << " </info>" << endl;
1829 
1830  // NAMESPACE DOCUMENTATION
1832  NamespaceDef *nd;
1833 
1834  //Namespace Documentation index header
1835  if (nli.toFirst())
1836  {
1837  t << " <chapter>" << endl;
1838  t << " <title>Namespace Documentation</title>" << endl;
1839  }
1840 
1841  for (nli.toFirst();(nd=nli.current());++nli)
1842  {
1843  msg("Generating Docbook output for namespace %s\n",nd->name().data());
1845  }
1846 
1847  //Namespace Documentation index footer
1848  if (nli.toFirst())
1849  {
1850  t << " </chapter>" << endl;
1851  }
1852 
1853  /** MAINPAGE DOCUMENTATION **/
1854 
1855  if (Doxygen::mainPage)
1856  {
1857  msg("Generating Docbook output for the main page\n");
1859  }
1860 
1861  // PAGE DOCUMENTATION
1862  {
1864  PageDef *pd=0;
1865 
1866  for (pdi.toFirst();(pd=pdi.current());++pdi)
1867  {
1868  msg("Generating Docbook output for page %s\n",pd->name().data());
1870  }
1871  }
1872 
1873  /** MODULE GROUP DOCUMENTATION **/
1874 
1876  GroupDef *gd;
1877 
1878  //Module group Documentation index header
1879  if (gli.toFirst())
1880  {
1881  t << " <chapter>" << endl;
1882  t << " <title>" << theTranslator->trModuleDocumentation() << "</title>" << endl;
1883  }
1884 
1885  for (;(gd=gli.current());++gli)
1886  {
1887  msg("Generating Docbook output for group %s\n",gd->name().data());
1889  }
1890 
1891  //Module group Documentation index footer
1892  if (gli.toFirst())
1893  {
1894  t << " </chapter>" << endl;
1895  }
1896 
1897  //CLASS DOCUMENTATION
1898 
1899  {
1901  ClassDef *cd;
1902 
1903  //Class Documentation index header
1904  if (cli.toFirst())
1905  {
1906  t << " <chapter>" << endl;
1907  t << " <title>" << theTranslator->trClassDocumentation() << "</title>" << endl;
1908  }
1909 
1910  for (cli.toFirst();(cd=cli.current());++cli)
1911  {
1913  }
1914 
1915  //Class Documentation index footer
1916  if (cli.toFirst())
1917  {
1918  t << " </chapter>" << endl;
1919  }
1920  }
1921 
1922  // FILE DOCUMENTATION
1923 
1924  static bool showFiles = Config_getBool("SHOW_FILES");
1925  if (showFiles)
1926  {
1928  FileName *fn;
1929 
1930  //File Documentation index header
1931  if (fnli.toFirst())
1932  {
1933  t << " <chapter>" << endl;
1934  t << " <title>" << theTranslator->trFileDocumentation() << "</title>" << endl;
1935  }
1936 
1937  for (;(fn=fnli.current());++fnli)
1938  {
1939  FileNameIterator fni(*fn);
1940  FileDef *fd;
1941  for (;(fd=fni.current());++fni)
1942  {
1943  msg("Generating Docbook output for file %s\n",fd->name().data());
1945  }
1946  }
1947 
1948  //File Documentation index footer
1949  if (fnli.toFirst())
1950  {
1951  t << " </chapter>" << endl;
1952  }
1953  }
1954 
1955  // DIRECTORY DOCUMENTATION
1956  if (Config_getBool("DIRECTORY_GRAPH") && Config_getBool("HAVE_DOT"))
1957  {
1958  DirDef *dir;
1960 
1961  //Directory Documentation index header
1962  if (sdi.toFirst())
1963  {
1964  t << " <chapter>" << endl;
1965  t << " <title>" << theTranslator->trDirDocumentation() << "</title>" << endl;
1966  }
1967 
1968  for (sdi.toFirst();(dir=sdi.current());++sdi)
1969  {
1970  msg("Generate Docbook output for dir %s\n",dir->name().data());
1971  generateDocbookForDir(dir,t);
1972  }
1973 
1974  //Module group Documentation index footer
1975  if (sdi.toFirst())
1976  {
1977  t << " </chapter>" << endl;
1978  }
1979  }
1980 
1981  // EXAMPLE PAGE DOCUMENTATION
1982 
1983  {
1985  PageDef *pd=0;
1986 
1987  //Example Page Documentation index header
1988  if (pdi.toFirst())
1989  {
1990  t << " <chapter>" << endl;
1991  t << " <title>" << theTranslator->trExampleDocumentation() << "</title>" << endl;
1992  }
1993 
1994  for (pdi.toFirst();(pd=pdi.current());++pdi)
1995  {
1996  msg("Generating Docbook output for example %s\n",pd->name().data());
1998  }
1999 
2000  //Example Page Documentation index footer
2001  if (pdi.toFirst())
2002  {
2003  t << " </chapter>" << endl;
2004  }
2005  }
2006 
2007  t << "</book>" << endl;
2008 
2009 }
Traverses directory structures and contents in a platform-independent way.
Definition: qdir.h:52
static GroupSDict * groupSDict
Definition: doxygen.h:119
static PageSDict * exampleSDict
Definition: doxygen.h:101
bool isEmpty() const
Definition: qcstring.h:189
void msg(const char *fmt,...)
Definition: message.cpp:107
#define IO_WriteOnly
Definition: qiodevice.h:62
static void generateDocbookForPage(PageDef *pd, FTextStream &ti, bool isExample)
const bool FALSE
Definition: qglobal.h:370
static FileNameList * inputNameList
Definition: doxygen.h:109
Simplified and optimized version of QTextStream.
Definition: ftextstream.h:11
string dir
virtual QCString trModuleDocumentation()=0
static NamespaceSDict * namespaceSDict
Definition: doxygen.h:120
def cli(ctx)
Definition: main.py:7
QAsciiDict< Entry > fn
const QCString & name() const
Definition: definition.h:114
virtual QCString trFileDocumentation()=0
fileName
Definition: dumpTree.py:9
QCString name() const
Definition: filedef.cpp:1193
virtual QCString trDirDocumentation()=0
static void generateDocbookForNamespace(NamespaceDef *nd, FTextStream &ti)
static DirSDict * directories
Definition: doxygen.h:139
static QString currentDirPath()
Definition: qdir_unix.cpp:141
virtual QCString trClassDocumentation()=0
static void generateDocbookForClass(ClassDef *cd, FTextStream &ti)
static PageSDict * pageSDict
Definition: doxygen.h:102
const char * data() const
Definition: qcstring.h:207
Definition: dirdef.h:44
#define Config_getString(val)
Definition: config.cpp:660
#define Config_getBool(val)
Definition: config.cpp:664
void err(const char *fmt,...)
Definition: message.cpp:226
The QFile class is an I/O device that operates on files.
Definition: qfile.h:50
virtual QCString trExampleDocumentation()=0
static void generateDocbookForDir(DirDef *dd, FTextStream &ti)
static void generateDocbookForFile(FileDef *fd, FTextStream &ti)
A model of a page symbol.
Definition: pagedef.h:29
Translator * theTranslator
Definition: language.cpp:157
void createSubDirs(QDir &d)
Definition: util.cpp:5458
friend class Iterator
Definition: sortdict.h:289
QCString utf8() const
Definition: qstring.cpp:14507
static ClassSDict * classSDict
Definition: doxygen.h:99
static PageDef * mainPage
Definition: doxygen.h:103
static void generateDocbookForGroup(GroupDef *gd, FTextStream &ti)
const bool TRUE
Definition: qglobal.h:371
QTextStream & endl(QTextStream &s)