tools/qdoc3/node.h
changeset 30 5dc02b23752f
parent 18 2f34d5167611
child 33 3e2da88830cd
equal deleted inserted replaced
29:b72c6db6890b 30:5dc02b23752f
    94         Module,
    94         Module,
    95         Page,
    95         Page,
    96 #ifdef QDOC_QML
    96 #ifdef QDOC_QML
    97         ExternalPage,
    97         ExternalPage,
    98         QmlClass,
    98         QmlClass,
    99         QmlPropertyGroup
    99         QmlPropertyGroup,
       
   100         QmlBasicType
   100 #else
   101 #else
   101         ExternalPage
   102         ExternalPage
   102 #endif
   103 #endif
   103     };
   104     };
   104     
   105     
   134         SectionLink, 
   135         SectionLink, 
   135         SubsectionLink, 
   136         SubsectionLink, 
   136         AppendixLink */ 
   137         AppendixLink */ 
   137     };
   138     };
   138 
   139 
       
   140     enum PageType {
       
   141         NoPageType,
       
   142         ApiPage,
       
   143         ArticlePage,
       
   144         ExamplePage
       
   145     };
       
   146 
   139     virtual ~Node();
   147     virtual ~Node();
   140 
   148 
   141     void setAccess(Access access) { acc = access; }
   149     void setAccess(Access access) { acc = access; }
   142     void setLocation(const Location& location) { loc = location; }
   150     void setLocation(const Location& location) { loc = location; }
   143     void setDoc(const Doc& doc, bool replace = false);
   151     void setDoc(const Doc& doc, bool replace = false);
   147     void setRelates(InnerNode *pseudoParent);
   155     void setRelates(InnerNode *pseudoParent);
   148     void setModuleName(const QString &module) { mod = module; }
   156     void setModuleName(const QString &module) { mod = module; }
   149     void setLink(LinkType linkType, const QString &link, const QString &desc);
   157     void setLink(LinkType linkType, const QString &link, const QString &desc);
   150     void setUrl(const QString &url);
   158     void setUrl(const QString &url);
   151     void setTemplateStuff(const QString &templateStuff) { tpl = templateStuff; }
   159     void setTemplateStuff(const QString &templateStuff) { tpl = templateStuff; }
       
   160     void setPageType(PageType t) { pageTyp = t; }
       
   161     void setPageType(const QString& t);
   152 
   162 
   153     virtual bool isInnerNode() const = 0;
   163     virtual bool isInnerNode() const = 0;
   154     virtual bool isReimp() const { return false; }
   164     virtual bool isReimp() const { return false; }
   155     virtual bool isFunction() const { return false; }
   165     virtual bool isFunction() const { return false; }
       
   166     virtual bool isQmlNode() const { return false; }
   156     Type type() const { return typ; }
   167     Type type() const { return typ; }
   157     virtual SubType subType() const { return NoSubType; }
   168     virtual SubType subType() const { return NoSubType; }
   158     InnerNode *parent() const { return par; }
   169     InnerNode *parent() const { return par; }
   159     InnerNode *relates() const { return rel; }
   170     InnerNode *relates() const { return rel; }
   160     const QString& name() const { return nam; }
   171     const QString& name() const { return nam; }
   170     Status inheritedStatus() const;
   181     Status inheritedStatus() const;
   171     ThreadSafeness threadSafeness() const;
   182     ThreadSafeness threadSafeness() const;
   172     ThreadSafeness inheritedThreadSafeness() const;
   183     ThreadSafeness inheritedThreadSafeness() const;
   173     QString since() const { return sinc; }
   184     QString since() const { return sinc; }
   174     QString templateStuff() const { return tpl; }
   185     QString templateStuff() const { return tpl; }
       
   186     PageType pageType() const { return pageTyp; }
       
   187     virtual void addPageKeywords(const QString& ) { }
   175 
   188 
   176     void clearRelated() { rel = 0; }
   189     void clearRelated() { rel = 0; }
   177 
   190 
   178     virtual QString fileBase() const;
   191     virtual QString fileBase() const;
   179 
   192 
   183  private:
   196  private:
   184 
   197 
   185 #ifdef Q_WS_WIN
   198 #ifdef Q_WS_WIN
   186     Type typ;
   199     Type typ;
   187     Access acc;
   200     Access acc;
       
   201     ThreadSafeness saf;
       
   202     PageType pageTyp;
   188     Status sta;
   203     Status sta;
   189     ThreadSafeness saf;
       
   190 #else
   204 #else
   191     Type typ : 4;
   205     Type typ : 4;
   192     Access acc : 2;
   206     Access acc : 2;
       
   207     ThreadSafeness saf : 2;
       
   208     PageType pageTyp : 4;
   193     Status sta : 3;
   209     Status sta : 3;
   194     ThreadSafeness saf : 2;
       
   195 #endif
   210 #endif
   196     InnerNode *par;
   211     InnerNode *par;
   197     InnerNode *rel;
   212     InnerNode *rel;
   198     QString nam;
   213     QString nam;
   199     Location loc;
   214     Location loc;
   241     NodeList overloads(const QString &funcName) const;
   256     NodeList overloads(const QString &funcName) const;
   242     const QStringList& includes() const { return inc; }
   257     const QStringList& includes() const { return inc; }
   243 
   258 
   244     QStringList primaryKeys();
   259     QStringList primaryKeys();
   245     QStringList secondaryKeys();
   260     QStringList secondaryKeys();
       
   261     const QStringList& pageKeywords() const { return pageKeywds; }
       
   262     virtual void addPageKeywords(const QString& t) { pageKeywds << t; }
   246 
   263 
   247  protected:
   264  protected:
   248     InnerNode(Type type, InnerNode *parent, const QString& name);
   265     InnerNode(Type type, InnerNode *parent, const QString& name);
   249 
   266 
   250  private:
   267  private:
   253     static bool isSameSignature(const FunctionNode *f1, const FunctionNode *f2);
   270     static bool isSameSignature(const FunctionNode *f1, const FunctionNode *f2);
   254     void addChild(Node *child);
   271     void addChild(Node *child);
   255     void removeChild(Node *child);
   272     void removeChild(Node *child);
   256     void removeRelated(Node *pseudoChild);
   273     void removeRelated(Node *pseudoChild);
   257 
   274 
       
   275     QStringList pageKeywds;
   258     QStringList inc;
   276     QStringList inc;
   259     NodeList children;
   277     NodeList children;
   260     NodeList enumChildren;
   278     NodeList enumChildren;
   261     NodeList related;
   279     NodeList related;
   262     QMap<QString, Node *> childMap;
   280     QMap<QString, Node *> childMap;
   360 {
   378 {
   361  public:
   379  public:
   362     QmlClassNode(InnerNode *parent, 
   380     QmlClassNode(InnerNode *parent, 
   363                  const QString& name, 
   381                  const QString& name, 
   364                  const ClassNode* cn);
   382                  const ClassNode* cn);
   365     virtual ~QmlClassNode() { }
   383     virtual ~QmlClassNode();
       
   384     virtual bool isQmlNode() const { return true; }
   366 
   385 
   367     const ClassNode* classNode() const { return cnode; }
   386     const ClassNode* classNode() const { return cnode; }
   368     virtual QString fileBase() const;
   387     virtual QString fileBase() const;
   369 
   388     static void addInheritedBy(const QString& base, Node* sub);
       
   389     static void subclasses(const QString& base, NodeList& subs);
       
   390     static void clear();
       
   391 
       
   392  public:
   370     static bool qmlOnly;
   393     static bool qmlOnly;
   371 
   394     static QMultiMap<QString,Node*> inheritedBy;
   372  private:
   395 
   373     const ClassNode* cnode;
   396  private:
       
   397     const ClassNode*    cnode;
       
   398 };
       
   399 
       
   400 class QmlBasicTypeNode : public FakeNode
       
   401 {
       
   402  public:
       
   403     QmlBasicTypeNode(InnerNode *parent, 
       
   404                      const QString& name);
       
   405     virtual ~QmlBasicTypeNode() { }
       
   406     virtual bool isQmlNode() const { return true; }
   374 };
   407 };
   375 
   408 
   376 class QmlPropGroupNode : public FakeNode
   409 class QmlPropGroupNode : public FakeNode
   377 {
   410 {
   378  public:
   411  public:
   379     QmlPropGroupNode(QmlClassNode* parent, 
   412     QmlPropGroupNode(QmlClassNode* parent, 
   380                      const QString& name,
   413                      const QString& name,
   381                      bool attached);
   414                      bool attached);
   382     virtual ~QmlPropGroupNode() { }
   415     virtual ~QmlPropGroupNode() { }
       
   416     virtual bool isQmlNode() const { return true; }
   383 
   417 
   384     const QString& element() const { return parent()->name(); }
   418     const QString& element() const { return parent()->name(); }
   385     void setDefault() { isdefault = true; }
   419     void setDefault() { isdefault = true; }
   386     bool isDefault() const { return isdefault; }
   420     bool isDefault() const { return isdefault; }
   387     bool isAttached() const { return att; }
   421     bool isAttached() const { return att; }
   409     QString qualifiedDataType() const { return dt; }
   443     QString qualifiedDataType() const { return dt; }
   410     bool isStored() const { return fromTrool(sto,true); }
   444     bool isStored() const { return fromTrool(sto,true); }
   411     bool isDesignable() const { return fromTrool(des,false); }
   445     bool isDesignable() const { return fromTrool(des,false); }
   412     bool isWritable() const { return fromTrool(wri,true); }
   446     bool isWritable() const { return fromTrool(wri,true); }
   413     bool isAttached() const { return att; }
   447     bool isAttached() const { return att; }
       
   448     virtual bool isQmlNode() const { return true; }
   414 
   449 
   415     const QString& element() const { return static_cast<QmlPropGroupNode*>(parent())->element(); }
   450     const QString& element() const { return static_cast<QmlPropGroupNode*>(parent())->element(); }
   416 
   451 
   417  private:
   452  private:
   418     enum Trool { Trool_True, Trool_False, Trool_Default };
   453     enum Trool { Trool_True, Trool_False, Trool_Default };
   577 
   612 
   578     QStringList reconstructParams(bool values = false) const;
   613     QStringList reconstructParams(bool values = false) const;
   579     QString signature(bool values = false) const;
   614     QString signature(bool values = false) const;
   580     const QString& element() const { return parent()->name(); }
   615     const QString& element() const { return parent()->name(); }
   581     bool isAttached() const { return att; }
   616     bool isAttached() const { return att; }
       
   617     virtual bool isQmlNode() const { 
       
   618         return ((type() == QmlSignal) || (type() == QmlMethod)); 
       
   619     }
   582 
   620 
   583     void debug() const;
   621     void debug() const;
   584 
   622 
   585  private:
   623  private:
   586     void setAssociatedProperty(PropertyNode *property);
   624     void setAssociatedProperty(PropertyNode *property);