Ejemplo n.º 1
0
void NamespaceDef::combineUsingRelations()
{
  if (visited) return; // already done
  visited=TRUE;
  if (usingDirList)
  {
    NamespaceSDict::Iterator nli(*usingDirList);
    NamespaceDef *nd;
    for (nli.toFirst();(nd=nli.current());++nli)
    {
      nd->combineUsingRelations();
    }
    for (nli.toFirst();(nd=nli.current());++nli)
    {
      // add used namespaces of namespace nd to this namespace
      if (nd->getUsedNamespaces())
      {
        NamespaceSDict::Iterator unli(*nd->getUsedNamespaces());
        NamespaceDef *und;
        for (unli.toFirst();(und=unli.current());++unli)
        {
          //printf("Adding namespace %s to the using list of %s\n",und->qualifiedName().data(),qualifiedName().data());
          addUsingDirective(und);
        }
      }
      // add used classes of namespace nd to this namespace
      if (nd->getUsedClasses())
      {
        SDict<Definition>::Iterator cli(*nd->getUsedClasses());
        Definition *ucd;
        for (cli.toFirst();(ucd=cli.current());++cli)
        {
          //printf("Adding class %s to the using list of %s\n",cd->qualifiedName().data(),qualifiedName().data());
          addUsingDeclaration(ucd);
        }
      }
    }
  }
}
Ejemplo n.º 2
0
void generateSqlite3()
{
  // + classes
  // + namespaces
  // + files
  // - groups
  // - related pages
  // - examples
  //QCString outputDirectory = Config_getString("SQLITE3_OUTPUT");
  QCString outputDirectory = Config_getString("OUTPUT_DIRECTORY");
  QDir sqlite3Dir(outputDirectory);
  sqlite3 *db;
  sqlite3_initialize();
  int rc = sqlite3_open_v2(outputDirectory+"/doxygen_sqlite3.db", &db, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, 0);
  if (rc != SQLITE_OK) 
  {
    sqlite3_close(db);
    msg("database open failed: %s\n", "doxygen_sqlite3.db");
    exit(-1);
  }
  beginTransaction(db);
  pragmaTuning(db);

  initializeSchema(db);
  if ( -1 == prepareStatements(db) )
  {
    err("sqlite generator: prepareStatements failed!");
    return;
  }

  // + classes
  ClassSDict::Iterator cli(*Doxygen::classSDict);
  ClassDef *cd;
  for (cli.toFirst();(cd=cli.current());++cli)
  {
    msg("Generating Sqlite3 output for class %s\n",cd->name().data());
    generateSqlite3ForClass(db,cd);
  }

  // + namespaces
  NamespaceSDict::Iterator nli(*Doxygen::namespaceSDict);
  NamespaceDef *nd;
  for (nli.toFirst();(nd=nli.current());++nli)
  {
    msg("Generating Sqlite3 output for namespace %s\n",nd->name().data());
    generateSqlite3ForNamespace(db,nd);
  }

  // + files
  FileNameListIterator fnli(*Doxygen::inputNameList);
  FileName *fn;
  for (;(fn=fnli.current());++fnli)
  {
    FileNameIterator fni(*fn);
    FileDef *fd;
    for (;(fd=fni.current());++fni)
    {
      msg("Generating Sqlite3 output for file %s\n",fd->name().data());
      generateSqlite3ForFile(db,fd);
    }
  }
  endTransaction(db);
}
Ejemplo n.º 3
0
void NamespaceSDict::writeDeclaration(OutputList &ol,const char *title,
                                      bool const isConstantGroup,bool localName)
{


    if (count()==0) return; // no namespaces in the list

    if (Config_getBool("OPTIMIZE_OUTPUT_VHDL")) return;


    SDict<NamespaceDef>::Iterator ni(*this);
    NamespaceDef *nd;
    bool found=FALSE;
    for (ni.toFirst(); (nd=ni.current()) && !found; ++ni)
    {
        if (nd->isLinkable())
        {
            SrcLangExt lang = nd->getLanguage();
            if (SrcLangExt_IDL==lang)
            {
                if (isConstantGroup == nd->isConstantGroup())
                {
                    found=TRUE;
                    break;
                }
            }
            else if (!isConstantGroup) // ensure we only get extra section in IDL
            {
                if (nd->isConstantGroup())
                {
                    err("Internal inconsistency: constant group but not IDL?\n");
                }
                found=TRUE;
                break;
            }
        }
    }
    if (!found) return; // no linkable namespaces in the list

    // write list of namespaces
    ol.startMemberHeader("namespaces");
    //bool javaOpt    = Config_getBool("OPTIMIZE_OUTPUT_JAVA");
    //bool fortranOpt = Config_getBool("OPTIMIZE_FOR_FORTRAN");
    ol.parseText(title);
    ol.endMemberHeader();
    ol.startMemberList();
    for (ni.toFirst(); (nd=ni.current()); ++ni)
    {
        if (nd->isLinkable())
        {
            SrcLangExt lang = nd->getLanguage();
            if (lang==SrcLangExt_IDL && (isConstantGroup != nd->isConstantGroup()))
                continue; // will be output in another pass, see layout_default.xml
            ol.startMemberDeclaration();
            ol.startMemberItem(nd->getOutputFileBase(),0);
            QCString ct = nd->compoundTypeString();
            ol.docify(ct);
            ol.docify(" ");
            ol.insertMemberAlign();
            QCString name;
            if (localName)
            {
                name = nd->localName();
            }
            else
            {
                name = nd->displayName();
            }
            ol.writeObjectLink(nd->getReference(),nd->getOutputFileBase(),0,name);
            ol.endMemberItem();
            if (!nd->briefDescription().isEmpty() && Config_getBool("BRIEF_MEMBER_DESC"))
            {
                ol.startMemberDescription(nd->getOutputFileBase());
                ol.generateDoc(nd->briefFile(),nd->briefLine(),nd,0,nd->briefDescription(),FALSE,FALSE,0,TRUE);
                ol.endMemberDescription();
            }
            ol.endMemberDeclaration(0,0);
        }
    }
    ol.endMemberList();
}
Ejemplo n.º 4
0
void NamespaceDef::writeTagFile(FTextStream &tagFile)
{
    tagFile << "  <compound kind=\"namespace\">" << endl;
    tagFile << "    <name>" << convertToXML(name()) << "</name>" << endl;
    tagFile << "    <filename>" << convertToXML(getOutputFileBase()) << Doxygen::htmlFileExtension << "</filename>" << endl;
    QCString idStr = id();
    if (!idStr.isEmpty())
    {
        tagFile << "    <clangid>" << convertToXML(idStr) << "</clangid>" << endl;
    }
    QListIterator<LayoutDocEntry> eli(
        LayoutDocManager::instance().docEntries(LayoutDocManager::Namespace));
    LayoutDocEntry *lde;
    for (eli.toFirst(); (lde=eli.current()); ++eli)
    {
        switch (lde->kind())
        {
        case LayoutDocEntry::NamespaceNestedNamespaces:
        {
            if (namespaceSDict)
            {
                SDict<NamespaceDef>::Iterator ni(*namespaceSDict);
                NamespaceDef *nd;
                for (ni.toFirst(); (nd=ni.current()); ++ni)
                {
                    if (nd->isLinkableInProject())
                    {
                        tagFile << "    <namespace>" << convertToXML(nd->name()) << "</namespace>" << endl;
                    }
                }
            }
        }
        break;
        case LayoutDocEntry::NamespaceClasses:
        {
            if (classSDict)
            {
                SDict<ClassDef>::Iterator ci(*classSDict);
                ClassDef *cd;
                for (ci.toFirst(); (cd=ci.current()); ++ci)
                {
                    if (cd->isLinkableInProject())
                    {
                        tagFile << "    <class kind=\"" << cd->compoundTypeString()
                                << "\">" << convertToXML(cd->name()) << "</class>" << endl;
                    }
                }
            }
        }
        case LayoutDocEntry::MemberDecl:
        {
            LayoutDocEntryMemberDecl *lmd = (LayoutDocEntryMemberDecl*)lde;
            MemberList * ml = getMemberList(lmd->type);
            if (ml)
            {
                ml->writeTagFile(tagFile);
            }
        }
        break;
        case LayoutDocEntry::MemberGroups:
        {
            if (memberGroupSDict)
            {
                MemberGroupSDict::Iterator mgli(*memberGroupSDict);
                MemberGroup *mg;
                for (; (mg=mgli.current()); ++mgli)
                {
                    mg->writeTagFile(tagFile);
                }
            }
        }
        break;
        default:
            break;
        }
    }
    writeDocAnchorsToTagFile(tagFile);
    tagFile << "  </compound>" << endl;
}
Ejemplo n.º 5
0
void GroupDef::writeTagFile(FTextStream &tagFile)
{
  tagFile << "  <compound kind=\"group\">" << endl;
  tagFile << "    <name>" << convertToXML(name()) << "</name>" << endl;
  tagFile << "    <title>" << convertToXML(title) << "</title>" << endl;
  tagFile << "    <filename>" << convertToXML(getOutputFileBase()) << Doxygen::htmlFileExtension << "</filename>" << endl;
  QListIterator<LayoutDocEntry> eli(
      LayoutDocManager::instance().docEntries(LayoutDocManager::Group));
  LayoutDocEntry *lde;
  for (eli.toFirst();(lde=eli.current());++eli)
  {
    switch (lde->kind())
    {
      case LayoutDocEntry::GroupClasses:
        {
          if (classSDict)
          {
            SDict<ClassDef>::Iterator ci(*classSDict);
            ClassDef *cd;
            for (ci.toFirst();(cd=ci.current());++ci)
            {
              if (cd->isLinkableInProject())
              {
                tagFile << "    <class kind=\"" << cd->compoundTypeString()
                        << "\">" << convertToXML(cd->name()) << "</class>" << endl;
              }
            }
          }
        }
        break;
      case LayoutDocEntry::GroupNamespaces:
        {
          if (namespaceSDict)
          {
            SDict<NamespaceDef>::Iterator ni(*namespaceSDict);
            NamespaceDef *nd;
            for (ni.toFirst();(nd=ni.current());++ni)
            {
              if (nd->isLinkableInProject())
              {
                tagFile << "    <namespace>" << convertToXML(nd->name())
                        << "</namespace>" << endl;
              }
            }
          }
        }
        break;
      case LayoutDocEntry::GroupFiles:
        {
          if (fileList)
          {
            QListIterator<FileDef> it(*fileList);
            FileDef *fd;
            for (;(fd=it.current());++it)
            {
              if (fd->isLinkableInProject())
              {
                tagFile << "    <file>" << convertToXML(fd->name()) << "</file>" << endl;
              }
            }
          }
        }
        break;
      case LayoutDocEntry::GroupPageDocs:
        {
          if (pageDict)
          {
            PageSDict::Iterator pdi(*pageDict);
            PageDef *pd=0;
            for (pdi.toFirst();(pd=pdi.current());++pdi)
            {
              QCString pageName = pd->getOutputFileBase();
              if (pd->isLinkableInProject())
              {
                tagFile << "    <page>" << convertToXML(pageName) << "</page>" << endl;
              }
            }
          }
        }
        break;
      case LayoutDocEntry::GroupDirs:
        {
          if (dirList)
          {
            QListIterator<DirDef> it(*dirList);
            DirDef *dd;
            for (;(dd=it.current());++it)
            {
              if (dd->isLinkableInProject())
              {
                tagFile << "    <dir>" << convertToXML(dd->displayName()) << "</dir>" << endl;
              }
            }
          }
        }
        break;
      case LayoutDocEntry::GroupNestedGroups:
        {
          if (groupList)
          {
            QListIterator<GroupDef> it(*groupList);
            GroupDef *gd;
            for (;(gd=it.current());++it)
            {
              if (gd->isVisible())
              {
                tagFile << "    <subgroup>" << convertToXML(gd->name()) << "</subgroup>" << endl;
              }
            }
          }
        }
        break;
      case LayoutDocEntry::MemberDecl:
        {
          LayoutDocEntryMemberDecl *lmd = (LayoutDocEntryMemberDecl*)lde;
          MemberList * ml = getMemberList(lmd->type);
          if (ml)
          {
            ml->writeTagFile(tagFile);
          }
        }
        break;
      case LayoutDocEntry::MemberGroups:
        {
          if (memberGroupSDict)
          {
            MemberGroupSDict::Iterator mgli(*memberGroupSDict);
            MemberGroup *mg;
            for (;(mg=mgli.current());++mgli)
            {
              mg->writeTagFile(tagFile);
            }
          }
        }
        break;
      default:
        break;
    }
  }
  writeDocAnchorsToTagFile(tagFile);
  tagFile << "  </compound>" << endl;
}
Ejemplo n.º 6
0
void NamespaceSDict::writeDeclaration(OutputList &ol,const char *title,bool localName)
{
 

  if (count()==0) return; // no namespaces in the list

  if (Config_getBool("OPTIMIZE_OUTPUT_VHDL")) return;
 

  SDict<NamespaceDef>::Iterator ni(*this);
  NamespaceDef *nd;
  bool found=FALSE;
  for (ni.toFirst();(nd=ni.current()) && !found;++ni)
  {
    if (nd->isLinkable()) found=TRUE;
  }
  if (!found) return; // no linkable namespaces in the list

  // write list of namespaces
  ol.startMemberHeader("namespaces");
  //bool javaOpt    = Config_getBool("OPTIMIZE_OUTPUT_JAVA");
  //bool fortranOpt = Config_getBool("OPTIMIZE_FOR_FORTRAN");
  ol.parseText(title);
  ol.endMemberHeader();
  ol.startMemberList();
  for (ni.toFirst();(nd=ni.current());++ni)
  {
    if (nd->isLinkable())
    {
      SrcLangExt lang = nd->getLanguage();
      ol.startMemberItem(nd->getOutputFileBase(),0);
      if (lang==SrcLangExt_Java || lang==SrcLangExt_CSharp)
      {
        ol.docify("package ");
      }
      else if (lang==SrcLangExt_Fortran)
      {
        ol.docify("module ");
      }
      else
      {
        ol.docify("namespace ");
      }
      ol.insertMemberAlign();
      QCString name;
      if (localName)
      {
        name = nd->localName();
      }
      else
      {
        name = nd->displayName();
      }
      ol.writeObjectLink(nd->getReference(),nd->getOutputFileBase(),0,name);
      if (!Config_getString("GENERATE_TAGFILE").isEmpty() && !nd->isReference()) 
      {
        Doxygen::tagFile << "    <namespace>" << convertToXML(nd->name()) << "</namespace>" << endl;
      }
      ol.endMemberItem();
      if (!nd->briefDescription().isEmpty() && Config_getBool("BRIEF_MEMBER_DESC"))
      {
        ol.startMemberDescription(nd->getOutputFileBase());
        ol.parseDoc(nd->briefFile(),nd->briefLine(),nd,0,nd->briefDescription(),FALSE,FALSE,0,TRUE);
        ol.endMemberDescription();
      }
    }
  }
  ol.endMemberList();
}
Ejemplo n.º 7
0
void generateSqlite3()
{
  // + classes
  // + namespaces
  // + files
  // + groups
  // + related pages
  // + examples
  // + main page

  QCString outputDirectory = Config_getString("OUTPUT_DIRECTORY");
  QDir sqlite3Dir(outputDirectory);
  sqlite3 *db;
  sqlite3_initialize();
  int rc = sqlite3_open_v2(outputDirectory+"/doxygen_sqlite3.db", &db, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, 0);
  if (rc != SQLITE_OK)
  {
    sqlite3_close(db);
    msg("database open failed: %s\n", "doxygen_sqlite3.db");
    return;
  }
  beginTransaction(db);
  pragmaTuning(db);

  if (-1==initializeSchema(db))
    return;

  if ( -1 == prepareStatements(db) )
  {
    err("sqlite generator: prepareStatements failed!");
    return;
  }

  // + classes
  ClassSDict::Iterator cli(*Doxygen::classSDict);
  ClassDef *cd;
  for (cli.toFirst();(cd=cli.current());++cli)
  {
    msg("Generating Sqlite3 output for class %s\n",cd->name().data());
    generateSqlite3ForClass(db,cd);
  }

  // + namespaces
  NamespaceSDict::Iterator nli(*Doxygen::namespaceSDict);
  NamespaceDef *nd;
  for (nli.toFirst();(nd=nli.current());++nli)
  {
    msg("Generating Sqlite3 output for namespace %s\n",nd->name().data());
    generateSqlite3ForNamespace(db,nd);
  }

  // + files
  FileNameListIterator fnli(*Doxygen::inputNameList);
  FileName *fn;
  for (;(fn=fnli.current());++fnli)
  {
    FileNameIterator fni(*fn);
    FileDef *fd;
    for (;(fd=fni.current());++fni)
    {
      msg("Generating Sqlite3 output for file %s\n",fd->name().data());
      generateSqlite3ForFile(db,fd);
    }
  }

  // + groups
  GroupSDict::Iterator gli(*Doxygen::groupSDict);
  GroupDef *gd;
  for (;(gd=gli.current());++gli)
  {
    msg("Generating Sqlite3 output for group %s\n",gd->name().data());
    generateSqlite3ForGroup(db,gd);
  }

  // + page
  {
    PageSDict::Iterator pdi(*Doxygen::pageSDict);
    PageDef *pd=0;
    for (pdi.toFirst();(pd=pdi.current());++pdi)
    {
      msg("Generating Sqlite3 output for page %s\n",pd->name().data());
      generateSqlite3ForPage(db,pd,FALSE);
    }
  }

  // + dirs
  {
    DirDef *dir;
    DirSDict::Iterator sdi(*Doxygen::directories);
    for (sdi.toFirst();(dir=sdi.current());++sdi)
    {
      msg("Generating Sqlite3 output for dir %s\n",dir->name().data());
      generateSqlite3ForDir(db,dir);
    }
  }

  // + examples
  {
    PageSDict::Iterator pdi(*Doxygen::exampleSDict);
    PageDef *pd=0;
    for (pdi.toFirst();(pd=pdi.current());++pdi)
    {
      msg("Generating Sqlite3 output for example %s\n",pd->name().data());
      generateSqlite3ForPage(db,pd,TRUE);
    }
  }

  // + main page
  if (Doxygen::mainPage)
  {
    msg("Generating Sqlite3 output for the main page\n");
    generateSqlite3ForPage(db,Doxygen::mainPage,FALSE);
  }

  endTransaction(db);
}
Ejemplo n.º 8
0
void DocSets::addIndexItem(Definition *context,MemberDef *md,
                           const char *,const char *)
{
  if (md==0 && context==0) return;

  FileDef *fd      = 0;
  ClassDef *cd     = 0;
  NamespaceDef *nd = 0;

  if (md)
  {
    fd = md->getFileDef();
    cd = md->getClassDef();
    nd = md->getNamespaceDef();
    if (!md->isLinkable()) return; // internal symbol
  }

  QCString scope;
  QCString type;
  QCString decl;

  // determine language
  QCString lang;
  SrcLangExt langExt = SrcLangExt_Cpp;
  if (md) 
  {
    langExt = md->getLanguage();
  }
  else if (context) 
  {
    langExt = context->getLanguage();
  }
  switch (langExt)
  {
    case SrcLangExt_Cpp:
    case SrcLangExt_ObjC:
      {
        if (md && (md->isObjCMethod() || md->isObjCProperty()))
          lang="occ";  // Objective C/C++
        else if (fd && fd->name().right(2).lower()==".c") 
          lang="c";    // Plain C
        else if (cd==0 && nd==0)
          lang="c";    // Plain C symbol outside any class or namespace
        else
          lang="cpp";  // C++
      }
      break;
    case SrcLangExt_IDL:     lang="idl"; break;        // IDL
    case SrcLangExt_CSharp:  lang="csharp"; break;     // C#
    case SrcLangExt_PHP:     lang="php"; break;        // PHP4/5
    case SrcLangExt_D:       lang="d"; break;          // D
    case SrcLangExt_Java:    lang="java"; break;       // Java
    case SrcLangExt_JS:      lang="javascript"; break; // Javascript
    case SrcLangExt_Python:  lang="python"; break;     // Python
    case SrcLangExt_Fortran: lang="fortran"; break;    // Fortran
    case SrcLangExt_VHDL:    lang="vhdl"; break;       // VHDL
    case SrcLangExt_XML:     lang="xml"; break;        // DBUS XML
    case SrcLangExt_Tcl:     lang="tcl"; break;        // Tcl
    case SrcLangExt_Markdown:lang="markdown"; break;   // Markdown
    case SrcLangExt_Unknown: lang="unknown"; break;    // should not happen!
  }

  if (md)
  {
    if (context==0)
    {
      if (md->getGroupDef())
        context = md->getGroupDef();
      else if (md->getFileDef())
        context = md->getFileDef();
    }
    if (context==0) return; // should not happen

    switch (md->memberType())
    {
      case MemberType_Define:
        type="macro"; break;
      case MemberType_Function:
        if (cd && (cd->compoundType()==ClassDef::Interface ||
              cd->compoundType()==ClassDef::Class))
        {
          if (md->isStatic())
            type="clm";         // class member
          else
            type="instm";       // instance member
        }
        else if (cd && cd->compoundType()==ClassDef::Protocol)
        {
          if (md->isStatic())
            type="intfcm";     // interface class member
          else
            type="intfm";      // interface member
        }
        else
          type="func";
        break;
      case MemberType_Variable:
        type="data"; break;
      case MemberType_Typedef:
        type="tdef"; break;
      case MemberType_Enumeration:
        type="enum"; break;
      case MemberType_EnumValue:
        type="econst"; break;
        //case MemberDef::Prototype:
        //  type="prototype"; break;
      case MemberType_Signal:
        type="signal"; break;
      case MemberType_Slot:
        type="slot"; break;
      case MemberType_Friend:
        type="ffunc"; break;
      case MemberType_DCOP:
        type="dcop"; break;
      case MemberType_Property:
        if (cd && cd->compoundType()==ClassDef::Protocol) 
          type="intfp";         // interface property
        else 
          type="instp";         // instance property
        break;
      case MemberType_Event:
        type="event"; break;
      case MemberType_Interface:
        type="ifc"; break;
      case MemberType_Service:
        type="svc"; break;
    }
    cd = md->getClassDef();
    nd = md->getNamespaceDef();
    if (cd) 
    {
      scope = cd->qualifiedName();
    }
    else if (nd)
    {
      scope = nd->name();
    }
    MemberDef *declMd = md->memberDeclaration();
    if (declMd==0) declMd = md;
    {
      fd = md->getFileDef();
      if (fd)
      {
        decl = fd->name();
      }
    }
    writeToken(m_tts,md,type,lang,scope,md->anchor(),decl);
  }
  else if (context && context->isLinkable())
  {
    if (fd==0 && context->definitionType()==Definition::TypeFile)
    {
      fd = (FileDef*)context;
    }
    if (cd==0 && context->definitionType()==Definition::TypeClass)
    {
      cd = (ClassDef*)context;
    }
    if (nd==0 && context->definitionType()==Definition::TypeNamespace)
    {
      nd = (NamespaceDef*)context;
    }
    if (fd)
    {
      type="file";
    }
    else if (cd) 
    {
      scope = cd->qualifiedName();
      if (cd->isTemplate())
      {
        type="tmplt";
      }
      else if (cd->compoundType()==ClassDef::Protocol) 
      {
        type="intf";
        if (scope.right(2)=="-p") scope=scope.left(scope.length()-2);
      }
      else if (cd->compoundType()==ClassDef::Interface)
      {
        type="cl";
      }
      else if (cd->compoundType()==ClassDef::Category)
      {
        type="cat";
      }
      else 
      {
        type = "cl";
      }
      IncludeInfo *ii = cd->includeInfo();
      if (ii)
      {
        decl=ii->includeName;
      }
    }
    else if (nd)
    {
      scope = nd->name();
      type = "ns";
    }
    if (m_scopes.find(context->getOutputFileBase())==0)
    {
      writeToken(m_tts,context,type,lang,scope,0,decl);
      m_scopes.append(context->getOutputFileBase(),(void*)0x8);
    }
  }
}
void NamespaceSDict::writeDeclaration(OutputList &ol,bool localName)
{
  if (count()==0) return; // no namespaces in the list

  SDict<NamespaceDef>::Iterator ni(*this);
  NamespaceDef *nd;
  bool found=FALSE;
  for (ni.toFirst();(nd=ni.current()) && !found;++ni)
  {
    if (nd->isLinkable()) found=TRUE;
  }
  if (!found) return; // no linkable namespaces in the list

  // write list of namespaces
  ol.startMemberHeader();
  bool javaOpt = Config_getBool("OPTIMIZE_OUTPUT_JAVA");
  if (javaOpt)
  {
    ol.parseText(theTranslator->trPackages());
  }
  else
  {
    ol.parseText(theTranslator->trNamespaces());
  }
  ol.endMemberHeader();
  ol.startMemberList();
  for (ni.toFirst();(nd=ni.current());++ni)
  {
    if (nd->isLinkable())
    {
      ol.startMemberItem(0);
      if (javaOpt)
      {
        ol.docify("package ");
      }
      else
      {
        ol.docify("namespace ");
      }
      ol.insertMemberAlign();
      QCString name;
      if (localName)
      {
        name = nd->localName();
      }
      else
      {
        name = nd->displayName();
      }
      ol.writeObjectLink(nd->getReference(),nd->getOutputFileBase(),0,name);
      if (!Config_getString("GENERATE_TAGFILE").isEmpty()) 
      {
        Doxygen::tagFile << "    <namespace>" << convertToXML(nd->name()) << "</namespace>" << endl;
      }
      ol.endMemberItem();
      if (!nd->briefDescription().isEmpty() && Config_getBool("BRIEF_MEMBER_DESC"))
      {
        ol.startMemberDescription();
        ol.parseDoc(nd->briefFile(),nd->briefLine(),nd,0,nd->briefDescription(),FALSE,FALSE);
        ol.endMemberDescription();
        ol.newParagraph();
      }
    }
  }
  ol.endMemberList();
}
Ejemplo n.º 10
0
void FileDef::addIncludedUsingDirectives()
{
  if (visited) return;
  visited=TRUE;
  //printf("( FileDef::addIncludedUsingDirectives for file %s\n",name().data());

  NamespaceList nl;
  if (includeList) // file contains #includes
  {
    {
      QListIterator<IncludeInfo> iii(*includeList);
      IncludeInfo *ii;
      for (iii.toFirst();(ii=iii.current());++iii) // foreach #include...
      {
        if (ii->fileDef && !ii->fileDef->visited) // ...that is a known file
        {
          // recurse into this file
          ii->fileDef->addIncludedUsingDirectives();
        }
      }
    }
    {
      QListIterator<IncludeInfo> iii(*includeList);
      IncludeInfo *ii;
      // iterate through list from last to first
      for (iii.toLast();(ii=iii.current());--iii)
      {
        if (ii->fileDef && ii->fileDef!=this)
        {
          // add using directives
          NamespaceSDict *unl = ii->fileDef->usingDirList;
          if (unl)
          {
            NamespaceSDict::Iterator nli(*unl);
            NamespaceDef *nd;
            for (nli.toLast();(nd=nli.current());--nli)
            {
              // append each using directive found in a #include file
              if (usingDirList==0) usingDirList = new NamespaceSDict;
              //printf("Prepending used namespace %s to the list of file %s\n",
              //    nd->name().data(),name().data());
              if (usingDirList->find(nd->qualifiedName())==0) // not yet added
              {
                usingDirList->prepend(nd->qualifiedName(),nd);
              }
            }
          }
          // add using declarations
          SDict<Definition> *udl = ii->fileDef->usingDeclList;
          if (udl)
          {
            SDict<Definition>::Iterator udi(*udl);
            Definition *d;
            for (udi.toLast();(d=udi.current());--udi)
            {
              //printf("Adding using declaration %s\n",d->name().data());
              if (usingDeclList==0)
              {
                usingDeclList = new SDict<Definition>(17);
              }
              if (usingDeclList->find(d->qualifiedName())==0)
              {
                usingDeclList->prepend(d->qualifiedName(),d);
              }
            }
          }
        }
      }
    }
  }
  //printf(") end FileDef::addIncludedUsingDirectives for file %s\n",name().data());
}
Ejemplo n.º 11
0
void DocSets::addIndexItem(const char *, const char *, 
                           const char *, const char *,
                           const char *,const MemberDef *md)
{
  if (!md->isLinkable()) return; // internal symbol

  ClassDef *cd     = md->getClassDef();
  NamespaceDef *nd = md->getNamespaceDef();
  FileDef  *fd     = md->getFileDef();

  // determine language
  QCString lang;
  SrcLangExt langExt = SrcLangExt_Cpp;
  if (fd) langExt = getLanguageFromFileName(fd->name());
  switch (langExt)
  {
    case SrcLangExt_Cpp:
      {
        if (md->isObjCMethod())                        
          lang="occ";  // Objective C/C++
        else if (fd && fd->name().right(2).lower()==".c") 
          lang="c";    // Plain C
        else                                      
          lang="cpp";  // C++
      }
      break;
    case SrcLangExt_ObjC:   lang="occ"; break;        // Objective C++
    case SrcLangExt_IDL:    lang="idl"; break;        // IDL
    case SrcLangExt_CSharp: lang="csharp"; break;     // C#
    case SrcLangExt_PHP:    lang="php"; break;        // PHP4/5
    case SrcLangExt_D:      lang="d"; break;          // D
    case SrcLangExt_Java:   lang="java"; break;       // Java
    case SrcLangExt_JS:     lang="javascript"; break; // Javascript
    case SrcLangExt_Python: lang="python"; break;     // Python
    case SrcLangExt_F90:    lang="fortran"; break;    // Fortran
    case SrcLangExt_VHDL:   lang="vhdl"; break;       // VHDL
  }

  // determine scope
  QCString scope;
  QCString type;
  QCString decl;
  Definition *d = 0;
  if (fd && fd->isLinkable() && m_scopes.find(fd->getOutputFileBase())==0)
  {
    writeToken(m_tts,fd,"file",lang,0,0,0);
    m_scopes.append(fd->getOutputFileBase(),(void*)0x8);
  }
  if (cd) 
  {
    scope = cd->qualifiedName();
    if (cd->isTemplate()) 
      type="tmplt";
    else if (cd->compoundType()==ClassDef::Protocol) 
      type="intf";
    else if (cd->compoundType()==ClassDef::Interface) 
      type="cl";
    else if (cd->compoundType()==ClassDef::Category)
      type="cat";
    else 
      type = "cl";
    d = cd;
    IncludeInfo *ii = cd->includeInfo();
    if (ii)
    {
      decl=ii->includeName;
      if (decl.isEmpty())
      {
        decl=ii->local;
      }
    }
  }
  else if (nd) 
  {
    scope = nd->name();
    type = "ns";
    d = cd;
  }
  if (d && d->isLinkable() && m_scopes.find(d->getOutputFileBase())==0)
  {
    writeToken(m_tts,d,type,lang,0,0,decl);
    m_scopes.append(d->getOutputFileBase(),(void*)0x8);
  }

  switch (md->memberType())
  {
    case MemberDef::Define:
      type="macro"; break;
    case MemberDef::Function:
      if (cd && cd->compoundType()==ClassDef::Interface) 
        type="intfm";
      else if (cd && cd->compoundType()==ClassDef::Class) 
        type="clm"; 
      else 
        type="func"; 
      break;
    case MemberDef::Variable:
      type="data"; break;
    case MemberDef::Typedef:
      type="tdef"; break;
    case MemberDef::Enumeration:
      type="enum"; break;
    case MemberDef::EnumValue:
      type="econst"; break;
    //case MemberDef::Prototype:
    //  type="prototype"; break;
    case MemberDef::Signal:
      type="signal"; break;
    case MemberDef::Slot:
      type="slot"; break;
    case MemberDef::Friend:
      type="ffunc"; break;
    case MemberDef::DCOP:
      type="dcop"; break;
    case MemberDef::Property:
      type="property"; break;
    case MemberDef::Event:
      type="event"; break;
  }
  writeToken(m_tts,md,type,lang,scope,md->anchor());
}