tools/qdoc3/codeparser.cpp
branchGCC_SURGE
changeset 31 5daf16870df6
parent 30 5dc02b23752f
equal deleted inserted replaced
27:93b982ccede2 31:5daf16870df6
    41 
    41 
    42 /*
    42 /*
    43   codeparser.cpp
    43   codeparser.cpp
    44 */
    44 */
    45 
    45 
    46 #include <QtCore>
       
    47 #include "codeparser.h"
    46 #include "codeparser.h"
    48 #include "node.h"
    47 #include "node.h"
    49 #include "tree.h"
    48 #include "tree.h"
    50 #include "config.h"
    49 #include "config.h"
       
    50 #include <QDebug>
    51 
    51 
    52 QT_BEGIN_NAMESPACE
    52 QT_BEGIN_NAMESPACE
    53 
    53 
    54 #define COMMAND_COMPAT                  Doc::alias(QLatin1String("compat"))
    54 #define COMMAND_COMPAT                  Doc::alias(QLatin1String("compat"))
    55 #define COMMAND_DEPRECATED              Doc::alias(QLatin1String("deprecated")) // ### don't document
    55 #define COMMAND_DEPRECATED              Doc::alias(QLatin1String("deprecated")) // ### don't document
    57 #define COMMAND_INMODULE                Doc::alias(QLatin1String("inmodule"))  // ### don't document
    57 #define COMMAND_INMODULE                Doc::alias(QLatin1String("inmodule"))  // ### don't document
    58 #define COMMAND_INTERNAL                Doc::alias(QLatin1String("internal"))
    58 #define COMMAND_INTERNAL                Doc::alias(QLatin1String("internal"))
    59 #define COMMAND_MAINCLASS               Doc::alias(QLatin1String("mainclass"))
    59 #define COMMAND_MAINCLASS               Doc::alias(QLatin1String("mainclass"))
    60 #define COMMAND_NONREENTRANT            Doc::alias(QLatin1String("nonreentrant"))
    60 #define COMMAND_NONREENTRANT            Doc::alias(QLatin1String("nonreentrant"))
    61 #define COMMAND_OBSOLETE                Doc::alias(QLatin1String("obsolete"))
    61 #define COMMAND_OBSOLETE                Doc::alias(QLatin1String("obsolete"))
       
    62 #define COMMAND_PAGEKEYWORDS            Doc::alias(QLatin1String("pagekeywords"))
    62 #define COMMAND_PRELIMINARY             Doc::alias(QLatin1String("preliminary"))
    63 #define COMMAND_PRELIMINARY             Doc::alias(QLatin1String("preliminary"))
    63 #define COMMAND_INPUBLICGROUP           Doc::alias(QLatin1String("inpublicgroup"))
    64 #define COMMAND_INPUBLICGROUP           Doc::alias(QLatin1String("inpublicgroup"))
    64 #define COMMAND_REENTRANT               Doc::alias(QLatin1String("reentrant"))
    65 #define COMMAND_REENTRANT               Doc::alias(QLatin1String("reentrant"))
    65 #define COMMAND_SINCE                   Doc::alias(QLatin1String("since"))
    66 #define COMMAND_SINCE                   Doc::alias(QLatin1String("since"))
    66 #define COMMAND_SUBTITLE                Doc::alias(QLatin1String("subtitle"))
    67 #define COMMAND_SUBTITLE                Doc::alias(QLatin1String("subtitle"))
    67 #define COMMAND_THREADSAFE              Doc::alias(QLatin1String("threadsafe"))
    68 #define COMMAND_THREADSAFE              Doc::alias(QLatin1String("threadsafe"))
    68 #define COMMAND_TITLE                   Doc::alias(QLatin1String("title"))
    69 #define COMMAND_TITLE                   Doc::alias(QLatin1String("title"))
    69 
    70 
    70 QList<CodeParser *> CodeParser::parsers;
    71 QList<CodeParser *> CodeParser::parsers;
    71 bool CodeParser::showInternal = false;
    72 bool CodeParser::showInternal = false;
       
    73 QMap<QString,QString> CodeParser::nameToTitle;
    72 
    74 
    73 /*!
    75 /*!
    74   The constructor adds this code parser to the static
    76   The constructor adds this code parser to the static
    75   list of code parsers.
    77   list of code parsers.
    76  */
    78  */
   168                            << COMMAND_INMODULE
   170                            << COMMAND_INMODULE
   169                            << COMMAND_INTERNAL
   171                            << COMMAND_INTERNAL
   170                            << COMMAND_MAINCLASS
   172                            << COMMAND_MAINCLASS
   171                            << COMMAND_NONREENTRANT
   173                            << COMMAND_NONREENTRANT
   172                            << COMMAND_OBSOLETE
   174                            << COMMAND_OBSOLETE
       
   175                            << COMMAND_PAGEKEYWORDS
   173                            << COMMAND_PRELIMINARY
   176                            << COMMAND_PRELIMINARY
   174                            << COMMAND_INPUBLICGROUP
   177                            << COMMAND_INPUBLICGROUP
   175                            << COMMAND_REENTRANT
   178                            << COMMAND_REENTRANT
   176                            << COMMAND_SINCE
   179                            << COMMAND_SINCE
   177                            << COMMAND_SUBTITLE
   180                            << COMMAND_SUBTITLE
   228 	node->setThreadSafeness(Node::Reentrant);
   231 	node->setThreadSafeness(Node::Reentrant);
   229     }
   232     }
   230     else if (command == COMMAND_SINCE) {
   233     else if (command == COMMAND_SINCE) {
   231         node->setSince(arg);
   234         node->setSince(arg);
   232     }
   235     }
       
   236     else if (command == COMMAND_PAGEKEYWORDS) {
       
   237         node->addPageKeywords(arg);
       
   238     }
   233     else if (command == COMMAND_SUBTITLE) {
   239     else if (command == COMMAND_SUBTITLE) {
   234 	if (node->type() == Node::Fake) {
   240 	if (node->type() == Node::Fake) {
   235 	    FakeNode *fake = static_cast<FakeNode *>(node);
   241 	    FakeNode *fake = static_cast<FakeNode *>(node);
   236             fake->setSubTitle(arg);
   242             fake->setSubTitle(arg);
   237         }
   243         }
   243     }
   249     }
   244     else if (command == COMMAND_TITLE) {
   250     else if (command == COMMAND_TITLE) {
   245 	if (node->type() == Node::Fake) {
   251 	if (node->type() == Node::Fake) {
   246 	    FakeNode *fake = static_cast<FakeNode *>(node);
   252 	    FakeNode *fake = static_cast<FakeNode *>(node);
   247             fake->setTitle(arg);
   253             fake->setTitle(arg);
       
   254             nameToTitle.insert(fake->name(),arg);
   248         }
   255         }
   249         else
   256         else
   250 	    location.warning(tr("Ignored '\\%1'").arg(COMMAND_TITLE));
   257 	    location.warning(tr("Ignored '\\%1'").arg(COMMAND_TITLE));
   251     }
   258     }
   252 }
   259 }
   253 
   260 
       
   261 /*!
       
   262   Find the page title given the page \a name and return it.
       
   263  */
       
   264 const QString CodeParser::titleFromName(const QString& name)
       
   265 {
       
   266     const QString t = nameToTitle.value(name);
       
   267     return t;
       
   268 }
       
   269 
   254 QT_END_NAMESPACE
   270 QT_END_NAMESPACE