Orb/Doxygen/src/definition.cpp
changeset 4 468f4c8d3d5b
parent 0 42188c7ea2d9
equal deleted inserted replaced
3:d8fccb2cd802 4:468f4c8d3d5b
     1 /******************************************************************************
     1 /******************************************************************************
     2  *
     2  *
     3  * 
     3  * 
     4  *
     4  *
     5  * Copyright (C) 1997-2008 by Dimitri van Heesch.
     5  * Copyright (C) 1997-2010 by Dimitri van Heesch.
     6  *
     6  *
     7  * Permission to use, copy, modify, and distribute this software and its
     7  * Permission to use, copy, modify, and distribute this software and its
     8  * documentation under the terms of the GNU General Public License is hereby 
     8  * documentation under the terms of the GNU General Public License is hereby 
     9  * granted. No representations are made about the suitability of this software 
     9  * granted. No representations are made about the suitability of this software 
    10  * for any purpose. It is provided "as is" without express or implied warranty.
    10  * for any purpose. It is provided "as is" without express or implied warranty.
   243   }
   243   }
   244 }
   244 }
   245 
   245 
   246 void Definition::removeFromMap(Definition *d)
   246 void Definition::removeFromMap(Definition *d)
   247 {
   247 {
   248   QCString symbolName = d->symbolName();
   248   QString symbolName = d->m_symbolName;
   249   int index=computeQualifiedIndex(symbolName);
       
   250   if (index!=-1) symbolName=symbolName.mid(index+2);
       
   251   if (!symbolName.isEmpty()) 
   249   if (!symbolName.isEmpty()) 
   252   {
   250   {
   253     //printf("******* removing symbol `%s' (%p)\n",symbolName.data(),d);
   251     //printf("******* removing symbol `%s' (%p)\n",symbolName.data(),d);
   254     DefinitionIntf *di=Doxygen::symbolMap->find(symbolName);
   252     DefinitionIntf *di=Doxygen::symbolMap->find(symbolName);
   255     if (di)
   253     if (di)
   449   int bl = brief.length();
   447   int bl = brief.length();
   450   if (bl>0 && needsDot) // add punctuation if needed
   448   if (bl>0 && needsDot) // add punctuation if needed
   451   {
   449   {
   452     switch(brief.at(bl-1))
   450     switch(brief.at(bl-1))
   453     {
   451     {
   454       case '.': case '!': case '?': break;
   452       case '.': case '!': case '?': case '>': case ':': break;
   455       default: 
   453       default: 
   456         if (uni_isupper(brief.at(0))) brief+='.'; 
   454         if (uni_isupper(brief.at(0))) brief+='.'; 
   457         break;
   455         break;
   458     }
   456     }
   459   }
   457   }
   839                        0,                // exampleName
   837                        0,                // exampleName
   840                        m_impl->body->fileDef,  // fileDef
   838                        m_impl->body->fileDef,  // fileDef
   841                        actualStart,      // startLine
   839                        actualStart,      // startLine
   842                        actualEnd,        // endLine
   840                        actualEnd,        // endLine
   843                        TRUE,             // inlineFragment
   841                        TRUE,             // inlineFragment
   844                        thisMd            // memberDef
   842                        thisMd,           // memberDef
       
   843                        FALSE             // show line numbers
   845                       );
   844                       );
   846       ol.endCodeFragment();
   845       ol.endCodeFragment();
   847       ol.endParagraph();
   846       ol.endParagraph();
   848     }
   847     }
   849   }
   848   }
   854  *  definition is used.
   853  *  definition is used.
   855  */
   854  */
   856 void Definition::_writeSourceRefList(OutputList &ol,const char *scopeName,
   855 void Definition::_writeSourceRefList(OutputList &ol,const char *scopeName,
   857     const QCString &text,MemberSDict *members,bool /*funcOnly*/)
   856     const QCString &text,MemberSDict *members,bool /*funcOnly*/)
   858 {
   857 {
   859 static bool latexSourceCode = Config_getBool("LATEX_SOURCE_CODE"); 
   858   static bool latexSourceCode = Config_getBool("LATEX_SOURCE_CODE"); 
   860  ol.pushGeneratorState();
   859   static bool sourceBrowser   = Config_getBool("SOURCE_BROWSER");
   861   if (/*Config_getBool("SOURCE_BROWSER") &&*/ members)
   860   static bool refLinkSource   = Config_getBool("REFERENCES_LINK_SOURCE");
       
   861   ol.pushGeneratorState();
       
   862   if (members)
   862   {
   863   {
   863     ol.startParagraph();
   864     ol.startParagraph();
   864     ol.parseText(text);
   865     ol.parseText(text);
   865     ol.docify(" ");
   866     ol.docify(" ");
   866 
   867 
   893         }
   894         }
   894         if (!md->isObjCMethod() &&
   895         if (!md->isObjCMethod() &&
   895             (md->isFunction() || md->isSlot() || 
   896             (md->isFunction() || md->isSlot() || 
   896              md->isPrototype() || md->isSignal()
   897              md->isPrototype() || md->isSignal()
   897             )
   898             )
   898            ) name+="()";
   899            ) 
       
   900         {
       
   901           name+="()";
       
   902         }
   899         //Definition *d = md->getOutputFileBase();
   903         //Definition *d = md->getOutputFileBase();
   900         //if (d==Doxygen::globalScope) d=md->getBodyDef();
   904         //if (d==Doxygen::globalScope) d=md->getBodyDef();
   901         if (!(md->isLinkable() && !Config_getBool("REFERENCES_LINK_SOURCE")) && md->getStartBodyLine()!=-1 && md->getBodyDef()) 
   905         if (sourceBrowser &&
       
   906             !(md->isLinkable() && !refLinkSource) && 
       
   907             md->getStartBodyLine()!=-1 && 
       
   908             md->getBodyDef()
       
   909            )
   902         {
   910         {
   903           //printf("md->getBodyDef()=%p global=%p\n",md->getBodyDef(),Doxygen::globalScope); 
   911           //printf("md->getBodyDef()=%p global=%p\n",md->getBodyDef(),Doxygen::globalScope); 
   904           // for HTML write a real link
   912           // for HTML write a real link
   905           ol.pushGeneratorState();
   913           ol.pushGeneratorState();
   906           //ol.disableAllBut(OutputGenerator::Html);
   914           //ol.disableAllBut(OutputGenerator::Html);
   907            
   915 
   908          ol.disable(OutputGenerator::RTF); 
   916           ol.disable(OutputGenerator::RTF); 
   909          ol.disable(OutputGenerator::Man); 
   917           ol.disable(OutputGenerator::Man); 
   910          if (!latexSourceCode)
   918           if (!latexSourceCode)
   911          {
   919           {
   912           ol.disable(OutputGenerator::Latex);
   920             ol.disable(OutputGenerator::Latex);
   913         }
   921           }
   914           QCString lineStr,anchorStr;
   922           QCString lineStr,anchorStr;
   915           anchorStr.sprintf("l%05d",md->getStartBodyLine());
   923           anchorStr.sprintf("l%05d",md->getStartBodyLine());
   916           //printf("Write object link to %s\n",md->getBodyDef()->getSourceFileBase().data());
   924           //printf("Write object link to %s\n",md->getBodyDef()->getSourceFileBase().data());
   917           ol.writeObjectLink(0,md->getBodyDef()->getSourceFileBase(),anchorStr,name);
   925           ol.writeObjectLink(0,md->getBodyDef()->getSourceFileBase(),anchorStr,name);
   918           ol.popGeneratorState();
   926           ol.popGeneratorState();
   919 
   927 
   920           // for the other output formats just mention the name
   928           // for the other output formats just mention the name
   921           ol.pushGeneratorState();
   929           ol.pushGeneratorState();
   922            ol.disable(OutputGenerator::Html);
   930           ol.disable(OutputGenerator::Html);
   923            if (latexSourceCode)
   931           if (latexSourceCode)
   924           {
   932           {
   925             ol.disable(OutputGenerator::Latex);
   933             ol.disable(OutputGenerator::Latex);
   926            }
   934           }
   927           ol.docify(name);
   935           ol.docify(name);
   928           ol.popGeneratorState();
   936           ol.popGeneratorState();
   929         }
   937         }
   930         else if (md->isLinkable() /*&& d && d->isLinkable()*/)
   938         else if (md->isLinkable() /*&& d && d->isLinkable()*/)
   931         {
   939         {
   935           ol.disable(OutputGenerator::RTF); 
   943           ol.disable(OutputGenerator::RTF); 
   936           ol.disable(OutputGenerator::Man); 
   944           ol.disable(OutputGenerator::Man); 
   937           if (!latexSourceCode)
   945           if (!latexSourceCode)
   938           {
   946           {
   939             ol.disable(OutputGenerator::Latex);
   947             ol.disable(OutputGenerator::Latex);
   940            }
   948           }
   941      
   949 
   942           ol.writeObjectLink(md->getReference(),
   950           ol.writeObjectLink(md->getReference(),
   943                              md->getOutputFileBase(),
   951               md->getOutputFileBase(),
   944                              md->anchor(),name);
   952               md->anchor(),name);
   945           ol.popGeneratorState();
   953           ol.popGeneratorState();
   946 
   954 
   947           // for the other output formats just mention the name
   955           // for the other output formats just mention the name
   948           ol.pushGeneratorState();
   956           ol.pushGeneratorState();
   949           ol.disable(OutputGenerator::Html);
   957           ol.disable(OutputGenerator::Html);
   950            if (latexSourceCode)
   958           if (latexSourceCode)
   951            {
   959           {
   952             ol.disable(OutputGenerator::Latex);
   960             ol.disable(OutputGenerator::Latex);
   953            }
   961           }
   954           ol.docify(name);
   962           ol.docify(name);
   955           ol.popGeneratorState();
   963           ol.popGeneratorState();
   956         }
   964         }
   957         else
   965         else
   958         {
   966         {
  1146   m_impl->partOfGroups->append(gd);
  1154   m_impl->partOfGroups->append(gd);
  1147 }
  1155 }
  1148 
  1156 
  1149 void Definition::setRefItems(const QList<ListItemInfo> *sli)
  1157 void Definition::setRefItems(const QList<ListItemInfo> *sli)
  1150 {
  1158 {
       
  1159   //printf("%s::setRefItems()\n",name().data());
  1151   if (sli)
  1160   if (sli)
  1152   {
  1161   {
  1153     makeResident();
  1162     makeResident();
  1154     // deep copy the list
  1163     // deep copy the list
  1155     if (m_impl->xrefListItems==0) 
  1164     if (m_impl->xrefListItems==0) 
  1166   }
  1175   }
  1167 }
  1176 }
  1168 
  1177 
  1169 void Definition::mergeRefItems(Definition *d)
  1178 void Definition::mergeRefItems(Definition *d)
  1170 {
  1179 {
       
  1180   //printf("%s::mergeRefItems()\n",name().data());
  1171   LockingPtr< QList<ListItemInfo> > xrefList = d->xrefListItems();
  1181   LockingPtr< QList<ListItemInfo> > xrefList = d->xrefListItems();
  1172   if (xrefList!=0)
  1182   if (xrefList!=0)
  1173   {
  1183   {
  1174     makeResident();
  1184     makeResident();
  1175     // deep copy the list
  1185     // deep copy the list
  1226   {
  1236   {
  1227     return ::convertNameToFile(name,allowDots);
  1237     return ::convertNameToFile(name,allowDots);
  1228   }
  1238   }
  1229 }
  1239 }
  1230 
  1240 
       
  1241 QCString Definition::pathFragment() const
       
  1242 {
       
  1243   makeResident();
       
  1244   QCString result;
       
  1245   if (m_impl->outerScope && m_impl->outerScope!=Doxygen::globalScope)
       
  1246   {
       
  1247     result = m_impl->outerScope->pathFragment();
       
  1248   }
       
  1249   if (isLinkable())
       
  1250   {
       
  1251     if (!result.isEmpty()) result+="/";
       
  1252     if (definitionType()==Definition::TypeGroup && ((const GroupDef*)this)->groupTitle())
       
  1253     {
       
  1254       result+=((const GroupDef*)this)->groupTitle();
       
  1255     }
       
  1256     else if (definitionType()==Definition::TypePage && !((const PageDef*)this)->title().isEmpty())
       
  1257     {
       
  1258       result+=((const PageDef*)this)->title();
       
  1259     }
       
  1260     else
       
  1261     {
       
  1262       result+=m_impl->localName;
       
  1263     }
       
  1264   }
       
  1265   else
       
  1266   {
       
  1267     result+=m_impl->localName;
       
  1268   }
       
  1269   return result;
       
  1270 }
       
  1271 
  1231 void Definition::writePathFragment(OutputList &ol) const
  1272 void Definition::writePathFragment(OutputList &ol) const
  1232 {
  1273 {
  1233   makeResident();
  1274   makeResident();
  1234   if (m_impl->outerScope && m_impl->outerScope!=Doxygen::globalScope)
  1275   if (m_impl->outerScope && m_impl->outerScope!=Doxygen::globalScope)
  1235   {
  1276   {
  1236     m_impl->outerScope->writePathFragment(ol);
  1277     m_impl->outerScope->writePathFragment(ol);
  1237     if (m_impl->outerScope->definitionType()==Definition::TypeClass ||
  1278   }
  1238         m_impl->outerScope->definitionType()==Definition::TypeNamespace)
  1279   ol.writeString("      <li>");
  1239     {
       
  1240       if (Config_getBool("OPTIMIZE_OUTPUT_JAVA") ||
       
  1241           Config_getBool("OPTIMIZE_OUTPUT_VHDL")
       
  1242          )
       
  1243       {
       
  1244         ol.writeString(".");
       
  1245       }
       
  1246       else
       
  1247       {
       
  1248         ol.writeString("::");
       
  1249       }
       
  1250     }
       
  1251     else
       
  1252     {
       
  1253       ol.writeString("&nbsp;");
       
  1254       ol.writeString("&raquo;");
       
  1255       ol.writeString("&nbsp;");
       
  1256     }
       
  1257   }
       
  1258   if (isLinkable())
  1280   if (isLinkable())
  1259   {
  1281   {
  1260     if (definitionType()==Definition::TypeGroup && ((const GroupDef*)this)->groupTitle())
  1282     if (definitionType()==Definition::TypeGroup && ((const GroupDef*)this)->groupTitle())
  1261     {
  1283     {
  1262       ol.writeObjectLink(getReference(),getOutputFileBase(),0,((const GroupDef*)this)->groupTitle());
  1284       ol.writeObjectLink(getReference(),getOutputFileBase(),0,((const GroupDef*)this)->groupTitle());
  1274   {
  1296   {
  1275     ol.startBold();
  1297     ol.startBold();
  1276     ol.docify(m_impl->localName);
  1298     ol.docify(m_impl->localName);
  1277     ol.endBold();
  1299     ol.endBold();
  1278   }
  1300   }
       
  1301   ol.writeString("      </li>\n");
  1279 }
  1302 }
  1280 
  1303 
  1281 void Definition::writeNavigationPath(OutputList &ol) const
  1304 void Definition::writeNavigationPath(OutputList &ol) const
  1282 {
  1305 {
  1283   ol.pushGeneratorState();
  1306   ol.pushGeneratorState();
  1284   ol.disableAllBut(OutputGenerator::Html);
  1307   ol.disableAllBut(OutputGenerator::Html);
  1285 
  1308 
  1286   ol.writeString("  <div class=\"navpath\">");
  1309   ol.writeString("  <div class=\"navpath\">\n");
       
  1310   ol.writeString("    <ul>\n");
  1287   writePathFragment(ol);
  1311   writePathFragment(ol);
  1288   ol.writeString("\n  </div>\n");
  1312   ol.writeString("    </ul>\n");
       
  1313   ol.writeString("  </div>\n");
  1289 
  1314 
  1290   ol.popGeneratorState();
  1315   ol.popGeneratorState();
  1291 }
  1316 }
  1292 
  1317 
  1293 QCString Definition::symbolName() const 
  1318 QCString Definition::symbolName() const