void LatexDocVisitor::visitPre(DocDotFile *df)
{
   if (m_hide) {
      return;
   }

   startDotFile(df->file(), df->width(), df->height(), df->hasCaption());
}
Ejemplo n.º 2
0
void LatexDocVisitor::visit(DocVerbatim *s)
{
  if (m_hide) return;
  switch(s->type())
  {
    case DocVerbatim::Code: 
      m_t << "\n\n\\footnotesize\\begin{verbatim}"; 
      parseCode(m_ci,s->context(),s->text().latin1(),s->isExample(),s->exampleFile());
      m_t << "\\end{verbatim}\n\\normalsize" << endl; 
      break;
    case DocVerbatim::Verbatim: 
      m_t << "\n\n\\footnotesize\\begin{verbatim}"; 
      m_t << s->text();
      m_t << "\\end{verbatim}\n\\normalsize" << endl; 
      break;
    case DocVerbatim::HtmlOnly: 
    case DocVerbatim::XmlOnly: 
    case DocVerbatim::ManOnly: 
      /* nothing */ 
      break;
    case DocVerbatim::LatexOnly: 
      m_t << s->text(); 
      break;
    case DocVerbatim::Dot: 
      {
        static int dotindex = 1;
        QCString fileName(4096);

        fileName.sprintf("%s%d", 
            (Config_getString("LATEX_OUTPUT")+"/inline_dotgraph_").data(), 
            dotindex++
           );
        QFile file(fileName);
        if (!file.open(IO_WriteOnly))
        {
          err("Could not open file %s for writing\n",fileName.data());
        }
        file.writeBlock( s->text(), s->text().length() );
        file.close();

        m_t << "\\begin{center}\n";
        startDotFile(fileName,"","",FALSE);
        endDotFile(FALSE);
        m_t << "\\end{center}\n";

        file.remove();
      }
      break;
  }
}
Ejemplo n.º 3
0
void DocbookDocVisitor::visitPre(DocDotFile *df)
{
  if (m_hide) return;
  startDotFile(df->file(),df->width(),df->height(),df->hasCaption());
}
Ejemplo n.º 4
0
void LatexDocVisitor::visit(DocVerbatim *s)
{
  if (m_hide) return;
  QCString lang = m_langExt;
  if (!s->language().isEmpty()) // explicit language setting
  {
    lang = s->language();
  }
  switch(s->type())
  {
    case DocVerbatim::Code: 
      {
        m_t << "\n\\begin{DoxyCode}\n";
        Doxygen::parserManager->getParser(lang)
                              ->parseCode(m_ci,s->context(),s->text(),
                                          s->isExample(),s->exampleFile());
        m_t << "\\end{DoxyCode}\n";
      }
      break;
    case DocVerbatim::Verbatim: 
      m_t << "\\begin{DoxyVerb}";
      m_t << s->text();
      m_t << "\\end{DoxyVerb}\n";
      break;
    case DocVerbatim::HtmlOnly: 
    case DocVerbatim::XmlOnly: 
    case DocVerbatim::ManOnly: 
    case DocVerbatim::RtfOnly:
    case DocVerbatim::DocbookOnly:
      /* nothing */ 
      break;
    case DocVerbatim::LatexOnly: 
      m_t << s->text(); 
      break;
    case DocVerbatim::Dot: 
      {
        static int dotindex = 1;
        QCString fileName(4096);

        fileName.sprintf("%s%d%s", 
            (Config_getString("LATEX_OUTPUT")+"/inline_dotgraph_").data(), 
            dotindex++,
            ".dot"
           );
        QFile file(fileName);
        if (!file.open(IO_WriteOnly))
        {
          err("Could not open file %s for writing\n",fileName.data());
        }
        file.writeBlock( s->text(), s->text().length() );
        file.close();

        m_t << "\\begin{center}\n";
        startDotFile(fileName,"","",FALSE);
        endDotFile(FALSE);
        m_t << "\\end{center}\n";

        if (Config_getBool("DOT_CLEANUP")) file.remove();
      }
      break;
    case DocVerbatim::Msc: 
      {
        static int mscindex = 1;
        QCString baseName(4096);

        baseName.sprintf("%s%d", 
            (Config_getString("LATEX_OUTPUT")+"/inline_mscgraph_").data(), 
            mscindex++
           );
        QFile file(baseName+".msc");
        if (!file.open(IO_WriteOnly))
        {
          err("Could not open file %s.msc for writing\n",baseName.data());
        }
        QCString text = "msc {";
        text+=s->text();
        text+="}";
        file.writeBlock( text, text.length() );
        file.close();

        m_t << "\\begin{center}\n";
        writeMscFile(baseName);
        m_t << "\\end{center}\n";

        if (Config_getBool("DOT_CLEANUP")) file.remove();
      }
      break;
  }
}
void LatexDocVisitor::visit(DocVerbatim *s)
{
   if (m_hide) {
      return;
   }

   QString lang = m_langExt;
   if (! s->language().isEmpty()) { 
      // explicit language setting
      lang = s->language();
   }

   SrcLangExt langExt = getLanguageFromFileName(lang);

   switch (s->type()) {
      case DocVerbatim::Code: {
         m_t << "\n\\begin{DoxyCode}\n";
         Doxy_Globals::parserManager->getParser(lang)
         ->parseCode(m_ci, s->context(), s->text(), langExt,
                     s->isExample(), s->exampleFile());
         m_t << "\\end{DoxyCode}\n";
      }
      break;

      case DocVerbatim::Verbatim:
         m_t << "\\begin{DoxyVerb}";
         m_t << s->text();
         m_t << "\\end{DoxyVerb}\n";
         break;

      case DocVerbatim::HtmlOnly:
      case DocVerbatim::XmlOnly:
      case DocVerbatim::ManOnly:
      case DocVerbatim::RtfOnly:
      case DocVerbatim::DocbookOnly:
         /* nothing */
         break;

      case DocVerbatim::LatexOnly:
         m_t << s->text();
         break;

      case DocVerbatim::Dot: {
         static int dotindex = 1;

         QString latexOutput = Config::getString("latex-output") + "/inline_dotgraph_";        
         QString fileName = QString("%1%2.dot").arg(latexOutput).arg(dotindex++);

         QFile file(fileName);

         if (! file.open(QIODevice::WriteOnly)) {
            err("Unable to open file %s for writing, error: %d\n", csPrintable(fileName), file.error()); 
 
         } else {

            file.write( s->text().toUtf8() );
            file.close();
       
            startDotFile(fileName, s->width(), s->height(), s->hasCaption());
            visitCaption(this, s->children());
            endDotFile(s->hasCaption());

            if (Config::getBool("dot-cleanup")) {
               file.remove();
            }
         } 
      }
      break;

      case DocVerbatim::Msc: {
         static int mscindex = 1;

         QString latexOutput = Config::getString("latex-output") + "/inline_mscgraph_";
         QString baseName = QString("%1%2").arg(latexOutput).arg(mscindex++);

         QFile file(baseName + ".msc");

         if (! file.open(QIODevice::WriteOnly)) {
            err("Unable to open file %s.msc for writing, error: %d\n", qPrintable(baseName), file.error()); 

         } else {

            QString text = "msc {";
            text += s->text();
            text += "}";
   
            file.write( text.toUtf8() );
            file.close();
   
            writeMscFile(baseName, s);
   
            if (Config::getBool("dot-cleanup")) {
               file.remove();
            }
         }
      }
      break;

      case DocVerbatim::PlantUML: {
         QString latexOutput = Config::getString("latex-output");
         QString baseName    = writePlantUMLSource(latexOutput, s->exampleFile(), s->text());

         writePlantUMLFile(baseName, s);
      }
      break;
   }
}