当前位置: 首页>>代码示例>>C++>>正文


C++ SortedList::inSort方法代码示例

本文整理汇总了C++中SortedList::inSort方法的典型用法代码示例。如果您正苦于以下问题:C++ SortedList::inSort方法的具体用法?C++ SortedList::inSort怎么用?C++ SortedList::inSort使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SortedList的用法示例。


在下文中一共展示了SortedList::inSort方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: generateJSNavTree

static void generateJSNavTree(QList<FTVNode *> &nodeList)
{
   QString htmlOutput = Config::getString("html-output");

   // new JS  
   QFile f(htmlOutput + "/navtreedata.js");
   SortedList<NavIndexEntry *> navIndex;

   if (f.open(QIODevice::WriteOnly)) {
   
      QTextStream t(&f);
      t << "var NAVTREE =" << endl;
      t << "[" << endl;
      t << "  [ ";

      QString projName = Config::getString("project-name");

      if (projName.isEmpty()) {
         if (Doxy_Globals::mainPage && ! Doxy_Globals::mainPage->title().isEmpty()) { 
            // use title of main page as root
            t << "\"" << convertToJSString(Doxy_Globals::mainPage->title()) << "\", ";

         } else { 
            // use default section title as root
            LayoutNavEntry *lne = LayoutDocManager::instance().rootNavEntry()->find(LayoutNavEntry::MainPage);
            t << "\"" << convertToJSString(lne->title()) << "\", ";
         }

      } else { 
         // use PROJECT_NAME as root tree element
         t << "\"" << convertToJSString(projName) << "\", ";
      }

      t << "\"index" << Doxy_Globals::htmlFileExtension << "\", ";

      // add special entry for index page
      navIndex.inSort(new NavIndexEntry("index" + Doxy_Globals::htmlFileExtension, ""));

      // related page index, written as a child of index.html
      navIndex.inSort(new NavIndexEntry("pages" + Doxy_Globals::htmlFileExtension, ""));

      // adjust for display output     
      reSortNodes(nodeList);

      bool omitComma = true;
      generateJSTree(navIndex, t, nodeList, 1, omitComma);

      if (omitComma) {
         t << "]" << endl;
      } else {
         t << endl << "  ] ]" << endl;
      }

      t << "];" << endl << endl;
 
      int subIndex  = 0;
      int elemCount = 0;
      const int maxElemCount = 250;

      // new JS     
      QFile fsidx(htmlOutput + "/navtreeindex0.js");

      if (fsidx.open(QIODevice::WriteOnly)) {
         
         QTextStream tsidx(&fsidx);

         t << "var NAVTREEINDEX =" << endl;
         t << "[" << endl;

         tsidx << "var NAVTREEINDEX" << subIndex << " =" << endl;
         tsidx << "{" << endl;

         omitComma = true;     

         auto nextItem  = navIndex.begin();

         for (auto e : navIndex)  {
            // for each entry
            ++nextItem;

            if (elemCount == 0) {
               if (! omitComma) {
                  t << "," << endl;

               } else {
                  omitComma = false;
               }

               t << "\"" << e->m_url << "\"";
            }

            tsidx << "\"" << e->m_url << "\":[" << e->m_indexId << "]";
            
            if (nextItem != navIndex.end() && elemCount < maxElemCount - 1) {
               // not the last entry
               tsidx << ",";   
            }

            tsidx << endl;

//.........这里部分代码省略.........
开发者ID:klemens-morgenstern,项目名称:doxypress,代码行数:101,代码来源:ftvhelp.cpp

示例2: generateJSTree

static bool generateJSTree(SortedList<NavIndexEntry *> &navIndex, QTextStream &t, const QList<FTVNode *> &nl, int level, bool &omitComma)
{
   static QString htmlOutput   = Config::getString("html-output");   
   static QString mainPageName = Config::getFullName(Config::getString("main-page-name")); 
   static bool mainPageOmit    = Config::getBool("main-page-omit"); 

   QString indentStr;
   indentStr.fill(' ', level * 2);

   bool found = false;

   for (auto node : nl)  {
      // terminate previous entry

      if (! omitComma) {
         t << "," << endl;
      }
      omitComma = false;

      // start entry
      if (! found) {
         t << "[" << endl;
      }
      found = true;

      if (node->addToNavIndex) { 
         // add entry to the navigation index

         if (node->def && node->def->definitionType() == Definition::TypeFile) {            
            QSharedPointer<FileDef> fd = node->def.dynamicCast<FileDef>();
  
            if (! mainPageName.isEmpty() && fd->getFilePath() == mainPageName) {       
               // do not add this file to the navIndex, for \files

            } else {  
                                   
               if (docFileVisibleInIndex(fd)) {
                  navIndex.inSort(new NavIndexEntry(node2URL(node, true, false), pathToNode(node)));
               }
   
               if (srcFileVisibleInIndex(fd)) {
                  navIndex.inSort(new NavIndexEntry(node2URL(node, true, true), pathToNode(node)));
               }
            }

         } else { 
                
            if (mainPageOmit && node->def == Doxy_Globals::mainPage) { 
               // do not add this file to the navIndex 
             
            } else {
               navIndex.inSort(new NavIndexEntry(node2URL(node), pathToNode(node)));
            }
         }
      }

      if (node->separateIndex) { 
         // store some items in a separate file (annotated, modules, namespaces, files)
         bool firstChild   = true;
         bool showMainPage = true;

         if (node->def && node->def->definitionType() == Definition::TypeFile) {            
            QSharedPointer<FileDef> fd = node->def.dynamicCast<FileDef>();

            if (! mainPageName.isEmpty() && fd->getFilePath() == mainPageName) {   
               // do not add this file to the navIndex, for \files

               showMainPage = false;
               omitComma    = true;
            }

         } else { 
                
            if (mainPageOmit && node->def == Doxy_Globals::mainPage) { 
               // do not add this file to the navIndex 

               showMainPage = false;
               omitComma    = true;
            }
         }

         if (showMainPage) {         
            t << indentStr << "  [ ";
            generateJSLink(t, node);
   
            if (node->children.count() > 0) { 
               // write children to separate file for dynamic loading
               QString fileId = node->file;
   
               if (! node->anchor.isEmpty()) {
                  fileId += "_" + node->anchor;
               }
   
               if (dupOfParent(node)) {
                  fileId += "_dup";
               }
   
               QFile fi(htmlOutput + "/" + fileId + ".js");
   
               if (fi.open(QIODevice::WriteOnly)) {
//.........这里部分代码省略.........
开发者ID:klemens-morgenstern,项目名称:doxypress,代码行数:101,代码来源:ftvhelp.cpp


注:本文中的SortedList::inSort方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。