[PATCH] - LATEX - Parameternames and Parametertypes generated in explicit layoutstyle(environment) "DoxyParamCaption"

Stefan Oberhumer <[email protected]>
Newsgroups gmane.text.doxygen.devel
Organization obssys.com
Message-ID <[email protected]>
This patch allows you to overwrite the layout of sections of modules within
the LATEX output.


The goal is to create a tabular look-like parameterlist - like in HTML.


eg:
  1.2.3 int foo(int param1, int param2)

can be converted into
  1.2.3 int foo(
                 mytype param1,
                 int param2
                )

The result is a list which uses the DoxyParamCaption environment.
example:
\subsubsection[{foo}]{\setlength{\rightskip}{0pt plus 5cm}{int} foo (
\begin{DoxyParamCaption}
\item[{mytype}}]{ param1, }
\item[{int}}]{ param2}
\end{DoxyParamCaption}
)}

For compatibliy reasons the default "DoxyParamCaption" environment in
doxygen.sty will produce the same style the output had before.

You can overwrite the DoxyParamCaption (use \renewenvironment) to generate
your own layout.


Best regards

Stefan

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july

_______________________________________________
Doxygen-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/doxygen-develop
parameters_with_explicit_styles.patch (text/plain, 4.4 KB)
Index: b/src/latexgen.cpp
===================================================================
--- a/src/latexgen.cpp
+++ b/src/latexgen.cpp
@@ -530,6 +530,11 @@
        "    \\end{description}%\n"
        "  \\end{DoxyDesc}%\n"
        "}\n\n";
+  t << "% is used for parameters within a detailed function description\n"
+       "\\newenvironment{DoxyParamCaption}{%\n"
+       "  \\renewcommand{\\item}[2][]{##1 \\em ##2}%\n"
+       "  }{%\n"
+       "}\n\n";
   t << "% Used by return value lists\n"
        "\\newenvironment{DoxyRetVals}[1]{%\n"
        "  \\begin{DoxyDesc}{#1}%\n"
@@ -1917,11 +1922,37 @@
   t << "\\end{Desc}" << endl;
 }
 
-void LatexGenerator::startParameterType(bool first,const char *key)
+void LatexGenerator::startParameterList(bool openBracket)
+{
+  /* start of ParameterTYpe ParameterName list */
+  if (openBracket) t << "(";
+  t << endl << "\\begin{DoxyParamCaption}" << endl;
+}
+
+void LatexGenerator::startParameterType(bool ,const char *key)
+{
+  t << "\\item[{";
+  t << key;
+}
+
+void LatexGenerator::endParameterType()
+{
+  t << "}]";
+}
+
+void LatexGenerator::startParameterName(bool /*oneArgOnly*/)
+{
+  t << "{";
+}
+
+void LatexGenerator::endParameterName(bool last,bool /* emptyList */,bool closeBracket)
 {
-  if (!first)
+  t << "}" << endl;
+
+  if (last)
   {
-    t << "\\/ " << key << " ";
+    t << "\\end{DoxyParamCaption}" << endl;
+    if(closeBracket) t << ")";
   }
 }
 
Index: b/src/latexgen.h
===================================================================
--- a/src/latexgen.h
+++ b/src/latexgen.h
@@ -215,10 +215,10 @@
     void startMemberDocName(bool) {}
     void endMemberDocName() {}
     void startParameterType(bool,const char *);
-    void endParameterType() {}
-    void startParameterName(bool) {}
-    void endParameterName(bool,bool,bool) {}
-    void startParameterList(bool) {}
+    void endParameterType();
+    void startParameterName(bool);
+    void endParameterName(bool last,bool emptyList,bool closeBracket);
+    void startParameterList(bool openBracket);
     void endParameterList() {}
 
     void startConstraintList(const char *);
Index: b/src/memberdef.cpp
===================================================================
--- a/src/memberdef.cpp
+++ b/src/memberdef.cpp
@@ -98,16 +98,21 @@
 
   //printf("writeDefArgList(%d)\n",defArgList->count());
   ol.pushGeneratorState();
-  ol.disableAllBut(OutputGenerator::Html);
+  bool htmlOn = ol.isEnabled(OutputGenerator::Html);
+  bool latexOn = ol.isEnabled(OutputGenerator::Latex);
   {
-    // html
+    // html and latex
+    ol.disableAll();
+    if(htmlOn) ol.enable(OutputGenerator::Html);
+    if(latexOn) ol.enable(OutputGenerator::Latex);
     ol.endMemberDocName();
     ol.startParameterList(!md->isObjCMethod());
   }
-  ol.enableAll();
-  ol.disable(OutputGenerator::Html);
   {
     // other formats
+    ol.enableAll();
+    ol.disable(OutputGenerator::Html);
+    ol.disable(OutputGenerator::Latex);
     if (!md->isObjCMethod()) ol.docify("("); // start argument list
     ol.endMemberDocName();
   }
@@ -202,12 +207,16 @@
         ol.docify(" ");
       }
       ol.disable(OutputGenerator::Man);
+      ol.disable(OutputGenerator::Latex);
       ol.startEmphasis();
       ol.enable(OutputGenerator::Man);
+      if(latexOn) ol.enable(OutputGenerator::Latex);
       if (a->name.isEmpty()) ol.docify(a->type); else ol.docify(a->name);
       ol.disable(OutputGenerator::Man);
+      ol.disable(OutputGenerator::Latex);
       ol.endEmphasis();
       ol.enable(OutputGenerator::Man);
+      if(latexOn) ol.enable(OutputGenerator::Latex);
     }
     if (!a->array.isEmpty())
     {
@@ -259,14 +268,15 @@
     }
     first=FALSE;
   }
+
   ol.pushGeneratorState();
-  bool htmlOn = ol.isEnabled(OutputGenerator::Html);
   ol.disable(OutputGenerator::Html);
+  ol.disable(OutputGenerator::Latex);
   //if (!first) ol.writeString("&nbsp;");
   if (!md->isObjCMethod()) ol.docify(")"); // end argument list
-  ol.enableAll();
-  ol.disableAllBut(OutputGenerator::Html);
-  if (!htmlOn) ol.disable(OutputGenerator::Html);
+  ol.disableAll();
+  if (htmlOn) ol.enable(OutputGenerator::Html);
+  if (latexOn) ol.enable(OutputGenerator::Latex);
   if (!md->isDefine())
   {
     if (first) ol.startParameterName(defArgList->count()<2);
@@ -279,6 +289,7 @@
     ol.endParameterName(TRUE,TRUE,!md->isObjCMethod());
   }
   ol.popGeneratorState();
+
   if (md->extraTypeChars())
   {
     ol.docify(md->extraTypeChars());
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.