1 /****************************************************************************
3 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/
6 ** This file is part of the tools applications of the Qt Toolkit.
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** GNU Lesser General Public License Usage
10 ** This file may be used under the terms of the GNU Lesser General Public
11 ** License version 2.1 as published by the Free Software Foundation and
12 ** appearing in the file LICENSE.LGPL included in the packaging of this
13 ** file. Please review the following information to ensure the GNU Lesser
14 ** General Public License version 2.1 requirements will be met:
15 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
17 ** In addition, as a special exception, Nokia gives you certain additional
18 ** rights. These rights are described in the Nokia Qt LGPL Exception
19 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
21 ** GNU General Public License Usage
22 ** Alternatively, this file may be used under the terms of the GNU General
23 ** Public License version 3.0 as published by the Free Software Foundation
24 ** and appearing in the file LICENSE.GPL included in the packaging of this
25 ** file. Please review the following information to ensure the GNU General
26 ** Public License version 3.0 requirements will be met:
27 ** http://www.gnu.org/copyleft/gpl.html.
30 ** Alternatively, this file may be used in accordance with the terms and
31 ** conditions contained in a signed written agreement between you and Nokia.
40 ****************************************************************************/
52 #include <qstringlist.h>
54 #include "codechunk.h"
69 typedef QMap<QString, const Node*> NodeMap;
70 typedef QMultiMap<QString, Node*> NodeMultiMap;
71 typedef QMultiMap<QString, const ExampleNode*> ExampleNodeMap;
72 typedef QList<QPair<QString,QString> > ImportList;
112 enum Access { Public, Protected, Private };
122 }; // don't reorder this enum
124 enum ThreadSafeness {
160 FlagValueDefault = -1,
167 void setAccess(Access access) { access_ = access; }
168 void setLocation(const Location& location) { loc = location; }
169 void setDoc(const Doc& doc, bool replace = false);
170 void setStatus(Status status) { status_ = status; }
171 void setThreadSafeness(ThreadSafeness safeness) { safeness_ = safeness; }
172 void setSince(const QString &since);
173 void setRelates(InnerNode* pseudoParent);
174 void setModuleName(const QString &module) { mod = module; }
175 void setLink(LinkType linkType, const QString &link, const QString &desc);
176 void setUrl(const QString &url);
177 void setTemplateStuff(const QString &templateStuff) { templateStuff_ = templateStuff; }
178 void setPageType(PageType t) { pageType_ = t; }
179 void setPageType(const QString& t);
180 void setParent(InnerNode* n) { parent_ = n; }
181 void setIndexNodeFlag() { indexNodeFlag_ = true; }
182 virtual void setOutputFileName(const QString& ) { }
184 virtual bool isInnerNode() const = 0;
185 virtual bool isLeaf() const { return false; }
186 virtual bool isReimp() const { return false; }
187 virtual bool isFunction() const { return false; }
188 virtual bool isQmlNode() const { return false; }
189 virtual bool isQtQuickNode() const { return false; }
190 virtual bool isAbstract() const { return false; }
191 virtual bool isQmlPropertyGroup() const { return false; }
192 virtual bool isCollisionNode() const { return false; }
193 virtual bool isAttached() const { return false; }
194 virtual void setAbstract(bool ) { }
195 virtual QString title() const { return QString(); }
196 virtual bool hasProperty(const QString& ) const { return false; }
197 bool isInternal() const;
198 bool isIndexNode() const { return indexNodeFlag_; }
199 Type type() const { return nodeType_; }
200 virtual SubType subType() const { return NoSubType; }
201 InnerNode* parent() const { return parent_; }
202 InnerNode* relates() const { return relatesTo_; }
203 const QString& name() const { return name_; }
204 QMap<LinkType, QPair<QString,QString> > links() const { return linkMap; }
205 QString moduleName() const;
207 virtual QString nameForLists() const { return name_; }
208 virtual QString outputFileName() const { return QString(); }
209 virtual void addGroupMember(Node* ) { }
210 virtual void addQmlModuleMember(Node* ) { }
212 Access access() const { return access_; }
213 QString accessString() const;
214 const Location& location() const { return loc; }
215 const Doc& doc() const { return d; }
216 Status status() const { return status_; }
217 Status inheritedStatus() const;
218 ThreadSafeness threadSafeness() const;
219 ThreadSafeness inheritedThreadSafeness() const;
220 QString since() const { return sinc; }
221 QString templateStuff() const { return templateStuff_; }
222 PageType pageType() const { return pageType_; }
223 QString pageTypeString() const;
224 QString nodeTypeString() const;
225 QString nodeSubtypeString() const;
226 virtual void addPageKeywords(const QString& ) { }
228 void clearRelated() { relatesTo_ = 0; }
230 virtual QString fileBase() const;
231 QString guid() const;
232 QString ditaXmlHref();
233 QString extractClassName(const QString &string) const;
234 virtual QString qmlTypeName() const { return name_; }
235 virtual QString qmlModuleName() const { return qmlModuleName_; }
236 virtual QString qmlModuleVersion() const { return qmlModuleVersionMajor_ + "." + qmlModuleVersionMinor_; }
237 virtual QString qmlModuleIdentifier() const { return qmlModuleName_ + qmlModuleVersionMajor_; }
238 virtual bool setQmlModule(const ArgLocPair& );
239 virtual ClassNode* classNode() { return 0; }
240 virtual void clearCurrentChild() { }
241 virtual const ImportList* importList() const { return 0; }
242 virtual void setImportList(const ImportList& ) { }
243 virtual const Node* applyModuleIdentifier(const Node* ) const { return 0; }
244 virtual QString idNumber() { return "0"; }
245 QmlClassNode* qmlClassNode();
246 ClassNode* declarativeCppNode();
247 const QString& outputSubdirectory() const { return outSubDir_; }
248 QString fullDocumentName() const;
249 static QString cleanId(QString str);
250 QString idForNode() const;
252 static FlagValue toFlagValue(bool b);
253 static bool fromFlagValue(FlagValue fv, bool defaultValue);
255 static QString pageTypeString(unsigned t);
256 static QString nodeTypeString(unsigned t);
257 static QString nodeSubtypeString(unsigned t);
258 static int incPropertyGroupCount();
259 static void clearPropertyGroupCount();
262 Node(Type type, InnerNode* parent, const QString& name);
268 ThreadSafeness safeness_;
274 InnerNode* relatesTo_;
278 QMap<LinkType, QPair<QString, QString> > linkMap;
282 QString templateStuff_;
283 mutable QString uuid_;
285 QString qmlModuleName_;
286 QString qmlModuleVersionMajor_;
287 QString qmlModuleVersionMinor_;
288 static QStringMap operators_;
289 static int propertyGroupCount_;
294 class NameCollisionNode;
296 typedef QList<Node*> NodeList;
297 typedef QMap<QString, const Node*> NodeMap;
298 typedef QMultiMap<QString, Node*> NodeMultiMap;
300 class InnerNode : public Node
303 virtual ~InnerNode();
305 Node* findChildNodeByName(const QString& name);
306 Node* findChildNodeByName(const QString& name, bool qml);
307 Node* findChildNodeByNameAndType(const QString& name, Type type);
308 void findNodes(const QString& name, QList<Node*>& n);
309 FunctionNode* findFunctionNode(const QString& name);
310 FunctionNode* findFunctionNode(const FunctionNode* clone);
311 void addInclude(const QString &include);
312 void setIncludes(const QStringList &includes);
313 void setOverload(const FunctionNode* func, bool overlode);
314 void normalizeOverloads();
315 void makeUndocumentedChildrenInternal();
316 void clearCurrentChildPointers();
317 void deleteChildren();
318 void removeFromRelated();
320 virtual bool isInnerNode() const { return true; }
321 virtual bool isLeaf() const { return false; }
322 const Node* findChildNodeByName(const QString& name) const;
323 const Node* findChildNodeByName(const QString& name, bool qml) const;
324 const Node* findChildNodeByNameAndType(const QString& name, Type type) const;
325 const FunctionNode* findFunctionNode(const QString& name) const;
326 const FunctionNode* findFunctionNode(const FunctionNode* clone) const;
327 const EnumNode* findEnumNodeForValue(const QString &enumValue) const;
328 const NodeList & childNodes() const { return children; }
329 const NodeList & relatedNodes() const { return related_; }
330 int count() const { return children.size(); }
331 int overloadNumber(const FunctionNode* func) const;
332 NodeList overloads(const QString &funcName) const;
333 const QStringList& includes() const { return inc; }
335 QStringList primaryKeys();
336 QStringList secondaryKeys();
337 const QStringList& pageKeywords() const { return pageKeywds; }
338 virtual void addPageKeywords(const QString& t) { pageKeywds << t; }
339 virtual void setCurrentChild() { }
340 virtual void setCurrentChild(InnerNode* ) { }
341 virtual void setOutputFileName(const QString& f) { outputFileName_ = f; }
342 virtual QString outputFileName() const { return outputFileName_; }
345 InnerNode(Type type, InnerNode* parent, const QString& name);
349 friend class NameCollisionNode;
351 static bool isSameSignature(const FunctionNode* f1, const FunctionNode* f2);
352 void addChild(Node* child);
353 void removeRelated(Node* pseudoChild);
354 void removeChild(Node* child);
356 QString outputFileName_;
357 QStringList pageKeywds;
360 NodeList enumChildren;
362 QMap<QString, Node*> childMap;
363 QMap<QString, Node*> primaryFunctionMap;
364 QMap<QString, NodeList> secondaryFunctionMap;
367 class LeafNode : public Node
371 virtual ~LeafNode() { }
373 virtual bool isInnerNode() const { return false; }
374 virtual bool isLeaf() const { return true; }
377 LeafNode(Type type, InnerNode* parent, const QString& name);
378 LeafNode(InnerNode* parent, Type type, const QString& name);
381 class NamespaceNode : public InnerNode
384 NamespaceNode(InnerNode* parent, const QString& name);
385 virtual ~NamespaceNode() { }
393 RelatedClass(Node::Access access0,
395 const QString& dataTypeWithTemplateArgs0 = "")
398 dataTypeWithTemplateArgs(dataTypeWithTemplateArgs0) { }
399 QString accessString() const;
403 QString dataTypeWithTemplateArgs;
408 class ClassNode : public InnerNode
411 ClassNode(InnerNode* parent, const QString& name);
412 virtual ~ClassNode() { }
414 void addBaseClass(Access access,
416 const QString &dataTypeWithTemplateArgs = "");
417 void fixBaseClasses();
419 const QList<RelatedClass> &baseClasses() const { return bases; }
420 const QList<RelatedClass> &derivedClasses() const { return derived; }
421 const QList<RelatedClass> &ignoredBaseClasses() const { return ignoredBases; }
423 bool hideFromMainList() const { return hidden; }
424 void setHideFromMainList(bool value) { hidden = value; }
426 QString serviceName() const { return sname; }
427 void setServiceName(const QString& value) { sname = value; }
428 QmlClassNode* qmlElement() { return qmlelement; }
429 void setQmlElement(QmlClassNode* qcn) { qmlelement = qcn; }
430 virtual bool isAbstract() const { return abstract_; }
431 virtual void setAbstract(bool b) { abstract_ = b; }
432 PropertyNode* findPropertyNode(const QString& name);
433 QmlClassNode* findQmlBaseNode();
436 QList<RelatedClass> bases;
437 QList<RelatedClass> derived;
438 QList<RelatedClass> ignoredBases;
442 QmlClassNode* qmlelement;
445 class FakeNode : public InnerNode
449 FakeNode(InnerNode* parent,
453 virtual ~FakeNode() { }
455 void setTitle(const QString &title) { title_ = title; }
456 void setSubTitle(const QString &subTitle) { subtitle_ = subTitle; }
457 virtual void addGroupMember(Node* node) { nodeList.append(node); }
458 virtual void addQmlModuleMember(Node* node) { nodeList.append(node); }
460 SubType subType() const { return nodeSubtype_; }
461 virtual QString title() const;
462 virtual QString fullTitle() const;
463 virtual QString subTitle() const;
464 virtual QString imageFileName() const { return QString(); }
465 const NodeList& groupMembers() const { return nodeList; }
466 const NodeList& qmlModuleMembers() const { return nodeList; }
467 virtual QString nameForLists() const { return title(); }
468 virtual void setImageFileName(const QString& ) { }
469 virtual bool isQmlPropertyGroup() const { return (nodeSubtype_ == QmlPropertyGroup); }
470 virtual bool hasProperty(const QString& ) const;
472 static void insertQmlModuleNode(const QString& qmid, FakeNode* fn);
473 static FakeNode* lookupQmlModuleNode(Tree* tree, const ArgLocPair& arg);
476 SubType nodeSubtype_;
479 NodeList nodeList; // used for groups and QML modules.
481 static QMap<QString, FakeNode*> qmlModuleMap_;
484 class NameCollisionNode : public FakeNode
487 NameCollisionNode(InnerNode* child);
488 ~NameCollisionNode();
489 const InnerNode* currentChild() const { return current; }
490 virtual void setCurrentChild(InnerNode* child) { current = child; }
491 virtual void clearCurrentChild() { current = 0; }
492 virtual bool isQmlNode() const;
493 virtual bool isCollisionNode() const { return true; }
494 virtual const Node* applyModuleIdentifier(const Node* origin) const;
495 InnerNode* findAny(Node::Type t, Node::SubType st);
496 void addCollision(InnerNode* child);
497 const QMap<QString,QString>& linkTargets() const { return targets; }
498 void addLinkTarget(const QString& t, const QString& v) { targets.insert(t,v); }
502 QMap<QString,QString> targets;
505 class ExampleNode : public FakeNode
508 ExampleNode(InnerNode* parent, const QString& name);
509 virtual ~ExampleNode() { }
510 virtual QString imageFileName() const { return imageFileName_; }
511 virtual void setImageFileName(const QString& ifn) { imageFileName_ = ifn; }
513 static void terminate() { exampleNodeMap.clear(); }
516 static ExampleNodeMap exampleNodeMap;
519 QString imageFileName_;
522 class QmlClassNode : public FakeNode
525 QmlClassNode(InnerNode* parent,
528 virtual ~QmlClassNode();
529 virtual bool isQmlNode() const { return true; }
530 virtual bool isQtQuickNode() const { return (qmlModuleName() == QLatin1String("QtQuick")); }
531 virtual ClassNode* classNode() { return cnode_; }
532 virtual QString fileBase() const;
533 virtual void setCurrentChild();
534 virtual void clearCurrentChild();
535 virtual const ImportList* importList() const { return &importList_; }
536 virtual void setImportList(const ImportList& il) { importList_ = il; }
537 virtual bool isAbstract() const { return abstract_; }
538 virtual void setAbstract(bool b) { abstract_ = b; }
539 const FakeNode* qmlBase() const { return base_; }
540 void resolveInheritance(Tree* tree);
541 void requireCppClass() { cnodeRequired_ = true; }
542 bool cppClassRequired() const { return cnodeRequired_; }
543 static void addInheritedBy(const QString& base, Node* sub);
544 static void subclasses(const QString& base, NodeList& subs);
545 static void terminate();
547 static void insertQmlModuleMember(const QString& qmid, QmlClassNode* qcn);
548 static QmlClassNode* lookupQmlTypeNode(const QString& qmid, const QString& name);
552 static QMultiMap<QString,Node*> inheritedBy;
553 static QMap<QString, QmlClassNode*> qmlModuleMemberMap_;
560 ImportList importList_;
563 class QmlBasicTypeNode : public FakeNode
566 QmlBasicTypeNode(InnerNode* parent,
567 const QString& name);
568 virtual ~QmlBasicTypeNode() { }
569 virtual bool isQmlNode() const { return true; }
572 class QmlPropGroupNode : public FakeNode
575 QmlPropGroupNode(QmlClassNode* parent, const QString& name);
576 virtual ~QmlPropGroupNode() { }
577 virtual bool isQmlNode() const { return true; }
578 virtual bool isQtQuickNode() const { return parent()->isQtQuickNode(); }
579 virtual QString qmlTypeName() const { return parent()->qmlTypeName(); }
580 virtual QString qmlModuleName() const { return parent()->qmlModuleName(); }
581 virtual QString qmlModuleVersion() const { return parent()->qmlModuleVersion(); }
582 virtual QString qmlModuleIdentifier() const { return parent()->qmlModuleIdentifier(); }
583 virtual QString idNumber();
585 const QString& element() const { return parent()->name(); }
591 class QmlPropertyNode;
593 class QmlPropertyNode : public LeafNode
596 QmlPropertyNode(QmlClassNode *parent,
600 QmlPropertyNode(QmlPropGroupNode* parent,
604 QmlPropertyNode(QmlPropertyNode* parent,
608 virtual ~QmlPropertyNode() { }
610 void setDataType(const QString& dataType) { type_ = dataType; }
611 void setStored(bool stored) { stored_ = toFlagValue(stored); }
612 void setDesignable(bool designable) { designable_ = toFlagValue(designable); }
613 void setReadOnly(bool ro) { readOnly_ = toFlagValue(ro); }
614 void setDefault() { isdefault_ = true; }
616 const QString &dataType() const { return type_; }
617 QString qualifiedDataType() const { return type_; }
618 bool isReadOnlySet() const { return (readOnly_ != FlagValueDefault); }
619 bool isDefault() const { return isdefault_; }
620 bool isStored() const { return fromFlagValue(stored_,true); }
621 bool isDesignable() const { return fromFlagValue(designable_,false); }
622 bool isWritable(Tree* tree);
623 bool isReadOnly() const { return fromFlagValue(readOnly_,false); }
624 virtual bool isAttached() const { return attached_; }
625 virtual bool isQmlNode() const { return true; }
626 virtual bool isQtQuickNode() const { return parent()->isQtQuickNode(); }
627 virtual QString qmlTypeName() const { return parent()->qmlTypeName(); }
628 virtual QString qmlModuleName() const { return parent()->qmlModuleName(); }
629 virtual QString qmlModuleVersion() const { return parent()->qmlModuleVersion(); }
630 virtual QString qmlModuleIdentifier() const { return parent()->qmlModuleIdentifier(); }
631 virtual bool hasProperty(const QString& name) const;
633 PropertyNode* correspondingProperty(Tree* tree);
635 const QString& element() const { return static_cast<QmlPropGroupNode*>(parent())->element(); }
636 void appendQmlPropNode(QmlPropertyNode* p) { qmlPropNodes_.append(p); }
637 const NodeList& qmlPropNodes() const { return qmlPropNodes_; }
642 FlagValue designable_;
646 NodeList qmlPropNodes_;
653 EnumItem(const QString& name, const QString& value)
654 : nam(name), val(value) { }
655 EnumItem(const QString& name, const QString& value, const Text &txt)
656 : nam(name), val(value), txt(txt) { }
658 const QString& name() const { return nam; }
659 const QString& value() const { return val; }
660 const Text &text() const { return txt; }
670 class EnumNode : public LeafNode
673 EnumNode(InnerNode* parent, const QString& name);
674 virtual ~EnumNode() { }
676 void addItem(const EnumItem& item);
677 void setFlagsType(TypedefNode* typedeff);
678 bool hasItem(const QString &name) const { return names.contains(name); }
680 const QList<EnumItem>& items() const { return itms; }
681 Access itemAccess(const QString& name) const;
682 const TypedefNode* flagsType() const { return ft; }
683 QString itemValue(const QString &name) const;
686 QList<EnumItem> itms;
688 const TypedefNode* ft;
691 class TypedefNode : public LeafNode
694 TypedefNode(InnerNode* parent, const QString& name);
695 virtual ~TypedefNode() { }
697 const EnumNode* associatedEnum() const { return ae; }
700 void setAssociatedEnum(const EnumNode* enume);
702 friend class EnumNode;
707 inline void EnumNode::setFlagsType(TypedefNode* typedeff)
710 typedeff->setAssociatedEnum(this);
718 Parameter(const QString& leftType,
719 const QString& rightType = "",
720 const QString& name = "",
721 const QString& defaultValue = "");
722 Parameter(const Parameter& p);
724 Parameter& operator=(const Parameter& p);
726 void setName(const QString& name) { nam = name; }
728 bool hasType() const { return lef.length() + rig.length() > 0; }
729 const QString& leftType() const { return lef; }
730 const QString& rightType() const { return rig; }
731 const QString& name() const { return nam; }
732 const QString& defaultValue() const { return def; }
734 QString reconstruct(bool value = false) const;
745 class FunctionNode : public LeafNode
757 enum Virtualness { NonVirtual, ImpureVirtual, PureVirtual };
759 FunctionNode(InnerNode* parent, const QString &name);
760 FunctionNode(Type type, InnerNode* parent, const QString &name, bool attached);
761 virtual ~FunctionNode() { }
763 void setReturnType(const QString& returnType) { rt = returnType; }
764 void setParentPath(const QStringList& parentPath) { pp = parentPath; }
765 void setMetaness(Metaness metaness) { met = metaness; }
766 void setVirtualness(Virtualness virtualness);
767 void setConst(bool conste) { con = conste; }
768 void setStatic(bool statique) { sta = statique; }
769 void setOverload(bool overlode);
770 void setReimp(bool r);
771 void addParameter(const Parameter& parameter);
772 inline void setParameters(const QList<Parameter>& parameters);
773 void borrowParameterNames(const FunctionNode* source);
774 void setReimplementedFrom(FunctionNode* from);
776 const QString& returnType() const { return rt; }
777 Metaness metaness() const { return met; }
778 bool isMacro() const {
779 return met == MacroWithParams || met == MacroWithoutParams;
781 Virtualness virtualness() const { return vir; }
782 bool isConst() const { return con; }
783 bool isStatic() const { return sta; }
784 bool isOverload() const { return ove; }
785 bool isReimp() const { return reimp; }
786 bool isFunction() const { return true; }
787 int overloadNumber() const;
788 const QList<Parameter>& parameters() const { return params; }
789 QStringList parameterNames() const;
790 QString rawParameters(bool names = false, bool values = false) const;
791 const FunctionNode* reimplementedFrom() const { return rf; }
792 const QList<FunctionNode*> &reimplementedBy() const { return rb; }
793 const PropertyNode* associatedProperty() const { return ap; }
794 const QStringList& parentPath() const { return pp; }
796 QStringList reconstructParams(bool values = false) const;
797 QString signature(bool values = false) const;
798 const QString& element() const { return parent()->name(); }
799 virtual bool isAttached() const { return attached_; }
800 virtual bool isQmlNode() const {
801 return ((type() == QmlSignal) ||
802 (type() == QmlMethod) ||
803 (type() == QmlSignalHandler));
805 virtual bool isQtQuickNode() const { return parent()->isQtQuickNode(); }
806 virtual QString qmlTypeName() const { return parent()->qmlTypeName(); }
807 virtual QString qmlModuleName() const { return parent()->qmlModuleName(); }
808 virtual QString qmlModuleVersion() const { return parent()->qmlModuleVersion(); }
809 virtual QString qmlModuleIdentifier() const { return parent()->qmlModuleIdentifier(); }
814 void setAssociatedProperty(PropertyNode* property);
816 friend class InnerNode;
817 friend class PropertyNode;
833 QList<Parameter> params;
834 const FunctionNode* rf;
835 const PropertyNode* ap;
836 QList<FunctionNode*> rb;
839 class PropertyNode : public LeafNode
842 enum FunctionRole { Getter, Setter, Resetter, Notifier };
843 enum { NumFunctionRoles = Notifier + 1 };
845 PropertyNode(InnerNode* parent, const QString& name);
846 virtual ~PropertyNode() { }
848 void setDataType(const QString& dataType) { type_ = dataType; }
849 void addFunction(FunctionNode* function, FunctionRole role);
850 void addSignal(FunctionNode* function, FunctionRole role);
851 void setStored(bool stored) { stored_ = toFlagValue(stored); }
852 void setDesignable(bool designable) { designable_ = toFlagValue(designable); }
853 void setScriptable(bool scriptable) { scriptable_ = toFlagValue(scriptable); }
854 void setWritable(bool writable) { writable_ = toFlagValue(writable); }
855 void setUser(bool user) { user_ = toFlagValue(user); }
856 void setOverriddenFrom(const PropertyNode* baseProperty);
857 void setRuntimeDesFunc(const QString& rdf) { runtimeDesFunc = rdf; }
858 void setRuntimeScrFunc(const QString& scrf) { runtimeScrFunc = scrf; }
859 void setConstant() { cst = true; }
860 void setFinal() { fnl = true; }
861 void setRevision(int revision) { rev = revision; }
863 const QString &dataType() const { return type_; }
864 QString qualifiedDataType() const;
865 NodeList functions() const;
866 NodeList functions(FunctionRole role) const { return funcs[(int)role]; }
867 NodeList getters() const { return functions(Getter); }
868 NodeList setters() const { return functions(Setter); }
869 NodeList resetters() const { return functions(Resetter); }
870 NodeList notifiers() const { return functions(Notifier); }
871 bool isStored() const { return fromFlagValue(stored_, storedDefault()); }
872 bool isDesignable() const { return fromFlagValue(designable_, designableDefault()); }
873 bool isScriptable() const { return fromFlagValue(scriptable_, scriptableDefault()); }
874 const QString& runtimeDesignabilityFunction() const { return runtimeDesFunc; }
875 const QString& runtimeScriptabilityFunction() const { return runtimeScrFunc; }
876 bool isWritable() const { return fromFlagValue(writable_, writableDefault()); }
877 bool isUser() const { return fromFlagValue(user_, userDefault()); }
878 bool isConstant() const { return cst; }
879 bool isFinal() const { return fnl; }
880 const PropertyNode* overriddenFrom() const { return overrides; }
882 bool storedDefault() const { return true; }
883 bool userDefault() const { return false; }
884 bool designableDefault() const { return !setters().isEmpty(); }
885 bool scriptableDefault() const { return true; }
886 bool writableDefault() const { return !setters().isEmpty(); }
890 QString runtimeDesFunc;
891 QString runtimeScrFunc;
892 NodeList funcs[NumFunctionRoles];
894 FlagValue designable_;
895 FlagValue scriptable_;
901 const PropertyNode* overrides;
904 inline void FunctionNode::setParameters(const QList<Parameter> ¶meters)
909 inline void PropertyNode::addFunction(FunctionNode* function, FunctionRole role)
911 funcs[(int)role].append(function);
912 function->setAssociatedProperty(this);
915 inline void PropertyNode::addSignal(FunctionNode* function, FunctionRole role)
917 funcs[(int)role].append(function);
918 function->setAssociatedProperty(this);
921 inline NodeList PropertyNode::functions() const
924 for (int i = 0; i < NumFunctionRoles; ++i)
929 class VariableNode : public LeafNode
932 VariableNode(InnerNode* parent, const QString &name);
933 virtual ~VariableNode() { }
935 void setLeftType(const QString &leftType) { lt = leftType; }
936 void setRightType(const QString &rightType) { rt = rightType; }
937 void setStatic(bool statique) { sta = statique; }
939 const QString &leftType() const { return lt; }
940 const QString &rightType() const { return rt; }
941 QString dataType() const { return lt + rt; }
942 bool isStatic() const { return sta; }
950 inline VariableNode::VariableNode(InnerNode* parent, const QString &name)
951 : LeafNode(Variable, parent, name), sta(false)
956 class DitaMapNode : public FakeNode
959 DitaMapNode(InnerNode* parent, const QString& name)
960 : FakeNode(parent, name, Node::Page, Node::DitaMapPage) { }
961 virtual ~DitaMapNode() { }
963 const DitaRefList& map() const { return doc().ditamap(); }