Exemple #1
0
void ClangParser::linkInclude(CodeOutputInterface &ol,FileDef *fd,
    uint &line,uint &column,const char *text)
{
  QCString incName = text;
  incName = incName.mid(1,incName.length()-2); // strip ".." or  <..>
  FileDef *ifd=0;
  if (!incName.isEmpty())
  {
    FileName *fn = Doxygen::inputNameDict->find(incName);
    if (fn)
    {
      bool found=false;
      FileNameIterator fni(*fn);
      // for each include name
      for (fni.toFirst();!found && (ifd=fni.current());++fni)
      {
        // see if this source file actually includes the file
        found = fd->isIncluded(ifd->absFilePath());
        //printf("      include file %s found=%d\n",ifd->absFilePath().data(),found);
      }
    }
  }
  if (ifd)
  {
    ol.writeCodeLink(ifd->getReference(),ifd->getOutputFileBase(),0,text,ifd->briefDescriptionAsTooltip());
  }
  else
  {
    codifyLines(ol,ifd,text,line,column,"preprocessor");
  }
}
void ClangParser::linkInclude(CodeOutputInterface &ol, QSharedPointer<FileDef> fd, uint &line, uint &column, const QString &text)
{
   QString incName = text;
   incName = incName.mid(1, incName.length() - 2); // strip ".." or  <..>

   QSharedPointer<FileDef> ifd;

   if (! incName.isEmpty()) {     
      QSharedPointer<FileNameList> fn = Doxy_Globals::inputNameDict->find(incName);

      if (fn) {
         bool found = false;

         // for each include name, see if this source file actually includes the file
         for (auto fd : *fn) {   
                      
            if (found) {
               break;
            }                     

            ifd = fd;
            found = fd->isIncluded(ifd->getFilePath());
         }
      }

   }

   if (ifd) {
      ol.writeCodeLink(ifd->getReference(), ifd->getOutputFileBase(), 0, text, ifd->briefDescriptionAsTooltip());

   } else {
      codifyLines(ol, ifd, text, line, column, "preprocessor");
   }
}
static void writeMultiLineCodeLink(CodeOutputInterface &ol, QSharedPointer<FileDef> fd, uint &line, uint &column, 
                  QSharedPointer<Definition> d, const QString &text)
{
   static bool sourceTooltips = Config::getBool("source-tooltips");
   TooltipManager::instance()->addTooltip(d);

   QString ref    = d->getReference();
   QString file   = d->getOutputFileBase();
   QString anchor = d->anchor();

   QString tooltip;

   if (! sourceTooltips) { 
      // fall back to simple "title" tooltips
      tooltip = d->briefDescriptionAsTooltip();
   }

   QString tmp;

   for (auto c : text) { 

      if (c == '\n') {
         line++;         

         ol.writeCodeLink(ref, file, anchor, tmp, tooltip);
         ol.endCodeLine();

         ol.startCodeLine(true);
         writeLineNumber(ol, fd, line);

         tmp = "";

      } else {
         column++;
         tmp += c;
                
      }
   }

   if (! tmp.isEmpty() )  {
      ol.writeCodeLink(ref, file, anchor, tmp, tooltip); 
   }
}
Exemple #4
0
static void writeMultiLineCodeLink(CodeOutputInterface &ol,
                  FileDef *fd,uint &line,uint &column,
                  Definition *d,
                  const char *text)
{
  static bool sourceTooltips = Config_getBool(SOURCE_TOOLTIPS);
  TooltipManager::instance()->addTooltip(d);
  QCString ref  = d->getReference();
  QCString file = d->getOutputFileBase();
  QCString anchor = d->anchor();
  QCString tooltip;
  if (!sourceTooltips) // fall back to simple "title" tooltips
  {
   tooltip = d->briefDescriptionAsTooltip();
  }
  bool done=FALSE;
  char *p=(char *)text;
  while (!done)
  {
    char *sp=p;
    char c;
    while ((c=*p++) && c!='\n') { column++; }
    if (c=='\n')
    {
      line++;
      *(p-1)='\0';
      //printf("writeCodeLink(%s,%s,%s,%s)\n",ref,file,anchor,sp);
      ol.writeCodeLink(ref,file,anchor,sp,tooltip);
      ol.endCodeLine();
      ol.startCodeLine(TRUE);
      writeLineNumber(ol,fd,line);
    }
    else
    {
      //printf("writeCodeLink(%s,%s,%s,%s)\n",ref,file,anchor,sp);
      ol.writeCodeLink(ref,file,anchor,sp,tooltip);
      done=TRUE;
    }
  }
}