20
21
** ensure the GNU Lesser General Public License version 2.1 requirements
21
22
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
23
** In addition, as a special exception, Nokia gives you certain
24
** additional rights. These rights are described in the Nokia Qt LGPL
25
** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
28
** GNU General Public License Usage
29
** Alternatively, this file may be used under the terms of the GNU
30
** General Public License version 3.0 as published by the Free Software
31
** Foundation and appearing in the file LICENSE.GPL included in the
32
** packaging of this file. Please review the following information to
33
** ensure the GNU General Public License version 3.0 requirements will be
34
** met: http://www.gnu.org/copyleft/gpl.html.
36
** If you are unsure which license is appropriate for your use, please
37
** contact the sales department at http://www.qtsoftware.com/contact.
24
** In addition, as a special exception, Nokia gives you certain additional
25
** rights. These rights are described in the Nokia Qt LGPL Exception
26
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28
** If you have questions regarding the use of this file, please contact
29
** Nokia at qt-info@nokia.com.
38
38
** $QT_END_LICENSE$
40
40
****************************************************************************/
633
if (command == COMMAND_CLASS) {
634
if (paths.size() > 1) {
635
if (!paths[1].endsWith(".h")) {
636
ClassNode*cnode = static_cast<ClassNode*>(node);
637
cnode->setQmlElement(paths[1]);
648
643
else if (command == COMMAND_EXAMPLE) {
649
FakeNode *fake = new FakeNode(tre->root(), arg, FakeNode::Example);
644
FakeNode *fake = new FakeNode(tre->root(), arg, Node::Example);
650
645
createExampleFileNodes(fake);
653
648
else if (command == COMMAND_EXTERNALPAGE) {
654
return new FakeNode(tre->root(), arg, FakeNode::ExternalPage);
649
return new FakeNode(tre->root(), arg, Node::ExternalPage);
656
651
else if (command == COMMAND_FILE) {
657
return new FakeNode(tre->root(), arg, FakeNode::File);
652
return new FakeNode(tre->root(), arg, Node::File);
659
654
else if (command == COMMAND_GROUP) {
660
return new FakeNode(tre->root(), arg, FakeNode::Group);
655
return new FakeNode(tre->root(), arg, Node::Group);
662
657
else if (command == COMMAND_HEADERFILE) {
663
return new FakeNode(tre->root(), arg, FakeNode::HeaderFile);
658
return new FakeNode(tre->root(), arg, Node::HeaderFile);
665
660
else if (command == COMMAND_MODULE) {
666
return new FakeNode(tre->root(), arg, FakeNode::Module);
661
return new FakeNode(tre->root(), arg, Node::Module);
668
663
else if (command == COMMAND_PAGE) {
669
return new FakeNode(tre->root(), arg, FakeNode::Page);
664
return new FakeNode(tre->root(), arg, Node::Page);
672
667
else if (command == COMMAND_QMLCLASS) {
673
668
const ClassNode* classNode = 0;
674
QStringList names = arg.split(" ");
675
//qDebug() << "QMLCLASS" << names;
669
QStringList names = arg.split(" ");
676
670
if (names.size() > 1) {
677
671
Node* n = tre->findNode(names[1].split("::"),Node::Class);
679
673
classNode = static_cast<const ClassNode*>(n);
680
//qDebug() << "FOUND IT!" << classNode->name();
675
return new QmlClassNode(tre->root(), names[0], classNode);
677
else if ((command == COMMAND_QMLSIGNAL) ||
678
(command == COMMAND_QMLMETHOD)) {
681
QmlClassNode* qmlClass = 0;
682
if (splitQmlArg(doc,arg,element,name)) {
683
Node* n = tre->findNode(QStringList(element),Node::Fake);
684
if (n && n->subType() == Node::QmlClass) {
685
qmlClass = static_cast<QmlClassNode*>(n);
686
if (command == COMMAND_QMLSIGNAL)
687
return new QmlSignalNode(qmlClass,name);
689
return new QmlMethodNode(qmlClass,name);
683
return new QmlNode(tre->root(), names[0], classNode);
700
A QML property argument has the form...
702
<type> <element>::<name>
704
This function splits the argument into those three
705
parts, sets \a type, \a element, and \a property,
706
and returns true. If any of the parts isn't found,
707
a debug message is output and false is returned.
709
bool CppCodeParser::splitQmlPropertyArg(const Doc& doc,
715
QStringList blankSplit = arg.split(" ");
716
if (blankSplit.size() > 1) {
717
type = blankSplit[0];
718
QStringList colonSplit(blankSplit[1].split("::"));
719
if (colonSplit.size() > 1) {
720
element = colonSplit[0];
721
property = colonSplit[1];
725
doc.location().warning(tr("Missing QML element name or property name"));
728
doc.location().warning(tr("Missing QML property type or property path"));
733
A QML signal or method argument has the form...
737
This function splits the argument into those two
738
parts, sets \a element, and \a name, and returns
739
true. If either of the parts isn't found, a debug
740
message is output and false is returned.
742
bool CppCodeParser::splitQmlArg(const Doc& doc,
747
QStringList colonSplit(arg.split("::"));
748
if (colonSplit.size() > 1) {
749
element = colonSplit[0];
750
name = colonSplit[1];
754
doc.location().warning(tr("Missing QML element name or signal/method name"));
759
Process the topic \a command group with arguments \a args.
761
Currently, this function is called only for \e{qmlproperty}.
763
Node *CppCodeParser::processTopicCommandGroup(const Doc& doc,
764
const QString& command,
765
const QStringList& args)
767
QmlPropGroupNode* qmlPropGroup = 0;
768
if (command == COMMAND_QMLPROPERTY) {
772
QStringList::ConstIterator arg = args.begin();
773
if (splitQmlPropertyArg(doc,(*arg),type,element,property)) {
774
Node* n = tre->findNode(QStringList(element),Node::Fake);
775
if (n && n->subType() == Node::QmlClass) {
776
QmlClassNode* qmlClass = static_cast<QmlClassNode*>(n);
778
qmlPropGroup = new QmlPropGroupNode(qmlClass,property);
782
new QmlPropertyNode(qmlPropGroup,property,type);
784
while (arg != args.end()) {
785
if (splitQmlPropertyArg(doc,(*arg),type,element,property)) {
786
new QmlPropertyNode(qmlPropGroup,property,type);
690
797
Returns the set of strings representing the common metacommands
691
798
plus some other metacommands.
742
855
tr("The function either doesn't exist in any base class "
743
856
"with the same signature or it exists but isn't virtual."));
745
#if 0 // Ideally, we would enable this check to warn whenever \reimp is used
746
// incorrectly, and only make the node internal if the function is a
747
// reimplementation of another function in a base class.
859
Ideally, we would enable this check to warn whenever
860
\reimp is used incorrectly, and only make the node
861
internal if the function is a reimplementation of
862
another function in a base class.
748
864
else if (from->access() == Node::Private
749
865
|| from->parent()->access() == Node::Private) {
750
doc.location().warning(
751
tr("Base function for '\\%1' in %2() is private or internal")
866
doc.location().warning(tr("'\\%1' in %2() should be '\\internal' because its base function is private or internal")
752
867
.arg(COMMAND_REIMP).arg(node->name()));
755
// Note: Setting the access to Private hides the documentation,
756
// but setting the status to Internal makes the node available
757
// in the XML output when the WebXMLGenerator is used.
871
// Reimplemented functions now reported in separate sections.
873
Note: Setting the access to Private hides the documentation,
874
but setting the status to Internal makes the node available
875
in the XML output when the WebXMLGenerator is used.
758
877
func->setAccess(Node::Private);
759
878
func->setStatus(Node::Internal);
880
func->setReimp(true);
762
883
doc.location().warning(tr("Ignored '\\%1' in %2")