From 771337bb2c286343ac912a32101fc7d418ef8a7c Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 19 Nov 2010 15:40:40 +0100 Subject: Removed unused files and functionality from qdoc3. Many of the generators were unused. The old QSA and Qt Script parsers were unused. We no longer use DCF files for Qt Assistant. We no longer generate Qt Jambi documentation, and qdoc3 was not used for much of that process, making some of the relevant files obsolete. --- tools/qdoc3/bookgenerator.cpp | 64 --- tools/qdoc3/bookgenerator.h | 64 --- tools/qdoc3/cpptoqsconverter.cpp | 415 ----------------- tools/qdoc3/cpptoqsconverter.h | 88 ---- tools/qdoc3/dcfsection.cpp | 111 ----- tools/qdoc3/dcfsection.h | 94 ---- tools/qdoc3/htmlgenerator.cpp | 132 +----- tools/qdoc3/htmlgenerator.h | 11 - tools/qdoc3/jambiapiparser.cpp | 546 ---------------------- tools/qdoc3/jambiapiparser.h | 99 ---- tools/qdoc3/javacodemarker.cpp | 203 -------- tools/qdoc3/javacodemarker.h | 83 ---- tools/qdoc3/javadocgenerator.cpp | 454 ------------------ tools/qdoc3/javadocgenerator.h | 95 ---- tools/qdoc3/linguistgenerator.cpp | 245 ---------- tools/qdoc3/linguistgenerator.h | 85 ---- tools/qdoc3/loutgenerator.cpp | 63 --- tools/qdoc3/loutgenerator.h | 67 --- tools/qdoc3/main.cpp | 26 +- tools/qdoc3/mangenerator.cpp | 228 --------- tools/qdoc3/mangenerator.h | 79 ---- tools/qdoc3/qdoc3.pro | 26 -- tools/qdoc3/qsakernelparser.cpp | 186 -------- tools/qdoc3/qsakernelparser.h | 77 ---- tools/qdoc3/qscodemarker.cpp | 378 --------------- tools/qdoc3/qscodemarker.h | 79 ---- tools/qdoc3/qscodeparser.cpp | 944 -------------------------------------- tools/qdoc3/qscodeparser.h | 128 ------ tools/qdoc3/sgmlgenerator.cpp | 63 --- tools/qdoc3/sgmlgenerator.h | 67 --- 30 files changed, 3 insertions(+), 5197 deletions(-) delete mode 100644 tools/qdoc3/bookgenerator.cpp delete mode 100644 tools/qdoc3/bookgenerator.h delete mode 100644 tools/qdoc3/cpptoqsconverter.cpp delete mode 100644 tools/qdoc3/cpptoqsconverter.h delete mode 100644 tools/qdoc3/dcfsection.cpp delete mode 100644 tools/qdoc3/dcfsection.h delete mode 100644 tools/qdoc3/jambiapiparser.cpp delete mode 100644 tools/qdoc3/jambiapiparser.h delete mode 100644 tools/qdoc3/javacodemarker.cpp delete mode 100644 tools/qdoc3/javacodemarker.h delete mode 100644 tools/qdoc3/javadocgenerator.cpp delete mode 100644 tools/qdoc3/javadocgenerator.h delete mode 100644 tools/qdoc3/linguistgenerator.cpp delete mode 100644 tools/qdoc3/linguistgenerator.h delete mode 100644 tools/qdoc3/loutgenerator.cpp delete mode 100644 tools/qdoc3/loutgenerator.h delete mode 100644 tools/qdoc3/mangenerator.cpp delete mode 100644 tools/qdoc3/mangenerator.h delete mode 100644 tools/qdoc3/qsakernelparser.cpp delete mode 100644 tools/qdoc3/qsakernelparser.h delete mode 100644 tools/qdoc3/qscodemarker.cpp delete mode 100644 tools/qdoc3/qscodemarker.h delete mode 100644 tools/qdoc3/qscodeparser.cpp delete mode 100644 tools/qdoc3/qscodeparser.h delete mode 100644 tools/qdoc3/sgmlgenerator.cpp delete mode 100644 tools/qdoc3/sgmlgenerator.h diff --git a/tools/qdoc3/bookgenerator.cpp b/tools/qdoc3/bookgenerator.cpp deleted file mode 100644 index bbcdd11..0000000 --- a/tools/qdoc3/bookgenerator.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - bookgenerator.cpp -*/ - -#include "bookgenerator.h" - -QT_BEGIN_NAMESPACE - -BookGenerator::BookGenerator() -{ -} - -BookGenerator::~BookGenerator() -{ -} - -void BookGenerator::generateTree( const Tree *tree, CodeMarker *marker ) -{ - Q_UNUSED( tree ) - Q_UNUSED( marker ) -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/bookgenerator.h b/tools/qdoc3/bookgenerator.h deleted file mode 100644 index 69b65fc..0000000 --- a/tools/qdoc3/bookgenerator.h +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - bookgenerator.h -*/ - -#ifndef BOOKGENERATOR_H -#define BOOKGENERATOR_H - -#include "generator.h" - -QT_BEGIN_NAMESPACE - -class BookGenerator : public Generator -{ -public: - BookGenerator(); - ~BookGenerator(); - - virtual void generateTree( const Tree *tree, CodeMarker *marker ); -}; - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/cpptoqsconverter.cpp b/tools/qdoc3/cpptoqsconverter.cpp deleted file mode 100644 index 1a44c16..0000000 --- a/tools/qdoc3/cpptoqsconverter.cpp +++ /dev/null @@ -1,415 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - cpptoqsconverter.cpp -*/ - -#include "config.h" -#include "cpptoqsconverter.h" - -QT_BEGIN_NAMESPACE - -#define CONFIG_QUICK "quick" -#define CONFIG_INDENTSIZE "indentsize" - -void setTabSize( int size ); -void setIndentSize( int size ); -int columnForIndex( const QString& t, int index ); -int indentForBottomLine( const QStringList& program, QChar typedIn ); - -static QString balancedParens = "(?:[^()]+|\\([^()]*\\))*"; - -QRegExp CppToQsConverter::qClassRegExp; -QRegExp CppToQsConverter::addressOperatorRegExp; -QRegExp CppToQsConverter::gulbrandsenRegExp; -int CppToQsConverter::tabSize; - -ClassNode *CppToQsConverter::findClassNode( Tree *qsTree, - const QString& qtName ) -{ - ClassNode *classe = (ClassNode *) qsTree->findNode( QStringList(qtName), Node::Class ); - if ( classe == 0 ) - classe = (ClassNode *) qsTree->findNode( QStringList(qtName.mid(1)), Node::Class ); - return classe; -} - -QString CppToQsConverter::convertedDataType( Tree *qsTree, - const QString& leftType, - const QString& /* rightType */ ) -{ - QString s = leftType; - - if ( s.startsWith("const ") ) - s = s.mid( 6 ); - while ( s.endsWith("*") || s.endsWith("&") || s.endsWith(" ") ) - s.truncate( s.length() - 1 ); - - switch ( s[0].unicode() ) { - case 'Q': - if ( s == "QCString" ) { - return "String"; - } else { - Node *node = findClassNode( qsTree, s ); - if ( node == 0 ) { - return ""; - } else { - return node->name(); - } - } - break; - case 'b': - if ( s == "bool" ) - return "Boolean"; - break; - case 'c': - if ( s == "char" ) { - if ( leftType == "const char *" ) { - return "String"; - } else { - return "Number"; - } - } - break; - case 'd': - if ( s == "double" ) - return "Number"; - break; - case 'f': - if ( s == "float" ) - return "Number"; - case 'i': - if ( s == "int" ) - return "Number"; - break; - case 'l': - if ( s == "long" || s == "long int" || s == "long long" || - s == "long long int" || s == "long double" ) - return "Number"; - break; - case 's': - if ( s == "short" || s == "short int" || s == "signed char" || - s == "signed short" || s == "signed short int" || s == "signed" || - s == "signed int" || s == "signed long" || s == "signed long int" ) - return "Number"; - break; - case 'u': - if ( s == "uchar" || s == "unsigned" || s == "unsigned char" || - s == "ushort" || s == "unsigned short" || - s == "unsigned short int" || s == "uint" || s == "unsigned int" || - s == "ulong" || s == "unsigned long" || s == "unsigned long int" ) - return "Number"; - break; - case 'v': - if ( s == "void" ) - return ""; - } - return s; -} - -QString CppToQsConverter::convertedCode( Tree *qsTree, const QString& code, - const QSet& classesWithNoQ ) -{ - QString result; - QStringList program; - QStringList comments; - int programWidth = 0; - - QStringList originalLines = code.split("\n"); - QStringList::ConstIterator ol = originalLines.begin(); - while ( ol != originalLines.end() ) { - QString code = (*ol).trimmed(); - QString comment; - - int slashSlash = code.indexOf( "//" ); - if ( slashSlash != -1 ) { - comment = code.mid( slashSlash ); - code.truncate( slashSlash ); - code = code.trimmed(); - } - - code = convertCodeLine( qsTree, program, code, classesWithNoQ ); - program.append( code ); - - comment = convertComment( qsTree, comment, classesWithNoQ ); - comments.append( comment ); - - int n = indentForBottomLine( program, QChar::Null ); - for ( int i = 0; i < n; i++ ) - program.last().prepend( " " ); - - int width = columnForIndex( program.last(), program.last().length() ); - if ( !comment.isEmpty() && width > programWidth ) - programWidth = width; - ++ol; - } - - programWidth = ( (programWidth + (tabSize - 1) + 2) / tabSize ) * tabSize; - - QStringList::ConstIterator p = program.begin(); - QStringList::ConstIterator c = comments.begin(); - while ( c != comments.end() ) { - if ( c != comments.begin() ) - result += "\n"; - - if ( (*p).trimmed().isEmpty() ) { - if ( !(*c).isEmpty() ) - result += *p; - } else { - result += *p; - if ( !(*c).isEmpty() ) { - int i = columnForIndex( *p, (*p).length() ); - while ( i++ < programWidth ) - result += " "; - } - } - result += *c; - ++p; - ++c; - } - return result; -} - -void CppToQsConverter::initialize( const Config& config ) -{ - qClassRegExp.setPattern( "\\bQ([A-Z][A-Za-z]+)\\b" ); - addressOperatorRegExp.setPattern( "([(\\s])[*&]([a-zA-Z])" ); - gulbrandsenRegExp.setPattern( "\\b::\\b|->" ); - - tabSize = config.getInt( CONFIG_TABSIZE ); - setTabSize( tabSize ); - - int size = config.getInt( CONFIG_QUICK + Config::dot + CONFIG_INDENTSIZE ); - if ( size > 0 ) - setIndentSize( size ); -} - -void CppToQsConverter::terminate() -{ -} - -QString CppToQsConverter::convertCodeLine( Tree *qsTree, - const QStringList& program, - const QString& code, - const QSet& classesWithNoQ ) -{ - static QString dataTypeFmt = - "(?!return)(?:const\\b\\s*)?[A-Za-z_]+(?:\\s*[*&])?"; - static QRegExp funcPrototypeRegExp( - "(" + dataTypeFmt + ")\\s*\\b([A-Z][a-zA-Z_0-9]*::)?" - "([a-z][a-zA-Z_0-9]*)\\(([^);]*)(\\)?)(?:\\s*const)?" ); - static QRegExp paramRegExp( - "^\\s*(" + dataTypeFmt + ")\\s*\\b([a-z][a-zA-Z_0-9]*)\\s*(,)?\\s*" ); - static QRegExp uninitVarRegExp( - "(" + dataTypeFmt + ")\\s*\\b([a-z][a-zA-Z_0-9]*);" ); - static QRegExp eqVarRegExp( - dataTypeFmt + "\\s*\\b([a-z][a-zA-Z_0-9]*)\\s*=(\\s*)(.*)" ); - static QRegExp ctorVarRegExp( - "(" + dataTypeFmt + ")\\s*\\b([a-z][a-zA-Z_0-9]*)\\((.*)\\);" ); - static QRegExp qdebugRegExp( - "q(?:Debug|Warning|Fatal)\\(\\s*(\"(?:\\\\.|[^\"])*\")\\s*" - "(?:,\\s*(\\S(?:[^,]*\\S)?))?\\s*\\);" ); - static QRegExp coutRegExp( "c(?:out|err)\\b(.*);" ); - static QRegExp lshiftRegExp( "\\s*<<\\s*" ); - static QRegExp endlRegExp( "^endl$" ); - - if ( code.isEmpty() || code == "{" || code == "}" ) - return code; - - QString result; - - if ( funcPrototypeRegExp.exactMatch(code) ) { - QString returnType = funcPrototypeRegExp.cap( 1 ); - QString className = funcPrototypeRegExp.cap( 2 ); - QString funcName = funcPrototypeRegExp.cap( 3 ); - QString params = funcPrototypeRegExp.cap( 4 ).trimmed(); - bool toBeContinued = funcPrototypeRegExp.cap( 5 ).isEmpty(); - // ### unused - Q_UNUSED(toBeContinued); - - className.replace( "::", "." ); - - result = "function " + className + funcName + "("; - - if ( !params.isEmpty() && params != "void" ) { - result += " "; - int i = funcPrototypeRegExp.pos( 4 ); - while ( (i = paramRegExp.indexIn(code, i, - QRegExp::CaretAtOffset)) != -1 ) { - QString dataType = paramRegExp.cap( 1 ); - QString paramName = paramRegExp.cap( 2 ); - QString comma = paramRegExp.cap( 3 ); - - result += paramName + " : " + - convertedDataType( qsTree, dataType ); - if ( comma.isEmpty() ) - break; - result += ", "; - i += paramRegExp.matchedLength(); - } - result += " "; - } - - result += ")"; - returnType = convertedDataType( qsTree, returnType ); - if ( !returnType.isEmpty() ) - result += " : " + returnType; - } else if ( uninitVarRegExp.exactMatch(code) ) { - QString dataType = uninitVarRegExp.cap( 1 ); - QString varName = uninitVarRegExp.cap( 2 ); - - result = "var " + varName; - dataType = convertedDataType( qsTree, dataType ); - if ( !dataType.isEmpty() ) - result += " : " + dataType; - result += ";"; - } else if ( eqVarRegExp.exactMatch(code) ) { - QString varName = eqVarRegExp.cap( 1 ); - QString value = eqVarRegExp.cap( 3 ); - - value = convertExpr( qsTree, value, classesWithNoQ ); - result += "var " + varName + " = " + value; - } else if ( ctorVarRegExp.exactMatch(code) ) { - QString dataType = ctorVarRegExp.cap( 1 ); - QString varName = ctorVarRegExp.cap( 2 ); - QString value = ctorVarRegExp.cap( 3 ).trimmed(); - - result += "var " + varName + " = "; - - dataType = convertedDataType( qsTree, dataType ); - value = convertExpr( qsTree, value, classesWithNoQ ); - - if ( dataType.isEmpty() || dataType == "String" ) { - if ( value.contains(",") ) { - result += "..."; - } else { - result += value; - } - } else { - result += "new " + dataType; - if ( !value.isEmpty() ) - result += "( " + value + " )"; - } - result += ";"; - } else if ( qdebugRegExp.exactMatch(code) ) { - QString fmt = qdebugRegExp.cap( 1 ); - QString arg1 = qdebugRegExp.cap( 2 ); - - result += "println "; - int i = 0; - while ( i < (int) fmt.length() ) { - if ( fmt[i] == '%' ) { - int percent = i; - i++; - while ( i < (int) fmt.length() && - QString("diouxXeEfFgGaAcsCSpn%\"").indexOf(fmt[i]) == -1 ) - i++; - if ( fmt[i] == '%' ) { - result += fmt[i++]; - } else if ( fmt[i] != '"' ) { - if ( percent == 1 ) { - result.truncate( result.length() - 1 ); - } else { - result += "\" + "; - } - i++; - if ( arg1.endsWith(".latin1()") ) - arg1.truncate( arg1.length() - 9 ); - result += arg1; - if ( i == (int) fmt.length() - 1 ) { - i++; - } else { - result += " + \""; - } - } - } else { - result += fmt[i++]; - } - } - result += ";"; - } else if ( coutRegExp.exactMatch(code) && - program.filter("var cout").isEmpty() ) { - QStringList args = coutRegExp.cap(1).split(lshiftRegExp); - args.replaceInStrings( endlRegExp, "\"\\n\"" ); - if ( args.last() == "\"\\n\"" ) { - args.erase( args.end() - 1 ); - if ( args.isEmpty() ) - args << "\"\""; - result += "println "; - } else { - result += "print "; - } - result += args.join( " + " ) + ";"; - } else { - result = convertExpr( qsTree, code, classesWithNoQ ); - } - return result; -} - -QString CppToQsConverter::convertComment( Tree * /* qsTree */, - const QString& comment, - const QSet& classesWithNoQ ) - -{ - QString result = comment; - - result.replace( "TRUE", "true" ); - result.replace( "FALSE", "false" ); - result.replace( addressOperatorRegExp, "\\1\\2" ); - result.replace( gulbrandsenRegExp, "." ); - - int i = 0; - while ( (i = result.indexOf(qClassRegExp, i)) != -1 ) { - if ( classesWithNoQ.contains(qClassRegExp.cap(1)) ) - result.remove( i, 1 ); - i++; - } - return result; -} - -QString CppToQsConverter::convertExpr( Tree *qsTree, const QString& expr, - const QSet& classesWithNoQ ) -{ - // suboptimal - return convertComment( qsTree, expr, classesWithNoQ ); -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/cpptoqsconverter.h b/tools/qdoc3/cpptoqsconverter.h deleted file mode 100644 index 001091b..0000000 --- a/tools/qdoc3/cpptoqsconverter.h +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - cpptoqsconverter.h -*/ - -#ifndef CPPTOQSCONVERTER_H -#define CPPTOQSCONVERTER_H - -#include - -#include "tree.h" - -QT_BEGIN_NAMESPACE - -class CppToQsConverter -{ -public: - CppToQsConverter() { } - - ClassNode *findClassNode( Tree *qsTree, const QString& qtName ); - QString convertedDataType( Tree *qsTree, const QString& leftType, - const QString& rightType = "" ); - QString convertedCode( Tree *qsTree, const QString& code, - const QSet& classesWithNoQ ); - - static void initialize( const Config& config ); - static void terminate(); - -private: - void clearState(); - QString convertCodeLine( Tree *qsTree, const QStringList& program, - const QString& code, - const QSet& classesWithNoQ ); - QString convertComment( Tree *qsTree, const QString& comment, - const QSet& classesWithNoQ ); - QString convertExpr( Tree *qsTree, const QString& expr, - const QSet& classesWithNoQ ); - void updateDelimDepths( const QString& code ); - - static QRegExp qClassRegExp; - static QRegExp addressOperatorRegExp; - static QRegExp gulbrandsenRegExp; - static int tabSize; -}; - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/dcfsection.cpp b/tools/qdoc3/dcfsection.cpp deleted file mode 100644 index ea10dbf..0000000 --- a/tools/qdoc3/dcfsection.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include - -#include "dcfsection.h" -#include "htmlgenerator.h" - -QT_BEGIN_NAMESPACE - -void appendDcfSubSection( DcfSection *dcfSect, const DcfSection& sub ) -{ - dcfSect->subsections.append( sub ); -} - -void appendDcfSubSections( DcfSection *dcfSect, const QList& subs ) -{ - dcfSect->subsections += subs; -} - -void generateDcfSubSections( QString indent, QTextStream& out, const DcfSection& sect ) -{ - QList::const_iterator ss = sect.subsections.constBegin(); - while ( ss != sect.subsections.constEnd() ) { - out << indent << "
\n"; - } else { - out << ">\n"; - QString indentIndent = indent + " "; - QList >::const_iterator k = (*ss).keywords.constBegin(); - while ( k != (*ss).keywords.constEnd() ) { - out << indentIndent << "" - << HtmlGenerator::protect((*k).first) << "\n"; - ++k; - } - - generateDcfSubSections( indentIndent, out, *ss ); - out << indent << "
\n"; - } - ++ss; - } - out.flush(); -} - -void generateDcfSections( const DcfSection& rootSect, const QString& fileName, - const QString& /* category */ ) -{ - QFile file(fileName); - if (!file.open(QFile::WriteOnly | QFile::Text)) - return ; - - QTextStream out(&file); - - QString icon = QFileInfo(fileName).baseName() + ".png"; - - out << "\n"; - out << "\n"; - - generateDcfSubSections( "", out, rootSect ); - - out << "\n"; - out.flush(); -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/dcfsection.h b/tools/qdoc3/dcfsection.h deleted file mode 100644 index 0318511..0000000 --- a/tools/qdoc3/dcfsection.h +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef DCFSECTION_H -#define DCFSECTION_H - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class QTextStream; - -struct DcfSection -{ - QString title; - QString ref; - QList > keywords; - QList subsections; -}; - -inline bool operator<( const DcfSection& s1, const DcfSection& s2 ) { - QString title1 = s1.title; - QString title2 = s2.title; - - // cheat with Q3 classes - if (title1.startsWith("Q3")) - title1.insert(1, '~'); - if (title2.startsWith("Q3")) - title2.insert(1, '~'); - - int delta = title1.toLower().compare( title2.toLower() ); - if ( delta == 0 ) { - delta = title1.compare( title2 ); - if ( delta == 0 ) - delta = s1.ref.localeAwareCompare( s2.ref ); - } - return delta < 0; -} - -inline bool operator>( const DcfSection& s1, const DcfSection& s2 ) { return s2 < s1; } -inline bool operator<=( const DcfSection& s1, const DcfSection& s2 ) { return !( s2 < s1 ); } -inline bool operator>=( const DcfSection& s1, const DcfSection& s2 ) { return !( s1 < s2 ); } -inline bool operator==( const DcfSection& s1, const DcfSection& s2 ) { return &s1 == &s2; } -inline bool operator!=( const DcfSection& s1, const DcfSection& s2 ) { return !( s1 == s2 ); } - -void appendDcfSubSection(DcfSection *dcfSect, const DcfSection &sub); -void appendDcfSubSections(DcfSection *dcfSect, const QList &subs); -void generateDcfSubSections(QString indent, QTextStream &out, const DcfSection §); -void generateDcfSections(const DcfSection &rootSect, const QString& fileName, - const QString& category ); - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 3f35f76..0cd534e 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -355,7 +355,7 @@ QString HtmlGenerator::format() } /*! - This is where the HTML and DCF files are written. + This is where the HTML files are written. \note The HTML file generation is done in the base class, PageGenerator::generateTree(). */ @@ -380,43 +380,6 @@ void HtmlGenerator::generateTree(const Tree *tree, CodeMarker *marker) PageGenerator::generateTree(tree, marker); - dcfClassesRoot.ref = "classes.html"; - dcfClassesRoot.title = "Classes"; - qSort(dcfClassesRoot.subsections); - - dcfOverviewsRoot.ref = "overviews.html"; - dcfOverviewsRoot.title = "Overviews"; - qSort(dcfOverviewsRoot.subsections); - - dcfExamplesRoot.ref = "examples.html"; - dcfExamplesRoot.title = "Tutorial & Examples"; - qSort(dcfExamplesRoot.subsections); - - DcfSection qtRoot; - appendDcfSubSection(&qtRoot, dcfClassesRoot); - appendDcfSubSection(&qtRoot, dcfOverviewsRoot); - appendDcfSubSection(&qtRoot, dcfExamplesRoot); - - generateDcf(project.toLower().simplified().replace(" ", "-"), - "index.html", - projectDescription, qtRoot); - generateDcf("designer", - "designer-manual.html", - "Qt Designer Manual", - dcfDesignerRoot); - generateDcf("linguist", - "linguist-manual.html", - "Qt Linguist Manual", - dcfLinguistRoot); - generateDcf("assistant", - "assistant-manual.html", - "Qt Assistant Manual", - dcfAssistantRoot); - generateDcf("qmake", - "qmake-manual.html", - "qmake Manual", - dcfQmakeRoot); - QString fileBase = project.toLower().simplified().replace(" ", "-"); generateIndex(fileBase, projectUrl, projectDescription); generatePageIndex(outputDir() + "/" + fileBase + ".pageindex", marker); @@ -1253,11 +1216,6 @@ void HtmlGenerator::generateClassLikeNode(const InnerNode *inner, title = rawTitle + " Class Reference"; } - DcfSection classSection; - classSection.title = title; - classSection.ref = linkForNode(inner, 0); - classSection.keywords += qMakePair(inner->name(), classSection.ref); - Text subtitleText; if (rawTitle != fullTitle) subtitleText << "(" << Atom(Atom::AutoLink, fullTitle) << ")" @@ -1420,8 +1378,6 @@ void HtmlGenerator::generateClassLikeNode(const InnerNode *inner, names << plainCode(marker->markedUpEnumValue(enumName, enume)); } - foreach (const QString &name, names) - classSection.keywords += qMakePair(name,linkForNode(*m,0)); } ++m; } @@ -1430,27 +1386,6 @@ void HtmlGenerator::generateClassLikeNode(const InnerNode *inner, ++s; } generateFooter(inner); - - if (!membersLink.isEmpty()) { - DcfSection membersSection; - membersSection.title = "List of all members"; - membersSection.ref = membersLink; - appendDcfSubSection(&classSection, membersSection); - } - if (!obsoleteLink.isEmpty()) { - DcfSection obsoleteSection; - obsoleteSection.title = "Obsolete members"; - obsoleteSection.ref = obsoleteLink; - appendDcfSubSection(&classSection, obsoleteSection); - } - if (!compatLink.isEmpty()) { - DcfSection compatSection; - compatSection.title = "Qt 3 support members"; - compatSection.ref = compatLink; - appendDcfSubSection(&classSection, compatSection); - } - - appendDcfSubSection(&dcfClassesRoot, classSection); } /*! @@ -1460,9 +1395,6 @@ void HtmlGenerator::generateClassLikeNode(const InnerNode *inner, void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) { SubTitleSize subTitleSize = LargeSubTitle; - DcfSection fakeSection; - fakeSection.title = fake->fullTitle(); - fakeSection.ref = linkForNode(fake, 0); QList
sections; QList
::const_iterator s; @@ -1542,25 +1474,6 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) << "Qt 3 support members\n"; out() << "\n"; - - if (!membersLink.isEmpty()) { - DcfSection membersSection; - membersSection.title = "List of all members"; - membersSection.ref = membersLink; - appendDcfSubSection(&fakeSection, membersSection); - } - if (!obsoleteLink.isEmpty()) { - DcfSection obsoleteSection; - obsoleteSection.title = "Obsolete members"; - obsoleteSection.ref = obsoleteLink; - appendDcfSubSection(&fakeSection, obsoleteSection); - } - if (!compatLink.isEmpty()) { - DcfSection compatSection; - compatSection.title = "Qt 3 support members"; - compatSection.ref = compatLink; - appendDcfSubSection(&fakeSection, compatSection); - } } #ifdef QDOC_QML else if (fake->subType() == Node::QmlClass) { @@ -1603,8 +1516,6 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) while (m != (*s).members.end()) { generateDetailedQmlMember(*m, fake, marker); out() << "
\n"; - fakeSection.keywords += qMakePair((*m)->name(), - linkForNode(*m,0)); ++m; } ++s; @@ -1649,8 +1560,6 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) generateAnnotatedList(fake, marker, groupMembersMap); } - fakeSection.keywords += qMakePair(fakeSection.title, fakeSection.ref); - sections = marker->sections(fake, CodeMarker::Detailed, CodeMarker::Okay); s = sections.begin(); while (s != sections.end()) { @@ -1660,35 +1569,11 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) NodeList::ConstIterator m = (*s).members.begin(); while (m != (*s).members.end()) { generateDetailedMember(*m, fake, marker); - fakeSection.keywords += qMakePair((*m)->name(), linkForNode(*m, 0)); ++m; } ++s; } generateFooter(fake); - - if (fake->subType() == Node::Example) { - appendDcfSubSection(&dcfExamplesRoot, fakeSection); - } - else if (fake->subType() != Node::File) { - QString contentsPage = fake->links().value(Node::ContentsLink).first; - - if (contentsPage == "Qt Designer Manual") { - appendDcfSubSection(&dcfDesignerRoot, fakeSection); - } - else if (contentsPage == "Qt Linguist Manual") { - appendDcfSubSection(&dcfLinguistRoot, fakeSection); - } - else if (contentsPage == "Qt Assistant Manual") { - appendDcfSubSection(&dcfAssistantRoot, fakeSection); - } - else if (contentsPage == "qmake Manual") { - appendDcfSubSection(&dcfQmakeRoot, fakeSection); - } - else { - appendDcfSubSection(&dcfOverviewsRoot, fakeSection); - } - } } /*! @@ -3464,10 +3349,7 @@ QString HtmlGenerator::linkForNode(const Node *node, const Node *relative) fn = fileName(node); /* if (!node->url().isEmpty()) return fn;*/ -#if 0 - // ### reintroduce this test, without breaking .dcf files - if (fn != outFileName()) -#endif + link += fn; if (!node->isInnerNode() || node->subType() == Node::QmlPropertyGroup) { @@ -3959,16 +3841,6 @@ QString HtmlGenerator::getLink(const Atom *atom, return link; } -void HtmlGenerator::generateDcf(const QString &fileBase, - const QString &startPage, - const QString &title, - DcfSection &dcfRoot) -{ - dcfRoot.ref = startPage; - dcfRoot.title = title; - generateDcfSections(dcfRoot, outputDir() + "/" + fileBase + ".dcf", fileBase + "/reference"); -} - void HtmlGenerator::generateIndex(const QString &fileBase, const QString &url, const QString &title) diff --git a/tools/qdoc3/htmlgenerator.h b/tools/qdoc3/htmlgenerator.h index 1b3de9e..c0a4ce8 100644 --- a/tools/qdoc3/htmlgenerator.h +++ b/tools/qdoc3/htmlgenerator.h @@ -52,7 +52,6 @@ #include "codemarker.h" #include "config.h" -#include "dcfsection.h" #include "pagegenerator.h" QT_BEGIN_NAMESPACE @@ -253,9 +252,6 @@ class HtmlGenerator : public PageGenerator const Node *relative, CodeMarker *marker, const Node** node); - virtual void generateDcf(const QString &fileBase, - const QString &startPage, - const QString &title, DcfSection &dcfRoot); virtual void generateIndex(const QString &fileBase, const QString &url, const QString &title); @@ -282,13 +278,6 @@ class HtmlGenerator : public PageGenerator #endif QMap refMap; int codeIndent; - DcfSection dcfClassesRoot; - DcfSection dcfOverviewsRoot; - DcfSection dcfExamplesRoot; - DcfSection dcfDesignerRoot; - DcfSection dcfLinguistRoot; - DcfSection dcfAssistantRoot; - DcfSection dcfQmakeRoot; HelpProjectWriter *helpProjectWriter; bool inLink; bool inObsoleteLink; diff --git a/tools/qdoc3/jambiapiparser.cpp b/tools/qdoc3/jambiapiparser.cpp deleted file mode 100644 index 23f2716..0000000 --- a/tools/qdoc3/jambiapiparser.cpp +++ /dev/null @@ -1,546 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - jambiapiparser.cpp -*/ - -#include "cppcodeparser.h" -#include "jambiapiparser.h" -#include "node.h" -#include "tree.h" - -QT_BEGIN_NAMESPACE - -static const char USED_INTERNALLY[] = ""; - -static Text textWithFixedBrief(const Text &text, const Text &beforeBrief, - const Text &afterBrief) -{ - Text result; - - const Atom *atom = text.firstAtom(); - while (atom) { - if (atom->type() == Atom::BriefLeft) { - result << Atom::ParaLeft << beforeBrief; - } else if (atom->type() == Atom::BriefRight) { - result << afterBrief << Atom::ParaRight; - } else { - result << *atom; - } - atom = atom->next(); - } - - return result; -} - -static void setPass1JambifiedDoc(Node *javaNode, const Node *cppNode, const QString &qName = "") -{ - Doc newDoc(cppNode->doc()); - - if (javaNode->type() == Node::Function) { - const FunctionNode *javaFunc = static_cast(javaNode); - if (cppNode->type() == Node::Function) { - const FunctionNode *cppFunc = static_cast(cppNode); - if (const PropertyNode *property = cppFunc->associatedProperty()) { - newDoc = property->doc(); - Text text(newDoc.body()); - - Node *mutableCppNode = const_cast(cppNode); - if (property->getters().contains(mutableCppNode)) { - text = textWithFixedBrief(text, Text("Returns "), Text(".")); - } else if (property->setters().contains(mutableCppNode)) { - Text afterBrief; - if (javaFunc->parameterNames().count() == 1 - && !javaFunc->parameterNames().first().isEmpty()) { - afterBrief << " to " - << Atom(Atom::FormattingLeft, ATOM_FORMATTING_PARAMETER) - << javaFunc->parameterNames().first() - << Atom(Atom::FormattingRight, ATOM_FORMATTING_PARAMETER); - } - afterBrief << "."; - text = textWithFixedBrief(text, Text("Sets "), afterBrief); - } else if (property->resetters().contains(mutableCppNode)) { - text = textWithFixedBrief(text, Text("Resets "), Text(".")); - } - - newDoc.setBody(text); - } else { - QStringList javaParams = javaFunc->parameterNames(); - QStringList cppParams = cppFunc->parameterNames(); - newDoc.renameParameters(cppParams, javaParams); - - if (cppNode->access() == Node::Private) { - Text text; - text << Atom::ParaLeft; - if (cppFunc->reimplementedFrom()) { - text << "This function is reimplemented for internal reasons."; - } else { - text << USED_INTERNALLY; - } - text << Atom::ParaRight; - newDoc.setBody(text); - } - } - } else if (cppNode->type() == Node::Variable) { - Text text(newDoc.body()); - - if (qName == "variablegetter") { - text = textWithFixedBrief(text, Text("Returns "), Text(".")); - } else if (qName == "variablesetter") { - Text afterBrief; - if (javaFunc->parameterNames().count() == 1 - && !javaFunc->parameterNames().first().isEmpty()) { - afterBrief << " to " - << Atom(Atom::FormattingLeft, ATOM_FORMATTING_PARAMETER) - << javaFunc->parameterNames().first() - << Atom(Atom::FormattingRight, ATOM_FORMATTING_PARAMETER); - } - afterBrief << "."; - text = textWithFixedBrief(text, Text("Sets "), afterBrief); - } - - newDoc.setBody(text); - } - } else { // ### enum value names? - - } - - javaNode->setDoc(newDoc, true); -} - -static void setStatus(Node *javaNode, const Node *cppNode) -{ - if (cppNode->status() == Node::Compat) { - javaNode->setStatus(Node::Obsolete); - } else { - javaNode->setStatus(cppNode->status()); - } -} - -static Text findEnumText(Node *javaEnum, const QString &enumItemName) -{ - const Text &body = javaEnum->doc().body(); - const Atom *atom = body.firstAtom(); - while (atom) { - if (atom->type() == Atom::ListTagLeft && atom->string() == ATOM_LIST_VALUE) { - atom = atom->next(); - if (atom) { - // ### paras? - if (atom->string() == enumItemName) - return body.subText(Atom::ListItemLeft, Atom::ListItemRight, atom); - } - } else { - atom = atom->next(); - } - } - return Text(); -} - -JambiApiParser::JambiApiParser(Tree *cppTree) - : cppTre(cppTree), javaTre(0), metJapiTag(false) -{ -} - -JambiApiParser::~JambiApiParser() -{ -} - -void JambiApiParser::initializeParser(const Config &config) -{ - CodeParser::initializeParser(config); -} - -void JambiApiParser::terminateParser() -{ - CodeParser::terminateParser(); -} - -QString JambiApiParser::language() -{ - return "Java"; -} - -QString JambiApiParser::sourceFileNameFilter() -{ - return "*.japi"; -} - -void JambiApiParser::parseSourceFile(const Location &location, const QString &filePath, Tree *tree) -{ - javaTre = tree; - metJapiTag = false; - - QXmlSimpleReader reader; - reader.setContentHandler(this); - reader.setErrorHandler(this); - - QFile file(filePath); - if (!file.open(QFile::ReadOnly)) { - location.warning(tr("Cannot open JAPI file '%1'").arg(filePath)); - return; - } - - japiLocation = Location(filePath); - QXmlInputSource xmlSource(&file); - reader.parse(xmlSource); -} - -void JambiApiParser::doneParsingSourceFiles(Tree * /* tree */) -{ - /* - Also import the overview documents. - */ - foreach (Node *cppNode, cppTre->root()->childNodes()) { - if (cppNode->type() == Node::Fake) { - FakeNode *cppFake = static_cast(cppNode); - if (cppFake->subType() == Node::Page) { - FakeNode *javaFake = new FakeNode(javaTre->root(), - cppFake->name(), - cppFake->subType()); - javaFake->setModuleName("com.trolltech.qt"); // ### hard-coded - javaFake->setTitle(cppFake->title()); - javaFake->setSubTitle(cppFake->subTitle()); - setStatus(javaFake, cppFake); - setPass1JambifiedDoc(javaFake, cppFake); - } - } - } - - /* - Fix the docs. - */ - if (javaTre) { - javaTre->resolveInheritance(); - jambifyDocsPass2(javaTre->root()); - javaTre = 0; - } -} - -bool JambiApiParser::startElement(const QString & /* namespaceURI */, - const QString & /* localName */, - const QString &qName, - const QXmlAttributes &attributes) -{ - if (!metJapiTag && qName != "japi") { - // ### The file is not a JAPI file. - return true; - } - metJapiTag = true; - - EnumNode *javaEnum = 0; - EnumNode *cppEnum = 0; - InnerNode *javaParent = javaTre->root(); - InnerNode *cppParent = cppTre->root(); - - for (int i = 0; i < classAndEnumStack.count(); ++i) { - const ClassOrEnumInfo &info = classAndEnumStack.at(i); - if (info.cppNode) { - if (info.cppNode->type() == Node::Enum) { - Q_ASSERT(info.javaNode->type() == Node::Enum); - javaEnum = static_cast(info.javaNode); - cppEnum = static_cast(info.cppNode); - } else { - Q_ASSERT(info.javaNode->type() == Node::Class - || info.javaNode->type() == Node::Namespace); - javaParent = static_cast(info.javaNode); - cppParent = static_cast(info.cppNode); - } - } - } - - if (qName == "class" || qName == "enum") { - Node::Type type = (qName == "class") ? Node::Class : Node::Enum; - - QString javaExtends = attributes.value("java-extends"); - QString javaImplements = attributes.value("javaimplements"); - - ClassOrEnumInfo info; - info.tag = qName; - info.javaName = attributes.value("java"); - info.cppName = attributes.value("cpp"); - info.cppNode = cppTre->findNode(info.cppName.split("::"), type, cppParent); - if (!info.cppNode && type == Node::Class) { - type = Node::Namespace; - info.cppNode = cppTre->findNode(info.cppName.split("::"), type, cppParent); - } - - if (!info.cppNode) { - japiLocation.warning(tr("Cannot find C++ class or enum '%1'").arg(info.cppName)); - } else { - if (qName == "class") { - ClassNode *javaClass = new ClassNode(javaParent, info.javaName); - javaClass->setModuleName(attributes.value("package")); - if (!javaExtends.isEmpty()) - javaTre->addBaseClass(javaClass, Node::Public, javaExtends.split('.'), - javaExtends); - if (!javaImplements.isEmpty()) - javaTre->addBaseClass(javaClass, Node::Public, javaImplements.split('.'), - javaExtends); - - info.javaNode = javaClass; - } else { - info.javaNode = new EnumNode(javaParent, info.javaName); - } - info.javaNode->setLocation(japiLocation); - setStatus(info.javaNode, info.cppNode); - - setPass1JambifiedDoc(info.javaNode, info.cppNode); - } - classAndEnumStack.push(info); - } else if (qName == "method" || qName == "signal") { - QString javaSignature = attributes.value("java"); - if (javaSignature.startsWith("private")) - return true; - - QString cppSignature = attributes.value("cpp"); - - CppCodeParser cppParser; - const FunctionNode *cppNode = cppParser.findFunctionNode(cppSignature, cppTre, - cppParent, - true /* fuzzy */); - if (!cppNode) { - bool quiet = false; - - /* - Default constructors sometimes don't exist in C++. - */ - if (!quiet && javaSignature == "public " + javaParent->name() + "()") - quiet = true; - - if (!quiet) - japiLocation.warning(tr("Cannot find C++ function '%1' ('%2')") - .arg(cppSignature).arg(cppParent->name())); - } - - FunctionNode *javaNode; - if (makeFunctionNode(javaParent, javaSignature, &javaNode)) { - javaNode->setLocation(japiLocation); - if (qName == "signal") - javaNode->setMetaness(FunctionNode::Signal); - - if (cppNode) { - setStatus(javaNode, cppNode); - - int overloadNo = cppNode->parameters().count() - javaNode->parameters().count() + 1; - if (overloadNo == 1) { - setPass1JambifiedDoc(javaNode, cppNode); - } else { - Text text; - - text << Atom::ParaLeft << "Equivalent to " - << Atom(Atom::Link, javaNode->name() + "()") - << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK) - << javaNode->name() - << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK) - << "("; - - for (int i = 0; i < cppNode->parameters().count(); ++i) { - if (i > 0) - text << ", "; - if (i < javaNode->parameters().count()) { - text << Atom(Atom::FormattingLeft, ATOM_FORMATTING_PARAMETER) - << javaNode->parameters().at(i).name() - << Atom(Atom::FormattingRight, ATOM_FORMATTING_PARAMETER); - } else { - // ### convert to Java - text << cppNode->parameters().at(i).defaultValue(); - } - } - - text << ")."; - - Doc doc; - doc.setBody(text); - javaNode->setDoc(doc, true); - } - javaNode->setOverload(overloadNo > 1); - } - } - } else if (qName == "variablesetter" || qName == "variablegetter") { - QString javaSignature = attributes.value("java"); - if (javaSignature.startsWith("private")) - return true; - - QString cppVariable = attributes.value("cpp"); - - VariableNode *cppNode = static_cast(cppParent->findNode(cppVariable, - Node::Variable)); - FunctionNode *javaNode; - if (makeFunctionNode(javaParent, javaSignature, &javaNode)) { - javaNode->setLocation(japiLocation); - - if (!cppNode) { -#if 0 - japiLocation.warning(tr("Cannot find C++ variable '%1' ('%2')") - .arg(cppVariable).arg(cppParent->name())); -#endif - javaNode->setDoc(Doc(japiLocation, japiLocation, - USED_INTERNALLY, - QSet()), true); - } else { - setPass1JambifiedDoc(javaNode, cppNode, qName); - setStatus(javaNode, cppNode); - } - } - } else if (qName == "enum-value") { - QString javaName = attributes.value("java"); - QString cppName = attributes.value("cpp"); - QString value = attributes.value("value"); - - if (javaEnum) { - EnumItem item(javaName, value, findEnumText(javaEnum, javaName)); - javaEnum->addItem(item); - } - } - - return true; -} - -bool JambiApiParser::endElement(const QString & /* namespaceURI */, - const QString & /* localName */, - const QString &qName) -{ - if (qName == "class" || qName == "enum") - classAndEnumStack.pop(); - return true; -} - -bool JambiApiParser::fatalError(const QXmlParseException &exception) -{ - japiLocation.setLineNo(exception.lineNumber()); - japiLocation.setColumnNo(exception.columnNumber()); - japiLocation.warning(tr("Syntax error in JAPI file (%1)").arg(exception.message())); - return true; -} - -void JambiApiParser::jambifyDocsPass2(Node *node) -{ - const Doc &doc = node->doc(); - if (!doc.isEmpty()) { - if (node->type() == Node::Enum) { - Doc newDoc(doc); - newDoc.simplifyEnumDoc(); - node->setDoc(newDoc, true); - } - } - - if (node->isInnerNode()) { - InnerNode *innerNode = static_cast(node); - foreach (Node *child, innerNode->childNodes()) - jambifyDocsPass2(child); - } -} - -bool JambiApiParser::makeFunctionNode(InnerNode *parent, const QString &synopsis, - FunctionNode **funcPtr) -{ - Node::Access access = Node::Public; - FunctionNode::Metaness metaness = FunctionNode::Plain; - bool final = false; - bool statique = false; - - QString mySynopsis = synopsis.simplified(); - int oldLen; - do { - oldLen = mySynopsis.length(); - - if (mySynopsis.startsWith("public ")) { - mySynopsis.remove(0, 7); - access = Node::Public; - } - if (mySynopsis.startsWith("protected ")) { - mySynopsis.remove(0, 10); - access = Node::Protected; - } - if (mySynopsis.startsWith("private ")) { - mySynopsis.remove(0, 8); - access = Node::Private; - } - if (mySynopsis.startsWith("native ")) { - mySynopsis.remove(0, 7); - metaness = FunctionNode::Native; - } - if (mySynopsis.startsWith("final ")) { - mySynopsis.remove(0, 6); - final = true; - } - if (mySynopsis.startsWith("static ")) { - mySynopsis.remove(0, 7); - statique = true; - } - } while (oldLen != mySynopsis.length()); - - // method or constructor - QRegExp funcRegExp("(?:(.*) )?([A-Za-z_0-9]+)\\((.*)\\)"); - if (!funcRegExp.exactMatch(mySynopsis)) - return false; - - QString retType = funcRegExp.cap(1); - QString funcName = funcRegExp.cap(2); - QStringList params = funcRegExp.cap(3).split(","); - - FunctionNode *func = new FunctionNode(parent, funcName); - func->setReturnType(retType); - func->setAccess(access); - func->setStatic(statique); - func->setConst(final); - func->setMetaness(metaness); - - QRegExp paramRegExp(" ?([^ ].*) ([A-Za-z_0-9]+) ?"); - - foreach (const QString ¶m, params) { - if (paramRegExp.exactMatch(param)) { - func->addParameter(Parameter(paramRegExp.cap(1), "", paramRegExp.cap(2))); - } else { - // problem - } - } - - if (funcPtr) { - *funcPtr = func; - } else if (!parent) { - delete func; - } - return true; -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/jambiapiparser.h b/tools/qdoc3/jambiapiparser.h deleted file mode 100644 index ecfaab5..0000000 --- a/tools/qdoc3/jambiapiparser.h +++ /dev/null @@ -1,99 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - jambiapiparser.h -*/ - -#ifndef JAMBIAPIPARSER_H -#define JAMBIAPIPARSER_H - -#include -#include - -#include "codeparser.h" - -QT_BEGIN_NAMESPACE - -struct ClassOrEnumInfo -{ - QString tag; - QString javaName; - QString cppName; - Node *javaNode; - Node *cppNode; - - ClassOrEnumInfo() : javaNode(0), cppNode(0) {} -}; - -class JambiApiParser : public CodeParser, private QXmlDefaultHandler -{ -public: - JambiApiParser(Tree *cppTree); - ~JambiApiParser(); - - void initializeParser(const Config &config); - void terminateParser(); - QString language(); - QString sourceFileNameFilter(); - void parseSourceFile(const Location &location, const QString &filePath, Tree *tree); - virtual void doneParsingSourceFiles(Tree *tree); - -private: - bool startElement(const QString &namespaceURI, const QString &localName, - const QString &qName, const QXmlAttributes &attributes); - bool endElement(const QString &namespaceURI, const QString &localName, - const QString &qName); - bool fatalError(const QXmlParseException &exception); - void jambifyDocsPass2(Node *node); - bool makeFunctionNode(InnerNode *parent, const QString &synopsis, FunctionNode **funcPtr); - - Tree *cppTre; - Tree *javaTre; - - bool metJapiTag; - Location japiLocation; - QStack classAndEnumStack; -}; - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/javacodemarker.cpp b/tools/qdoc3/javacodemarker.cpp deleted file mode 100644 index c9a8f60..0000000 --- a/tools/qdoc3/javacodemarker.cpp +++ /dev/null @@ -1,203 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - javacodemarker.cpp -*/ - -#include "javacodemarker.h" -#include "node.h" -#include "text.h" -#include "tree.h" - -QT_BEGIN_NAMESPACE - -JavaCodeMarker::JavaCodeMarker() -{ -} - -JavaCodeMarker::~JavaCodeMarker() -{ -} - -bool JavaCodeMarker::recognizeCode( const QString& /* code */ ) -{ - return true; -} - -bool JavaCodeMarker::recognizeExtension( const QString& ext ) -{ - return ext == "java"; -} - -bool JavaCodeMarker::recognizeLanguage( const QString& lang ) -{ - return lang == "Java"; -} - -QString JavaCodeMarker::plainName( const Node *node ) -{ - return node->name(); -} - -QString JavaCodeMarker::plainFullName( const Node *node, const Node * /* relative */ ) -{ - if (!node) - return QString(); - - QString fullName; - for ( ;; ) { - fullName.prepend( plainName(node) ); - if ( node->parent() && node->parent()->name().isEmpty() ) - break; - node = node->parent(); - if (!node) - break; - fullName.prepend("."); - } - return fullName; -} - -QString JavaCodeMarker::markedUpCode( const QString& code, - const Node * /* relative */, - const QString& /* dirPath */ ) -{ - return protect( code ); -} - -QString JavaCodeMarker::markedUpSynopsis(const Node * /* node */, - const Node * /* relative */, - SynopsisStyle /* style */) -{ - return QString(); -} - -QString JavaCodeMarker::markedUpName( const Node *node ) -{ - return linkTag(node, taggedNode(node)); -} - -QString JavaCodeMarker::markedUpFullName(const Node *node, const Node * /* relative */ ) -{ - QString fullName; - for ( ;; ) { - fullName.prepend( markedUpName(node) ); - if ( node->parent()->name().isEmpty() ) - break; - node = node->parent(); - fullName.prepend( "." ); - } - return fullName; -} - -QString JavaCodeMarker::markedUpEnumValue(const QString &enumValue, - const Node * /* relative */) -{ - return protect(enumValue); -} - -QString JavaCodeMarker::markedUpIncludes( const QStringList& /* includes */ ) -{ - return QString(); -} - -QString JavaCodeMarker::functionBeginRegExp( const QString& /* funcName */) -{ - return "^x$"; // ### invalid regexp -} - -QString JavaCodeMarker::functionEndRegExp( const QString& /* funcName */ ) -{ - return "^}"; -} - -QList
JavaCodeMarker::sections(const InnerNode * /* inner */, SynopsisStyle /* style */, - Status /* status */) -{ - return QList
(); -} - -const Node *JavaCodeMarker::resolveTarget(const QString &target, - const Tree *tree, - const Node *relative, - const Node* /* self */) -{ - if (target.endsWith("()")) { - const FunctionNode *func; - QString funcName = target; - funcName.chop(2); - - QStringList path = funcName.split('.'); - if ((func = tree->findFunctionNode(path, relative, Tree::SearchBaseClasses))) - return func; - } else if (target.contains("#")) { - int hashAt = target.indexOf("#"); - QString link = target.left(hashAt); - QString ref = target.mid(hashAt + 1); - const Node *node; - if (link.isEmpty()) { - node = relative; - } else { - QStringList path(link); - node = tree->findNode(path, tree->root(), Tree::SearchBaseClasses); - } - if (node && node->isInnerNode()) { - const Atom *atom = node->doc().body().firstAtom(); - while (atom) { - if (atom->type() == Atom::Target && atom->string() == ref) { - Node *parentNode = const_cast(node); - return new TargetNode(static_cast(parentNode), - ref); - } - atom = atom->next(); - } - } - } else { - QStringList path = target.split('.'); - const Node *node; - if ((node = tree->findNode(path, relative, - Tree::SearchBaseClasses | Tree::SearchEnumValues))) - return node; - } - return 0; -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/javacodemarker.h b/tools/qdoc3/javacodemarker.h deleted file mode 100644 index c2aabc0..0000000 --- a/tools/qdoc3/javacodemarker.h +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - javacodemarker.h -*/ - -#ifndef JAVACODEMARKER_H -#define JAVACODEMARKER_H - -#include "codemarker.h" - -QT_BEGIN_NAMESPACE - -class JavaCodeMarker : public CodeMarker -{ -public: - JavaCodeMarker(); - ~JavaCodeMarker(); - - bool recognizeCode( const QString& code ); - bool recognizeExtension( const QString& ext ); - bool recognizeLanguage( const QString& lang ); - QString plainName(const Node *node); - QString plainFullName(const Node *node, const Node *relative); - QString markedUpCode( const QString& code, const Node *relative, - const QString& dirPath ); - QString markedUpSynopsis( const Node *node, const Node *relative, - SynopsisStyle style ); - QString markedUpName( const Node *node ); - QString markedUpFullName( const Node *node, const Node *relative ); - QString markedUpEnumValue(const QString &enumValue, const Node *relative); - QString markedUpIncludes( const QStringList& includes ); - QList
sections(const InnerNode *innerNode, SynopsisStyle style, Status status); - QString functionBeginRegExp( const QString& funcName ); - QString functionEndRegExp( const QString& funcName ); - const Node* resolveTarget( const QString& target, - const Tree* tree, - const Node* relative, - const Node* self = 0 ); -}; - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/javadocgenerator.cpp b/tools/qdoc3/javadocgenerator.cpp deleted file mode 100644 index eb9c1c9..0000000 --- a/tools/qdoc3/javadocgenerator.cpp +++ /dev/null @@ -1,454 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "javadocgenerator.h" - -QT_BEGIN_NAMESPACE - -enum JavaSignatureSyntax { - GeneratedJdocFile, - JavadocRef, - SlotSignature -}; - -static QString javaSignature(const FunctionNode *func, JavaSignatureSyntax syntax, - int maxParams = 65535) -{ - maxParams = qMin(maxParams, func->parameters().count()); - - QString result; - - if (syntax == GeneratedJdocFile) { - if (func->access() == Node::Public) { - result += "public "; - } else if (func->access() == Node::Protected) { - result += "protected "; - } else { - result += "private "; - } - - if (func->metaness() == FunctionNode::Native) - result += "native "; - - if (func->isConst()) - result += "final "; - - // ### func->metaness() == FunctionNode::Abstract - - if (func->isStatic()) - result += "static "; - - if (!func->returnType().isEmpty()) { - result += func->returnType(); - result += ' '; - } - } - - if (syntax == SlotSignature) { - result += "void mySlot"; - } else { - result += func->name(); - } - result += '('; - for (int i = 0; i < maxParams; ++i) { - if (i != 0) - result += ", "; - result += func->parameters().at(i).leftType(); - if (syntax != JavadocRef) { - result += ' '; - result += func->parameters().at(i).name(); - } - } - result += ')'; - - return result; -} - -static QString packageName(const Node *node) -{ - while (node && node->type() != Node::Class && node->type() != Node::Fake) - node = node->parent(); - if (!node) - return QString(); - return node->moduleName(); -} - -JavadocGenerator::JavadocGenerator() - : oldDevice(0), currentDepth(0) -{ -} - -JavadocGenerator::~JavadocGenerator() -{ -} - -void JavadocGenerator::initializeGenerator(const Config &config) -{ - HtmlGenerator::initializeGenerator(config); - - formattingLeftMap().insert(ATOM_FORMATTING_PARAMETER, - formattingLeftMap().value(ATOM_FORMATTING_TELETYPE)); - formattingRightMap().insert(ATOM_FORMATTING_PARAMETER, - formattingRightMap().value(ATOM_FORMATTING_TELETYPE)); -} - -void JavadocGenerator::terminateGenerator() -{ - HtmlGenerator::terminateGenerator(); -} - -QString JavadocGenerator::format() -{ - return "javadoc"; -} - -void JavadocGenerator::generateTree(const Tree *tree, CodeMarker *marker) -{ - HtmlGenerator::generateTree(tree, marker); -} - -QString JavadocGenerator::fileExtension(const Node *node) const -{ - if (node->type() == Node::Fake) { - return "html"; - } else { - return "jdoc"; - } -} - -QString JavadocGenerator::typeString(const Node *node) -{ - if (node->type() == Node::Function) { - const FunctionNode *func = static_cast(node); - return func->metaness() == FunctionNode::Signal ? "signal" : "method"; - } else { - return HtmlGenerator::typeString(node); - } -} - -QString JavadocGenerator::imageFileName(const Node *relative, const QString& fileBase) -{ - QString result = HtmlGenerator::imageFileName(relative, fileBase); - if (!result.isEmpty()) { - QString package = packageName(relative); - int numSubPackages = package.count('.') - 2; - while (numSubPackages > 0) { - result.prepend("%2E%2E/"); // javadoc 1.5.0_06 chokes on '../' - --numSubPackages; - } - } - return result; -} - -static int textDepth = 0; - -void JavadocGenerator::startText(const Node *relative, CodeMarker *marker) -{ - if (textDepth++ == 0 && relative->type() != Node::Fake) { - Q_ASSERT(!oldDevice); - oldDevice = out().device(); - Q_ASSERT(oldDevice); - out().setString(&buffer); - } - HtmlGenerator::startText(relative, marker); -} - -void JavadocGenerator::endText(const Node *relative, CodeMarker *marker) -{ - HtmlGenerator::endText(relative, marker); - if (--textDepth == 0 && relative->type() != Node::Fake) { - Q_ASSERT(oldDevice); - out().setDevice(oldDevice); - oldDevice = 0; - - /* - Need to escape XML metacharacters in .jdoc files. - */ - buffer.replace("*/", "*<!-- noop -->/"); - buffer.replace("&", "&"); - buffer.replace("\"", """); - buffer.replace("<", "<"); - buffer.replace(">", ">"); - out() << buffer; - buffer.clear(); - } -} - -int JavadocGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMarker *marker) -{ - return HtmlGenerator::generateAtom(atom, relative, marker); -} - -void JavadocGenerator::generateClassLikeNode(const InnerNode *inner, CodeMarker *marker) -{ - generateIndent(); - out() << "name()) << "\""; - generateDoc(inner, marker); - out() << ">\n"; - - ++currentDepth; - foreach (Node *node, inner->childNodes()) { - if (node->isInnerNode()) { - generateClassLikeNode(static_cast(node), marker); - } else { - if (node->type() == Node::Enum) { - EnumNode *enume = static_cast(node); - - generateIndent(); - out() << "name()) << "\""; - generateDoc(node, marker); - out() << ">\n"; - - ++currentDepth; - const QList &items = enume->items(); - for (int i = 0; i < items.count(); ++i) { - const EnumItem &item = items.at(i); - generateIndent(); - out() << "\n"; - } - --currentDepth; - - out() << "\n"; - } else if (node->type() == Node::Function) { - FunctionNode *func = static_cast(node); - generateIndent(); - out() << (func->metaness() == FunctionNode::Signal ? "\n"; - } - } - } - --currentDepth; - - generateIndent(); - out() << "\n"; -} - -void JavadocGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) -{ - HtmlGenerator::generateFakeNode(fake, marker); -} - -bool JavadocGenerator::generateText(const Text& text, const Node *relative, CodeMarker *marker) -{ - HtmlGenerator::generateText(text, relative, marker); - return true; -} - -void JavadocGenerator::generateBody(const Node *node, CodeMarker *marker) -{ - generateText(node->doc().body(), node, marker); -} - -void JavadocGenerator::generateAlsoList( const Node *node, CodeMarker *marker ) -{ - QList alsoList = node->doc().alsoList(); - supplementAlsoList(node, alsoList); - - if (node->type() == Node::Fake - || (node->type() == Node::Function - && static_cast(node)->metaness() == FunctionNode::Signal)) { - Text text; - - if (!alsoList.isEmpty()) { - text << Atom(Atom::ListLeft, ATOM_LIST_TAG) - << Atom(Atom::ListTagLeft, ATOM_LIST_TAG) - << Atom(Atom::FormattingLeft, ATOM_FORMATTING_BOLD) - << "See Also:" - << Atom(Atom::FormattingRight, ATOM_FORMATTING_BOLD) - << Atom(Atom::ListTagRight, ATOM_LIST_TAG) - << Atom(Atom::ListItemLeft, ATOM_LIST_TAG); - - for (int i = 0; i < alsoList.count(); ++i) { - if (i != 0) - text << ", "; - text << alsoList.at(i); - } - text << Atom(Atom::ListItemRight, ATOM_LIST_TAG) - << Atom(Atom::ListRight, ATOM_LIST_TAG); - } - - generateText(text, node, marker); - } else { - foreach (const Text &text, alsoList) { - out() << "\n@see "; - generateText(text, node, marker); - } - } -} - -QString JavadocGenerator::refForNode( const Node *node ) -{ - if (node->type() == Node::Function) - return javaSignature(static_cast(node), JavadocRef); - - return HtmlGenerator::refForNode(node); -} - -QString JavadocGenerator::linkForNode( const Node *node, const Node *relative ) -{ - // ### EVIL, relative should never be null - if (!relative) - relative = node; - - if (packageName(node).isEmpty()) { - // ### jasmin: Fixme - return QString(); - } - - QString result; - if (node->type() == Node::Fake) { - result = node->name(); - } else { - if (!node->isInnerNode()) { - result = linkForNode(node->parent(), relative) + "#" + refForNode(node); - } else { - result = node->name() + ".html"; - } - } - - QStringList nodePackage = packageName(node).split("."); - QStringList relativePackage = packageName(relative).split("."); - if (nodePackage == QStringList(QString()) || relativePackage == QStringList(QString())) { - qWarning("I'm in trouble [%s][%s]", qPrintable(node->name()), qPrintable(relative->name())); - return QString(); - } - - int i = nodePackage.count() - 1; - while (nodePackage.value(i) != relativePackage.value(i)) { - result.prepend(nodePackage.at(i) + "/"); - --i; - } - - ++i; - while (i < relativePackage.count()) { - result.prepend("%2E%2E/"); // javadoc 1.5.0_06 chokes on '../' - ++i; - } - - return result; -} - -QString JavadocGenerator::refForAtom(Atom *atom, const Node *node) -{ - return HtmlGenerator::refForAtom(atom, node); -} - -/* - Neutralize dumb functions called from HtmlGenerator. -*/ -void JavadocGenerator::generateDcf(const QString & /* fileBase */, const QString & /* startPage */, - const QString & /* title */, DcfSection & /* dcfRoot */) -{ -} - -void JavadocGenerator::generateIndex(const QString & /* fileBase */, const QString & /* url */, - const QString & /* title */) -{ -} - -void JavadocGenerator::generateIndent() -{ - for (int i = 0; i < currentDepth; ++i) - out() << " "; -} - -void JavadocGenerator::generateDoc(const Node *node, CodeMarker *marker) -{ - const Text &text = node->doc().body(); - if (!text.isEmpty()) { - out() << " doc=\"/**\n"; - Generator::generateStatus(node, marker); - generateText(text, node, marker); - if (node && node->type() == Node::Function) { - const FunctionNode *func = static_cast(node); - if (func->metaness() == FunctionNode::Signal) { - QStringList slotSignatures; - for (int i = func->parameters().count(); i >= 0; --i) - slotSignatures += javaSignature(func, SlotSignature, i); - - Text text; - - text << Atom(Atom::ListLeft, ATOM_LIST_TAG) - << Atom(Atom::ListTagLeft, ATOM_LIST_TAG) - << Atom(Atom::FormattingLeft, ATOM_FORMATTING_BOLD); - - if (slotSignatures.count() == 1) { - text << "Compatible Slot Signature:"; - } else { - text << "Compatible Slot Signatures:"; - } - - text << Atom(Atom::FormattingRight, ATOM_FORMATTING_BOLD) - << Atom(Atom::ListTagRight, ATOM_LIST_TAG); - - for (int i = 0; i < slotSignatures.count(); ++i) { - text << Atom(Atom::ListItemLeft, ATOM_LIST_TAG) - << Atom(Atom::C, marker->markedUpCode(slotSignatures.at(i), 0, "")) - << Atom(Atom::ListItemRight, ATOM_LIST_TAG); - } - text << Atom(Atom::ListRight, ATOM_LIST_TAG); - generateText(text, node, marker); - } - } - if (node) - generateAlsoList(node, marker); - out() << " */\""; - } -} - -void JavadocGenerator::generateEnumItemDoc(const Text &text, const Node *node, CodeMarker *marker) -{ - out() << " doc=\"/**\n"; - if (text.isEmpty()) { - out() << "Internal."; - } else { - generateText(text, node, marker); - } - out() << " */\""; -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/javadocgenerator.h b/tools/qdoc3/javadocgenerator.h deleted file mode 100644 index b485502..0000000 --- a/tools/qdoc3/javadocgenerator.h +++ /dev/null @@ -1,95 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef JAVADOCGENERATOR_H -#define JAVADOCGENERATOR_H - -#include "htmlgenerator.h" - -QT_BEGIN_NAMESPACE - -class JavadocGenerator : public HtmlGenerator -{ -public: - JavadocGenerator(); - ~JavadocGenerator(); - - void initializeGenerator(const Config &config); - void terminateGenerator(); - QString format(); - bool canHandleFormat(const QString &format) { return format == "HTML" || format == "javadoc"; } - void generateTree(const Tree *tree, CodeMarker *marker); - QString typeString(const Node *node); - QString imageFileName(const Node *relative, const QString &fileBase); - -protected: - QString fileExtension(const Node *node) const; - void startText( const Node *relative, CodeMarker *marker ); - void endText( const Node *relative, CodeMarker *marker ); - int generateAtom( const Atom *atom, const Node *relative, CodeMarker *marker ); - void generateClassLikeNode(const InnerNode *inner, CodeMarker *marker); - void generateFakeNode( const FakeNode *fake, CodeMarker *marker ); - - bool generateText( const Text& text, const Node *relative, CodeMarker *marker ); - void generateBody( const Node *node, CodeMarker *marker ); - void generateAlsoList( const Node *node, CodeMarker *marker ); - - QString refForNode( const Node *node ); - QString linkForNode( const Node *node, const Node *relative ); - QString refForAtom(Atom *atom, const Node *node); - -private: - void generateDcf(const QString &fileBase, const QString &startPage, - const QString &title, DcfSection &dcfRoot); - void generateIndex(const QString &fileBase, const QString &url, - const QString &title); - void generateIndent(); - void generateDoc(const Node *node, CodeMarker *marker); - void generateEnumItemDoc(const Text &text, const Node *node, CodeMarker *marker); - - QString buffer; - QIODevice *oldDevice; - int currentDepth; -}; - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/linguistgenerator.cpp b/tools/qdoc3/linguistgenerator.cpp deleted file mode 100644 index 702f0fb..0000000 --- a/tools/qdoc3/linguistgenerator.cpp +++ /dev/null @@ -1,245 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - linguistgenerator.cpp -*/ - -#include "codemarker.h" -#include "pagegenerator.h" -#include "linguistgenerator.h" -#include "node.h" -#include "separator.h" -#include "tree.h" -#include - -#include -#include - -QT_BEGIN_NAMESPACE - -#define COMMAND_VERSION Doc::alias("version") - -LinguistGenerator::LinguistGenerator() - : PageGenerator() -{ -} - -LinguistGenerator::~LinguistGenerator() -{ -} - -void LinguistGenerator::initializeGenerator(const Config &config) -{ - Generator::initializeGenerator(config); -} - -void LinguistGenerator::terminateGenerator() -{ - PageGenerator::terminateGenerator(); -} - -QString LinguistGenerator::format() -{ - return "Linguist"; -} - -QString LinguistGenerator::fileExtension(const Node * /* node */) const -{ - return "ts"; -} - -void LinguistGenerator::generateClassLikeNode(const InnerNode *inner, CodeMarker *marker) -{ - out().setCodec("UTF-8"); - - QDomDocument document("TS"); - QDomElement documentElement = document.createElement("TS"); - documentElement.setAttribute("version", "1.1"); - - QList contextElements = generateIndexSections(document, inner, marker); - foreach (const QDomElement &element, contextElements) - documentElement.appendChild(element); - - QDomProcessingInstruction process = document.createProcessingInstruction( - "xml", QString("version=\"1.0\" encoding=\"%1\"").arg("UTF-8")); - document.appendChild(process); - document.appendChild(documentElement); - - out() << document; - out().flush(); -} - -void LinguistGenerator::generateFakeNode( const FakeNode *fake, CodeMarker *marker ) -{ - out().setCodec("utf-8"); - - QDomDocument document("TS"); - QDomElement documentElement = document.createElement("TS"); - documentElement.setAttribute("version", "1.1"); - - QList contextElements = generateIndexSections(document, fake, marker); - foreach (const QDomElement &element, contextElements) - documentElement.appendChild(element); - - QDomProcessingInstruction process = document.createProcessingInstruction( - "xml", QString("version=\"1.0\" encoding=\"%1\"").arg("utf-8")); - document.appendChild(process); - document.appendChild(documentElement); - - out() << document; - out().flush(); -} - -QList LinguistGenerator::generateIndexSections( - QDomDocument &document, const Node *node, CodeMarker *marker) -{ - QList contexts; - - if (node->isInnerNode()) { - const InnerNode *inner = static_cast(node); - - foreach (const Node *child, inner->childNodes()) { - // Recurse to generate a DOM element for this child node and all - // its children. - contexts += generateIndexSections(document, child, marker); - } -/* - foreach (const Node *child, inner->relatedNodes()) { - QDomElement childElement = generateIndexSections(document, child, marker); - element.appendChild(childElement); - } -*/ - } - - // Add documentation to this node if it exists. - if (!node->doc().isEmpty()) { - - QString nodeName = fullName(node); - QString signature; - - if (node->type() == Node::Function) { - QStringList pieces; - const FunctionNode *functionNode = static_cast(node); - foreach (const Parameter ¶meter, functionNode->parameters()) { - QString typeString = parameter.leftType() + parameter.rightType(); - if (typeString.split(" ").size() > 1) - pieces.append(typeString + parameter.name()); - else - pieces.append(typeString + " " + parameter.name()); - } - signature = "(" + pieces.join(", ") + ")"; - } - - QDomElement contextElement = document.createElement("context"); - QDomElement nameElement = document.createElement("name"); - nameElement.appendChild(document.createTextNode(nodeName + signature)); - contextElement.appendChild(nameElement); - - QDomElement messageElement = document.createElement("message"); - contextElement.appendChild(messageElement); - - QDomElement sourceElement = document.createElement("source"); - QString sourceText = simplified(node->doc().source()); - if (!signature.isEmpty() && signature != "()" && !sourceText.contains("\\fn")) - sourceText.prepend(QString("\\fn %1%2\n").arg(nodeName).arg(signature)); - sourceElement.appendChild(document.createTextNode(sourceText)); - messageElement.appendChild(sourceElement); - - QDomElement translationElement = document.createElement("translation"); - translationElement.setAttribute("type", "unfinished"); - messageElement.appendChild(translationElement); - - QDomElement locationElement = document.createElement("location"); - locationElement.setAttribute("filename", node->doc().location().filePath()); - locationElement.setAttribute("line", node->doc().location().lineNo()); - messageElement.appendChild(locationElement); - - contexts.append(contextElement); - } - - return contexts; -} - -QString LinguistGenerator::fullName(const Node *node) const -{ - if (!node) - return ""; - else if (node->parent() && !node->parent()->name().isEmpty()) - return fullName(node->parent()) + "::" + node->name(); - else - return node->name(); -} - -QString LinguistGenerator::simplified(const QString &text) const -{ - QStringList lines = text.split("\n"); - - while (lines.size() > 0 && lines.first().trimmed().isEmpty()) - lines.pop_front(); - - while (lines.size() > 0 && lines.last().trimmed().isEmpty()) - lines.pop_back(); - - int min = 0; - bool set = false; - foreach (const QString &line, lines) { - int j = 0; - while (j < line.length()) { - if (line[j] != ' ') - break; - ++j; - } - if (j < line.length()) { - if (!set) { - min = j; - set = true; - } else - min = qMin(min, j); - } - } - for (int i = 0; i < lines.size(); ++i) - lines[i] = lines[i].mid(min); - - return lines.join("\n"); -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/linguistgenerator.h b/tools/qdoc3/linguistgenerator.h deleted file mode 100644 index 979db02..0000000 --- a/tools/qdoc3/linguistgenerator.h +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - LinguistGenerator.h -*/ - -#ifndef LINGUISTGENERATOR_H -#define LINGUISTGENERATOR_H - -#include -#include -#include - -#include "codemarker.h" -#include "config.h" -#include "pagegenerator.h" - -QT_BEGIN_NAMESPACE - -class LinguistGenerator : public PageGenerator -{ -public: - LinguistGenerator(); - ~LinguistGenerator(); - - virtual void initializeGenerator( const Config& config ); - virtual void terminateGenerator(); - virtual QString format(); - -protected: - virtual void generateClassLikeNode(const InnerNode *inner, - CodeMarker *marker); - virtual void generateFakeNode( const FakeNode *fake, CodeMarker *marker ); - virtual QString fileExtension(const Node *node) const; - - QList generateIndexSections(QDomDocument &document, - const Node *node, CodeMarker *marker); - virtual QString fullName(const Node *node) const; - -private: - QString simplified(const QString &text) const; -}; - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/loutgenerator.cpp b/tools/qdoc3/loutgenerator.cpp deleted file mode 100644 index caf98e8..0000000 --- a/tools/qdoc3/loutgenerator.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - loutgenerator.cpp -*/ - -#include "loutgenerator.h" - -QT_BEGIN_NAMESPACE - -LoutGenerator::LoutGenerator() -{ -} - -LoutGenerator::~LoutGenerator() -{ -} - -QString LoutGenerator::format() -{ - return "lout"; -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/loutgenerator.h b/tools/qdoc3/loutgenerator.h deleted file mode 100644 index 484d38f..0000000 --- a/tools/qdoc3/loutgenerator.h +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - loutgenerator.h -*/ - -#ifndef LOUTGENERATOR_H -#define LOUTGENERATOR_H - -#include "bookgenerator.h" - -QT_BEGIN_NAMESPACE - -class LoutGenerator : public BookGenerator -{ -public: - LoutGenerator(); - ~LoutGenerator(); - - virtual QString format(); - -protected: - // ### -}; - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/main.cpp b/tools/qdoc3/main.cpp index 85b23e9..7459e40 100644 --- a/tools/qdoc3/main.cpp +++ b/tools/qdoc3/main.cpp @@ -51,22 +51,11 @@ #include "config.h" #include "cppcodemarker.h" #include "cppcodeparser.h" -#include "cpptoqsconverter.h" #include "doc.h" #include "htmlgenerator.h" -#include "jambiapiparser.h" -#include "javacodemarker.h" -#include "javadocgenerator.h" -#include "linguistgenerator.h" -#include "loutgenerator.h" -#include "mangenerator.h" #include "plaincodemarker.h" #include "polyarchiveextractor.h" #include "polyuncompressor.h" -#include "qsakernelparser.h" -#include "qscodemarker.h" -#include "qscodeparser.h" -#include "sgmlgenerator.h" #include "webxmlgenerator.h" #include "ditaxmlgenerator.h" #include "tokenizer.h" @@ -210,7 +199,6 @@ static void processQdocconfFile(const QString &fileName) Location::initialize(config); Tokenizer::initialize(config); Doc::initialize(config); - CppToQsConverter::initialize(config); CodeMarker::initialize(config); CodeParser::initialize(config); Generator::initialize(config); @@ -355,7 +343,6 @@ static void processQdocconfFile(const QString &fileName) Generator::terminate(); CodeParser::terminate(); CodeMarker::terminate(); - CppToQsConverter::terminate(); Doc::terminate(); Tokenizer::terminate(); Location::terminate(); @@ -408,25 +395,14 @@ int main(int argc, char **argv) CppCodeParser cppParser; Tree *cppTree = treeForLanguage(cppParser.language()); - QsCodeParser qsParser(cppTree); - QsaKernelParser qsaKernelParser(cppTree); - JambiApiParser jambiParser(cppTree); - /* - Create code markers for plain text, C++, Java, and qs. + Create code markers for plain text and C++. */ PlainCodeMarker plainMarker; CppCodeMarker cppMarker; - JavaCodeMarker javaMarker; - QsCodeMarker qsMarker; ApiGenerator apiGenerator; HtmlGenerator htmlGenerator; - JavadocGenerator javadocGenerator; - LinguistGenerator linguistGenerator; - LoutGenerator loutGenerator; - ManGenerator manGenerator; - SgmlGenerator smglGenerator; WebXMLGenerator webxmlGenerator; DitaXmlGenerator ditaxmlGenerator; diff --git a/tools/qdoc3/mangenerator.cpp b/tools/qdoc3/mangenerator.cpp deleted file mode 100644 index 1e85b73..0000000 --- a/tools/qdoc3/mangenerator.cpp +++ /dev/null @@ -1,228 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - mangenerator.cpp -*/ - -#include -#include - -#include "mangenerator.h" -#include "node.h" -#include "tree.h" - -QT_BEGIN_NAMESPACE - -ManGenerator::ManGenerator() -{ - date = QDate::currentDate().toString( "d MMMM yyyy" ); -} - -ManGenerator::~ManGenerator() -{ -} - -QString ManGenerator::format() -{ - return "man"; -} - -int ManGenerator::generateAtom( const Atom *atom, const Node * /* relative */, - CodeMarker * /* marker */ ) -{ -#if 0 - switch ( atom->type() ) { - case Atom::AbstractBegin: - break; - case Atom::AbstractEnd: - break; - case Atom::Alias: - break; - case Atom::AliasArg: - break; - case Atom::BaseName: - break; - case Atom::BriefBegin: - break; - case Atom::BriefEnd: - break; - case Atom::C: - break; - case Atom::CaptionBegin: - break; - case Atom::CaptionEnd: - break; - case Atom::CitationBegin: - break; - case Atom::CitationEnd: - break; - case Atom::Code: - break; - case Atom::FootnoteBegin: - break; - case Atom::FootnoteEnd: - break; - case Atom::FormatBegin: - break; - case Atom::FormatEnd: - break; - case Atom::GeneratedList: - break; - case Atom::Image: - break; - case Atom::ImageText: - break; - case Atom::Link: - break; - case Atom::LinkNode: - break; - case Atom::ListBegin: - break; - case Atom::ListItemNumber: - break; - case Atom::ListItemBegin: - out() << ".IP " << atom->string() << ".\n"; - break; - case Atom::ListItemEnd: - break; - case Atom::ListEnd: - break; - case Atom::Nop: - break; - case Atom::ParaBegin: - out() << ".PP\n"; - break; - case Atom::ParaEnd: - out() << "\n"; - break; - case Atom::RawFormat: - break; - case Atom::RawString: - break; - case Atom::SectionBegin: - break; - case Atom::SectionEnd: - break; - case Atom::SectionHeadingBegin: - break; - case Atom::SectionHeadingEnd: - break; - case Atom::SidebarBegin: - break; - case Atom::SidebarEnd: - break; - case Atom::String: - out() << protectTextLine( atom->string() ); - break; - case Atom::TableBegin: - break; - case Atom::TableEnd: - break; - case Atom::TableOfContents: - break; - case Atom::Target: - break; - case Atom::UnknownCommand: - ; - } -#endif - unknownAtom( atom ); - return 0; -} - -void ManGenerator::generateClassLikeNode( const InnerNode *classe, - CodeMarker *marker ) -{ - generateHeader( classe->name() ); - out() << ".SH NAME\n" - << classe->name() << "\n" - << ".SH SYNOPSYS\n"; - generateBody( classe, marker ); - generateFooter(); -} - -void ManGenerator::generateFakeNode( const FakeNode *fake, CodeMarker *marker ) -{ - generateHeader( "foo" ); - generateBody( fake, marker ); - generateFooter(); -} - -QString ManGenerator::fileExtension(const Node * /* node */) const -{ - return "3qt"; -} - -void ManGenerator::generateHeader( const QString& name ) -{ - out() << ".TH " << protectArg( name ) - << " " << protectArg( "3qt" ) - << " " << protectArg( date ) - << " " << protectArg( "Nokia Corporation and/or its subsidiary(-ies)" ) - << " " << protectArg( "Qt Toolkit" ) << "\n"; -} - -void ManGenerator::generateFooter() -{ -} - -QString ManGenerator::protectArg( const QString& str ) -{ - for ( int i = 0; i < (int) str.length(); i++ ) { - if ( str[i] == ' ' || str[i].isSpace() ) { - QString quoted = str; - quoted.replace( "\"", "\"\"" ); - return "\"" + quoted + "\""; - } - } - return str; -} - -QString ManGenerator::protectTextLine( const QString& str ) -{ - QString t = str; - if ( t.startsWith(".") || t.startsWith("'") ) - t.prepend( "\\&" ); - return t; -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/mangenerator.h b/tools/qdoc3/mangenerator.h deleted file mode 100644 index 0fca342..0000000 --- a/tools/qdoc3/mangenerator.h +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - mangenerator.h -*/ - -#ifndef MANGENERATOR_H -#define MANGENERATOR_H - -#include "pagegenerator.h" - -QT_BEGIN_NAMESPACE - -class ManGenerator : public PageGenerator -{ -public: - ManGenerator(); - ~ManGenerator(); - - virtual QString format(); - -protected: - virtual int generateAtom( const Atom *atom, const Node *relative, - CodeMarker *marker ); - virtual void generateClassLikeNode(const InnerNode *node, CodeMarker *marker); - virtual void generateFakeNode( const FakeNode *fake, CodeMarker *marker ); - virtual QString fileExtension(const Node *node) const; - -private: - void generateHeader( const QString& name ); - void generateFooter(); - QString protectArg( const QString& str ); - QString protectTextLine( const QString& str ); - - QString date; -}; - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/qdoc3.pro b/tools/qdoc3/qdoc3.pro index d47e066..9b76d97 100644 --- a/tools/qdoc3/qdoc3.pro +++ b/tools/qdoc3/qdoc3.pro @@ -27,7 +27,6 @@ CONFIG -= app_bundle HEADERS += apigenerator.h \ archiveextractor.h \ atom.h \ - bookgenerator.h \ ccodeparser.h \ codechunk.h \ codemarker.h \ @@ -36,33 +35,21 @@ HEADERS += apigenerator.h \ config.h \ cppcodemarker.h \ cppcodeparser.h \ - cpptoqsconverter.h \ - dcfsection.h \ ditaxmlgenerator.h \ doc.h \ editdistance.h \ generator.h \ helpprojectwriter.h \ htmlgenerator.h \ - jambiapiparser.h \ - javacodemarker.h \ - javadocgenerator.h \ - linguistgenerator.h \ location.h \ - loutgenerator.h \ - mangenerator.h \ node.h \ openedlist.h \ pagegenerator.h \ plaincodemarker.h \ polyarchiveextractor.h \ polyuncompressor.h \ - qsakernelparser.h \ - qscodemarker.h \ - qscodeparser.h \ quoter.h \ separator.h \ - sgmlgenerator.h \ text.h \ tokenizer.h \ tr.h \ @@ -72,7 +59,6 @@ HEADERS += apigenerator.h \ SOURCES += apigenerator.cpp \ archiveextractor.cpp \ atom.cpp \ - bookgenerator.cpp \ ccodeparser.cpp \ codechunk.cpp \ codemarker.cpp \ @@ -81,21 +67,13 @@ SOURCES += apigenerator.cpp \ config.cpp \ cppcodemarker.cpp \ cppcodeparser.cpp \ - cpptoqsconverter.cpp \ - dcfsection.cpp \ ditaxmlgenerator.cpp \ doc.cpp \ editdistance.cpp \ generator.cpp \ helpprojectwriter.cpp \ htmlgenerator.cpp \ - jambiapiparser.cpp \ - javacodemarker.cpp \ - javadocgenerator.cpp \ - linguistgenerator.cpp \ location.cpp \ - loutgenerator.cpp \ - mangenerator.cpp \ main.cpp \ node.cpp \ openedlist.cpp \ @@ -103,12 +81,8 @@ SOURCES += apigenerator.cpp \ plaincodemarker.cpp \ polyarchiveextractor.cpp \ polyuncompressor.cpp \ - qsakernelparser.cpp \ - qscodemarker.cpp \ - qscodeparser.cpp \ quoter.cpp \ separator.cpp \ - sgmlgenerator.cpp \ text.cpp \ tokenizer.cpp \ tree.cpp \ diff --git a/tools/qdoc3/qsakernelparser.cpp b/tools/qdoc3/qsakernelparser.cpp deleted file mode 100644 index 8f12eda..0000000 --- a/tools/qdoc3/qsakernelparser.cpp +++ /dev/null @@ -1,186 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -#include "qsakernelparser.h" -#include "tokenizer.h" -#include "tree.h" - -QT_BEGIN_NAMESPACE - -QsaKernelParser::QsaKernelParser( Tree *cppTree ) - : cppTre( cppTree ) -{ -} - -QsaKernelParser::~QsaKernelParser() -{ -} - -QString QsaKernelParser::language() -{ - return "QSA Kernel C++"; -} - -QString QsaKernelParser::sourceFileNameFilter() -{ - return "*.cpp"; -} - -void QsaKernelParser::parseSourceFile( const Location& location, - const QString& filePath, - Tree * /* tree */ ) -{ - QFile in(filePath); - if (!in.open(QIODevice::ReadOnly)) { - location.error( tr("Cannot open QSA kernel file '%1'").arg(filePath) ); - return; - } - - Location fileLocation( filePath ); - Tokenizer fileTokenizer( fileLocation, in ); - tokenizer = &fileTokenizer; - readToken(); - - QString ident; - QString className; - int delimDepth = 0; - - while ( tok != Tok_Eoi ) { - if ( tok == Tok_Ident ) { - ident = tokenizer->lexeme(); - readToken(); - if ( tok == Tok_Gulbrandsen && tokenizer->braceDepth() == 0 && - tokenizer->parenDepth() == 0 ) { - className = ident; - } else if ( ident.startsWith("add") && ident.endsWith("Member") && - tok == Tok_LeftParen ) { - bool isProperty = ident.endsWith( "VariableMember" ); - bool isStatic = ident.startsWith( "addStatic" ); - bool isWritable = !isStatic; - - readToken(); - if ( tok == Tok_String ) { - QString member = tokenizer->lexeme(); - member = member.mid( 1, member.length() - 2 ); - - readToken(); - if ( tok == Tok_Comma ) - readToken(); - if ( tok == Tok_Ident && tokenizer->lexeme() == "QSMember" ) - readToken(); - if ( tok == Tok_LeftParen ) { - delimDepth++; - readToken(); - } - - while ( tok != Tok_Eoi && tok != Tok_RightParen && - tok != Tok_Semicolon ) { - if ( tok == Tok_Ident ) { - ident = tokenizer->lexeme(); - if ( ident == "Custom" ) { - isProperty = true; - } else if ( ident == "AttributeNonWritable" ) { - isWritable = false; - } else if ( ident == "AttributeStatic" ) { - isStatic = true; - } - } - readToken(); - } - - ClassNode *classe = - (ClassNode *) cppTre->findNode( QStringList(className), - Node::Class ); - if ( classe == 0 ) { - classe = new ClassNode( cppTre->root(), className ); - classe->setLocation( tokenizer->location() ); - } - - if ( isProperty ) { - PropertyNode *property = new PropertyNode(classe, member); - property->setLocation( tokenizer->location() ); - property->setDataType( "Object" ); -#if 0 - property->setGetter( member ); - if ( isWritable ) { - QString setter = member; - setter[0] = setter[0].toUpper(); - setter.prepend( "set" ); - property->setSetter( setter ); - } -#endif - } else { - FunctionNode *func = new FunctionNode( classe, member ); - func->setLocation( tokenizer->location() ); - func->setAccess( FunctionNode::Public ); - func->setMetaness( FunctionNode::Slot ); - if ( member == "toLocaleString" || - member == "toString" ) { - func->setReturnType( "QString" ); - } else if ( member == "valueOf" ) { - func->setReturnType( "Object" ); - } else { - func->setReturnType( "Object" ); - func->addParameter( Parameter("...") ); - } - func->setStatic( false ); // ### - } - } - } - } else { - readToken(); - } - } - in.close(); -} - -void QsaKernelParser::doneParsingSourceFiles( Tree * /* tree */ ) -{ -} - -void QsaKernelParser::readToken() -{ - tok = tokenizer->getToken(); -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/qsakernelparser.h b/tools/qdoc3/qsakernelparser.h deleted file mode 100644 index 9ac84fb..0000000 --- a/tools/qdoc3/qsakernelparser.h +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - qsakernelparser.h -*/ - -#ifndef QSAKERNELPARSER_H -#define QSAKERNELPARSER_H - -#include "codeparser.h" - -QT_BEGIN_NAMESPACE - -class Tokenizer; - -class QsaKernelParser : public CodeParser -{ -public: - QsaKernelParser( Tree *cppTree ); - ~QsaKernelParser(); - - virtual QString language(); - virtual QString sourceFileNameFilter(); - virtual void parseSourceFile( const Location& location, - const QString& filePath, Tree *tree ); - virtual void doneParsingSourceFiles( Tree *tree ); - -private: - void readToken(); - - Tree *cppTre; - Tokenizer *tokenizer; - int tok; -}; - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/qscodemarker.cpp b/tools/qdoc3/qscodemarker.cpp deleted file mode 100644 index 2ee5d99..0000000 --- a/tools/qdoc3/qscodemarker.cpp +++ /dev/null @@ -1,378 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - qscodemarker.cpp -*/ - -#include "node.h" -#include "qscodemarker.h" - -QT_BEGIN_NAMESPACE - -QsCodeMarker::QsCodeMarker() -{ -} - -QsCodeMarker::~QsCodeMarker() -{ -} - -bool QsCodeMarker::recognizeCode( const QString& /* code */ ) -{ - return true; -} - -bool QsCodeMarker::recognizeExtension( const QString& ext ) -{ - return ext == "js" || ext == "qs"; -} - -bool QsCodeMarker::recognizeLanguage( const QString& lang ) -{ - return lang == "JavaScript" || lang == "Qt Script"; -} - -QString QsCodeMarker::plainName( const Node *node ) -{ - QString name = node->name(); - if ( node->type() == Node::Function ) - name += "()"; - return name; -} - -QString QsCodeMarker::plainFullName( const Node *node, const Node * /* relative */ ) -{ - QString fullName; - for ( ;; ) { - fullName.prepend( plainName(node) ); - if ( node->parent()->name().isEmpty() ) - break; - node = node->parent(); - fullName.prepend("."); - } - return fullName; -} - -QString QsCodeMarker::markedUpCode( const QString& code, - const Node * /* relative */, - const QString& /* dirPath */ ) -{ - return protect( code ); -} - -QString QsCodeMarker::markedUpSynopsis( const Node *node, - const Node * /* relative */, - SynopsisStyle style ) -{ - QString synopsis; - QStringList extras; - QString name; - - name = taggedNode( node ); - if ( style != Detailed ) - name = linkTag( node, name ); - name = "<@name>" + name + ""; - - if ( style == Detailed && !node->parent()->name().isEmpty() && - node->type() != Node::Enum ) - name.prepend( taggedNode(node->parent()) + "." ); - - switch ( node->type() ) { - case Node::Class: - synopsis = "class " + name; - break; - case Node::Function: - { - const FunctionNode *func = (const FunctionNode *) node; - - synopsis = name; - - if ( style == SeparateList ) { - synopsis += "()"; - } else { - synopsis += " ("; - if ( !func->parameters().isEmpty() ) { - synopsis += " "; - int numOptional = 0; - QList::ConstIterator p = func->parameters().begin(); - while ( p != func->parameters().end() ) { - if ( !(*p).defaultValue().isEmpty() ) { - if ( p == func->parameters().begin() ) { - synopsis += "[ "; - } else { - synopsis += " [ , "; - } - numOptional++; - } else { - if ( p != func->parameters().begin() ) - synopsis += ", "; - } - if ( !(*p).name().isEmpty() ) - synopsis += "<@param>" + protect( (*p).name() ) + - " : "; - synopsis += protect( (*p).leftType() ); - ++p; - } - for ( int i = 0; i < numOptional; i++ ) - synopsis += " ]"; - synopsis += " "; - } - synopsis += ")"; - } - - if ( style != SeparateList && !func->returnType().isEmpty() ) - synopsis += " : " + protect( func->returnType() ); - - if ( style == Detailed && func->metaness() == FunctionNode::Signal ) - extras << "[signal]"; - } - break; - case Node::Property: - { - const PropertyNode *property = (const PropertyNode *) node; - - synopsis = name; - if ( style != SeparateList ) - synopsis += " : " + property->dataType(); - if ( style == Detailed && property->setters().isEmpty() ) - extras << "[read only]"; - } - break; - case Node::Enum: - { - /* - The letters A to F and X (upper- and lower-case) can - appear in a hexadecimal constant (e.g. 0x3F). - */ - QRegExp letterRegExp( "[G-WYZg-wyz_]" ); - const EnumNode *enume = (const EnumNode *) node; - - synopsis = name; - if ( style == Summary && !enume->items().isEmpty() ) { - synopsis += " : "; - QString comma; - QList::ConstIterator it = enume->items().begin(); - while ( it != enume->items().end() ) { - if ( enume->itemAccess((*it).name()) == Node::Public ) { - synopsis += comma; - synopsis += (*it).name(); - if ( (*it).value().indexOf(letterRegExp) != -1 ) - synopsis += " = " + (*it).value(); - comma = ", "; - } - ++it; - } - } - } - break; - case Node::Namespace: - case Node::Typedef: - default: - synopsis = name; - } - - if ( style == Summary ) { - if ( node->status() == Node::Preliminary ) { - extras << "(preliminary)"; - } else if ( node->status() == Node::Deprecated ) { - extras << "(deprecated)"; - } else if ( node->status() == Node::Obsolete ) { - extras << "(obsolete)"; - } - } - - QString extra; - if ( !extras.isEmpty() ) - extra = "<@extra>" + extras.join(" ") + ""; - return synopsis + extra; -} - -QString QsCodeMarker::markedUpName( const Node *node ) -{ - QString name = linkTag( node, taggedNode(node) ); - if ( node->type() == Node::Function ) - name += "()"; - return name; -} - -QString QsCodeMarker::markedUpFullName( const Node *node, - const Node * /* relative */ ) -{ - QString fullName; - for ( ;; ) { - fullName.prepend( markedUpName(node) ); - if ( node->parent()->name().isEmpty() ) - break; - node = node->parent(); - fullName.prepend( "<@op>." ); - } - return fullName; -} - -QString QsCodeMarker::markedUpEnumValue(const QString & /* enumValue */, - const Node * /* relative */) -{ - return QString(); -} - -QString QsCodeMarker::markedUpIncludes( const QStringList& /* includes */ ) -{ - return QString(); -} - -QString QsCodeMarker::functionBeginRegExp( const QString& funcName ) -{ - return "^function[ \t].*\\b" + QRegExp::escape( funcName ); -} - -QString QsCodeMarker::functionEndRegExp( const QString& /* funcName */ ) -{ - return "^}"; -} - -QList
QsCodeMarker::sections( const InnerNode *inner, SynopsisStyle style, Status status ) -{ - QList
sections; - - if (inner->type() != Node::Class) - return sections; - - const ClassNode *classe = static_cast(inner); - - if ( style == Summary ) { - FastSection enums(classe, "Enums", "", "enum", "enums"); - FastSection functions(classe, "Functions", "", "function", "functions"); - FastSection readOnlyProperties(classe, "", "Read-Only Properties", "property", "properties"); - FastSection signalz(classe, "Signals", "", "signal", "signals"); - FastSection writableProperties(classe, "", "Writable Properties", "property", "properties"); - - QStack stack; - stack.push( classe ); - - while ( !stack.isEmpty() ) { - const ClassNode *ancestorClass = stack.pop(); - - NodeList::ConstIterator c = ancestorClass->childNodes().begin(); - while ( c != ancestorClass->childNodes().end() ) { - if ( (*c)->access() == Node::Public ) { - if ( (*c)->type() == Node::Enum ) { - insert( enums, *c, style, status ); - } else if ( (*c)->type() == Node::Function ) { - const FunctionNode *func = (const FunctionNode *) *c; - if ( func->metaness() == FunctionNode::Signal ) { - insert( signalz, *c, style, status ); - } else { - insert( functions, *c, style, status ); - } - } else if ( (*c)->type() == Node::Property ) { - const PropertyNode *property = - (const PropertyNode *) *c; - if ( property->setters().isEmpty() ) { - insert( readOnlyProperties, *c, style, status ); - } else { - insert( writableProperties, *c, style, status ); - } - } - } - ++c; - } - - QList::ConstIterator r = ancestorClass->baseClasses().begin(); - while ( r != ancestorClass->baseClasses().end() ) { - stack.prepend( (*r).node ); - ++r; - } - } - append( sections, enums ); - append( sections, writableProperties ); - append( sections, readOnlyProperties ); - append( sections, functions ); - append( sections, signalz ); - } else if ( style == Detailed ) { - FastSection enums( classe, "Enum Documentation", "", "member", "members"); - FastSection functionsAndSignals( classe, "Function and Signal Documentation", "", "member", "members"); - FastSection properties( classe, "Property Documentation", "", "member", "members"); - - NodeList::ConstIterator c = classe->childNodes().begin(); - while ( c != classe->childNodes().end() ) { - if ( (*c)->access() == Node::Public ) { - if ( (*c)->type() == Node::Enum ) { - insert( enums, *c, style, status ); - } else if ( (*c)->type() == Node::Function ) { - insert( functionsAndSignals, *c, style, status ); - } else if ( (*c)->type() == Node::Property ) { - insert( properties, *c, style, status ); - } - } - ++c; - } - append( sections, enums ); - append( sections, properties ); - append( sections, functionsAndSignals ); - } else { // ( style == SeparateList ) - FastSection all(classe, "", "", "member", "members"); - - QStack stack; - stack.push( classe ); - - while ( !stack.isEmpty() ) { - const ClassNode *ancestorClass = stack.pop(); - - NodeList::ConstIterator c = ancestorClass->childNodes().begin(); - while ( c != ancestorClass->childNodes().end() ) { - if ( (*c)->access() == Node::Public ) - insert( all, *c, style, status ); - ++c; - } - - QList::ConstIterator r = ancestorClass->baseClasses().begin(); - while ( r != ancestorClass->baseClasses().end() ) { - stack.prepend( (*r).node ); - ++r; - } - } - append( sections, all ); - } - return sections; -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/qscodemarker.h b/tools/qdoc3/qscodemarker.h deleted file mode 100644 index c6a177f..0000000 --- a/tools/qdoc3/qscodemarker.h +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - qscodemarker.h -*/ - -#ifndef QSCODEMARKER_H -#define QSCODEMARKER_H - -#include "codemarker.h" - -QT_BEGIN_NAMESPACE - -class QsCodeMarker : public CodeMarker -{ -public: - QsCodeMarker(); - ~QsCodeMarker(); - - bool recognizeCode( const QString& code ); - bool recognizeExtension( const QString& ext ); - bool recognizeLanguage( const QString& lang ); - QString plainName(const Node *node); - QString plainFullName(const Node *node, const Node *relative); - QString markedUpCode( const QString& code, const Node *relative, - const QString& dirPath ); - QString markedUpSynopsis( const Node *node, const Node *relative, - SynopsisStyle style ); - QString markedUpName( const Node *node ); - QString markedUpFullName( const Node *node, const Node *relative ); - QString markedUpEnumValue(const QString &enumValue, const Node *relative); - QString markedUpIncludes( const QStringList& includes ); - QList
sections(const InnerNode *innerNode, SynopsisStyle style, Status status); - QString functionBeginRegExp( const QString& funcName ); - QString functionEndRegExp( const QString& funcName ); -}; - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/qscodeparser.cpp b/tools/qdoc3/qscodeparser.cpp deleted file mode 100644 index 3b8bc1a..0000000 --- a/tools/qdoc3/qscodeparser.cpp +++ /dev/null @@ -1,944 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - qscodeparser.cpp -*/ - -#include -#include - -#include "config.h" -#include "qscodeparser.h" -#include "text.h" -#include "tokenizer.h" -#include "tree.h" - -QT_BEGIN_NAMESPACE - -#define CONFIG_QUICK "quick" -#define CONFIG_REPLACES "replaces" - -#define COMMAND_BRIEF Doc::alias( "brief") -#define COMMAND_CODE Doc::alias( "code") -#define COMMAND_ENDCODE Doc::alias( "endcode") -#define COMMAND_ENDQUICKCODE Doc::alias( "endquickcode") -#define COMMAND_FILE Doc::alias( "file") -#define COMMAND_GROUP Doc::alias( "group") -#define COMMAND_MODULE Doc::alias( "module") -#define COMMAND_PAGE Doc::alias( "page") -#define COMMAND_QUICKCLASS Doc::alias( "quickclass") -#define COMMAND_QUICKCODE Doc::alias( "quickcode") -#define COMMAND_QUICKENUM Doc::alias( "quickenum") -#define COMMAND_QUICKFN Doc::alias( "quickfn") -#define COMMAND_QUICKIFY Doc::alias( "quickify") -#define COMMAND_QUICKPROPERTY Doc::alias( "quickproperty") -#define COMMAND_PROTECTED Doc::alias( "protected") -#define COMMAND_REPLACE Doc::alias( "replace") - -static QString balancedParens = "(?:[^()]+|\\([^()]*\\))*"; - -QsCodeParser::QsCodeParser(Tree *cppTree) - : cppTre(cppTree), qsTre(0), replaceRegExp("/(.+)/([^/]*)/") -{ -} - -QsCodeParser::~QsCodeParser() -{ -} - -void QsCodeParser::initializeParser(const Config& config) -{ - CppCodeParser::initializeParser(config); - - nodeTypeMap.insert(COMMAND_QUICKCLASS, Node::Class); - nodeTypeMap.insert(COMMAND_QUICKENUM, Node::Enum); - nodeTypeMap.insert(COMMAND_QUICKPROPERTY, Node::Property); - nodeTypeMap.insert(COMMAND_QUICKFN, Node::Function); - - QString quickDotReplaces = CONFIG_QUICK + Config::dot + CONFIG_REPLACES; - QStringList replaces = config.getStringList(quickDotReplaces); - QStringList::ConstIterator r = replaces.begin(); - while (r != replaces.end()) { - if (replaceRegExp.exactMatch(*r)) { - QRegExp before(replaceRegExp.cap(1)); - before.setMinimal(true); - QString after = replaceRegExp.cap(2); - - if (before.isValid()) { - replaceBefores << before; - replaceAfters << after; - } - else { - config.lastLocation().warning( - tr("Invalid regular expression '%1'") - .arg(before.pattern())); - } - } - else { - config.lastLocation().warning(tr("Bad syntax in '%1'") - .arg(quickDotReplaces)); - } - ++r; - } -} - -void QsCodeParser::terminateParser() -{ - nodeTypeMap.clear(); - classesWithNoQuickDoc.clear(); - replaceBefores.clear(); - replaceAfters.clear(); - CppCodeParser::terminateParser(); -} - -QString QsCodeParser::language() -{ - return "Qt Script"; -} - -QString QsCodeParser::headerFileNameFilter() -{ - return "*"; -} - -QString QsCodeParser::sourceFileNameFilter() -{ - return "*.qs *.qsd"; -} - -void QsCodeParser::parseHeaderFile(const Location& location, - const QString& filePath, - Tree *tree) -{ - qsTre = tree; - - QFile in(filePath); - if (!in.open(QIODevice::ReadOnly)) { - location.error(tr("Cannot open Qt Script class list '%1'") - .arg(filePath)); - return; - } - - Location fileLocation(filePath); - Tokenizer fileTokenizer(fileLocation, in); - int tok = fileTokenizer.getToken(); - while (tok != Tok_Eoi) { - if (tok == Tok_Ident) { - ClassNode *quickClass = new ClassNode(qsTre->root(), - fileTokenizer.lexeme()); - quickClass->setLocation(fileTokenizer.location()); - } - else { - fileTokenizer.location().error(tr("Unexpected token '%1' in Qt" - " Script class list") - .arg(fileTokenizer.lexeme())); - break; - } - tok = fileTokenizer.getToken(); - } - in.close(); -} - -void QsCodeParser::parseSourceFile(const Location& location, - const QString& filePath, - Tree *tree) -{ - qsTre = tree; - CppCodeParser::parseSourceFile(location, filePath, tree); -} - -void QsCodeParser::doneParsingHeaderFiles(Tree *tree) -{ - NodeList::ConstIterator c = tree->root()->childNodes().begin(); - while (c != tree->root()->childNodes().end()) { - if ((*c)->type() == Node::Class) - quickifyClass((ClassNode *) *c); - ++c; - } - cppTre->root()->deleteChildren(); // save memory - tree->resolveInheritance(); - tree->resolveProperties(); -} - -void QsCodeParser::doneParsingSourceFiles(Tree *tree) -{ - tree->root()->normalizeOverloads(); - - NodeList::ConstIterator c = tree->root()->childNodes().begin(); - while (c != tree->root()->childNodes().end()) { - if ((*c)->type() == Node::Class) { - QMap::ConstIterator cwnqd = - classesWithNoQuickDoc.find((*c)->name()); - if (cwnqd != classesWithNoQuickDoc.end()) { - (*cwnqd)->location().warning(tr("No '\\%1' documentation for" - " class '%2'") - .arg(COMMAND_QUICKCLASS) - .arg(cwnqd.key())); - (*cwnqd)->setDoc(Doc(), true); - } - } - ++c; - } - - // ### check which enum types are used -} - -FunctionNode *QsCodeParser::findFunctionNode(const QString& synopsis, - Tree *tree) -{ - QStringList parentPath; - FunctionNode *clone; - FunctionNode *func = 0; - - if (makeFunctionNode(synopsis, &parentPath, &clone)) { - func = tree->findFunctionNode(parentPath, clone); - delete clone; - } - return func; -} - -QSet QsCodeParser::topicCommands() -{ - return QSet() << COMMAND_FILE << COMMAND_GROUP << COMMAND_MODULE - << COMMAND_PAGE << COMMAND_QUICKCLASS - << COMMAND_QUICKENUM << COMMAND_QUICKFN - << COMMAND_QUICKPROPERTY; -} - -Node *QsCodeParser::processTopicCommand(const Doc& doc, - const QString& command, - const QString& arg) -{ - if (command == COMMAND_QUICKFN) { - QStringList parentPath; - FunctionNode *quickFunc = 0; - FunctionNode *clone; - - if (makeFunctionNode(arg, &parentPath, &clone)) { - FunctionNode *kernelFunc = findKernelFunction(parentPath, - clone->name()); - if (kernelFunc != 0) - kernelFunc->setAccess(Node::Private); - - quickFunc = qsTre->findFunctionNode(parentPath, clone); - if (quickFunc == 0 && kernelFunc != 0) { - quickFunc = new FunctionNode(kernelFunc->parent(), - kernelFunc->name()); - quickFunc->setLocation(kernelFunc->location()); - quickFunc->setReturnType(clone->returnType()); - quickFunc->setParameters(clone->parameters()); - } - - if (quickFunc == 0) { - doc.location().warning(tr("Cannot find '%1' specified with '\\%2'") - .arg(arg).arg(command)); - } - else { - quickFunc->setAccess(Node::Public); - QStringList qtParams = quickFunc->parameterNames(); - quickFunc->borrowParameterNames(clone); - QStringList quickParams = quickFunc->parameterNames(); - setQuickDoc(quickFunc, doc, qtParams, quickParams); - } - delete clone; - } - else { - doc.location().warning(tr("Cannot find '%1' specified with '\\%2'") - .arg(arg).arg(command)); - } - return 0; - } - else if (nodeTypeMap.contains(command)) { - QStringList subArgs = arg.split(" "); - QString dataType; - - if (subArgs.count() == 3 && subArgs[1] == ":") { - dataType = subArgs[2]; - } - else if (subArgs.count() != 1) { - doc.location().warning(tr("Invalid syntax in '\\%1'") - .arg(command)); - } - - QStringList path = subArgs[0].split("."); - Node *quickNode = qsTre->findNode(path, nodeTypeMap[command]); - if (quickNode == 0) { - doc.location().warning(tr("Cannot find '%1' specified with '\\%2'") - .arg(arg).arg(command)); - } - else { - setQuickDoc(quickNode, doc); - if (quickNode->type() == Node::Class) { - classesWithNoQuickDoc.remove(quickNode->name()); - if (doc.briefText().isEmpty()) - doc.location().warning(tr("Missing '\\%1' for class '%2'") - .arg(COMMAND_BRIEF) - .arg(quickNode->name())); - } - else if (quickNode->type() == Node::Property) { - PropertyNode *quickProperty = (PropertyNode *) quickNode; - if (quickProperty->dataType() == "Object") { - if (dataType.isEmpty()) { - doc.location().warning(tr("Missing data type in '\\%1'" - " (assuming 'Object')") - .arg(command)); - } - else { - quickProperty->setDataType(dataType); - } - } - else if (dataType != quickProperty->dataType()) { - doc.location().warning(tr("Ignored contradictory data type" - " in '\\%1'") - .arg(command)); - } - } - } - return 0; - } - else { - return CppCodeParser::processTopicCommand(doc, command, arg); - } -} - -QSet QsCodeParser::otherMetaCommands() -{ - return commonMetaCommands() << COMMAND_ENDQUICKCODE << COMMAND_QUICKCODE - << COMMAND_QUICKIFY << COMMAND_REPLACE; -} - -void QsCodeParser::processOtherMetaCommand(const Doc& doc, - const QString& command, - const QString& arg, - Node *node) -{ - if (command == COMMAND_PROTECTED) { - doc.location().warning(tr("Cannot use '\\%1' in %2") - .arg(COMMAND_PROTECTED).arg(language())); - } - else { - CppCodeParser::processOtherMetaCommand(doc,command,arg,node); - } -} - -ClassNode *QsCodeParser::tryClass(const QString& className) -{ - return (ClassNode*) cppTre->findNode(QStringList(className),Node::Class); -} - -FunctionNode *QsCodeParser::findKernelFunction(const QStringList& parentPath, - const QString& name) -{ - FunctionNode clone(0, name); - clone.setReturnType("Object"); - clone.addParameter(Parameter("...")); - return qsTre->findFunctionNode(parentPath, &clone); -} - -void QsCodeParser::extractRegExp(const QRegExp& regExp, - QString& source, - const Doc& doc) -{ - QRegExp blankLineRegExp( - "[ \t]*(?:\n(?:[ \t]*\n)+[ \t]*|[ \n\t]*\\\\code|" - "\\\\endcode[ \n\t]*)"); - QStringList paras = source.trimmed().split(blankLineRegExp); - paras = paras.filter(regExp); - if (paras.count() == 0) { - doc.location().warning(tr("Cannot find regular expression '%1'") - .arg(regExp.pattern())); - } - else if (paras.count() > 1) { - doc.location().warning(tr("Regular rexpression '%1' matches multiple" - "times").arg(regExp.pattern())); - } - else { - source = paras.first() + "\n\n"; - } -} - -void QsCodeParser::extractTarget(const QString& target, - QString& source, - const Doc& doc) -{ - QRegExp targetRegExp( - "(\\\\target\\s+(\\S+)[^\n]*\n" - "(?:(?!\\s*\\\\code)[^\n]+\n|\\s*\\\\code.*\\\\endcode\\s*\n)*)" - "(?:\\s*\n|[^\n]*$)"); - targetRegExp.setMinimal(true); - - int pos = 0; - while ((pos = source.indexOf(targetRegExp, pos)) != -1) { - if (targetRegExp.cap(2) == target) { - source = targetRegExp.cap(1) + "\n\n"; - return; - } - pos += targetRegExp.matchedLength(); - } - doc.location().warning(tr("Cannot find target '%1'").arg(target)); -} - -void QsCodeParser::renameParameters(QString& source, - const Doc& /* doc */, - const QStringList& qtParams, - const QStringList& quickParams) -{ - QRegExp paramRegExp("(\\\\a\\s*\\{?\\s*)([A-Za-z0-9_]+)"); - - int pos = 0; - while ((pos = paramRegExp.indexIn(source, pos)) != -1) { - pos += paramRegExp.cap(1).length(); - QString before = paramRegExp.cap(2); - int index = qtParams.indexOf(before); - if (index != -1) { - QString after = quickParams[index]; - source.replace(pos, before.size(), after); - } - } -} - -void QsCodeParser::applyReplacementList(QString& source, const Doc& doc) -{ - QStringList args = doc.metaCommandArgs(COMMAND_REPLACE); - QStringList::ConstIterator a = args.begin(); - while (a != args.end()) { - if (replaceRegExp.exactMatch(*a)) { - QRegExp before(replaceRegExp.cap(1)); - before.setMinimal(true); - QString after = replaceRegExp.cap(2); - - if (before.isValid()) { - int oldLen = source.size(); - source.replace(before, after); - - // this condition is sufficient but not necessary - if (oldLen == source.size() && !source.contains(after)) - doc.location().warning( - tr("Regular expression '%1' did not match anything") - .arg(before.pattern())); - } - else { - doc.location().warning( - tr("Invalid regular expression '%1'") - .arg(before.pattern())); - } - } - else { - doc.location().warning(tr("Bad syntax in '\\%1'") - .arg(COMMAND_REPLACE)); - } - ++a; - } - - QRegExp codeRegExp("\\\\" + COMMAND_CODE + "(.*)\\\\" + COMMAND_ENDCODE); - codeRegExp.setMinimal(true); - - QRegExp quickcodeRegExp( - "\\\\" + COMMAND_QUICKCODE + "(.*)\\\\" + COMMAND_ENDQUICKCODE); - quickcodeRegExp.setMinimal(true); - - int quickcodePos = doc.source().indexOf(quickcodeRegExp); - if (quickcodePos != -1) { - int codePos = source.indexOf(codeRegExp); - if (codePos == -1) { - doc.location().warning( - tr("Cannot find any '\\%1' snippet corresponding to '\\%2'") - .arg(COMMAND_CODE).arg(COMMAND_QUICKCODE)); - } - else { - source.replace(codeRegExp.pos(1), codeRegExp.cap(1).length(), - quickcodeRegExp.cap(1)); - codePos = codeRegExp.pos(1) + quickcodeRegExp.cap(1).length(); - - if (doc.source().indexOf(quickcodeRegExp, quickcodePos + 1) != -1) { - doc.location().warning( - tr("Cannot use '\\%1' twice in a row") - .arg(COMMAND_QUICKCODE)); - } - else if (source.indexOf(codeRegExp, codePos + 1) != -1) { - doc.location().warning(tr("Ambiguous '\\%1'") - .arg(COMMAND_QUICKCODE)); - } - } - } -} - -void QsCodeParser::quickifyClass(ClassNode *quickClass) -{ - QString qtClassName = quickClass->name(); - QString bare = quickClass->name(); - if (bare != "Qt" && bare != "Object") { - if (bare.startsWith("Q")) { - bare = bare.mid(1); - } - else { - qtClassName.prepend("Q"); - classesWithNoQ.insert(bare); - } - } - - ClassNode *qtClass = 0; - ClassNode *wrapperClass = 0; - - if ((wrapperClass = tryClass("Quick" + bare)) != 0 || - (wrapperClass = tryClass("QS" + bare + "Class")) != 0) { - qtClass = tryClass(qtClassName); - if (qtClass == 0) { - qtClass = wrapperClass; - wrapperClass = 0; - } - } - else if ((wrapperClass = tryClass("Quick" + bare + "Ptr")) != 0) { - QRegExp ptrToQtType("(Q[A-Za-z0-9_]+)\\s*\\*"); - FunctionNode *ctor = - wrapperClass->findFunctionNode(wrapperClass->name()); - if (ctor != 0 && !ctor->parameters().isEmpty() && - ptrToQtType.exactMatch(ctor->parameters().first().leftType())) - qtClassName = ptrToQtType.cap(1); - qtClass = tryClass(qtClassName); - } - else { - wrapperClass = tryClass("Q" + bare + "Ptr"); - if (wrapperClass == 0) - wrapperClass = tryClass("Quick" + bare + "Interface"); - qtClass = tryClass(qtClassName); - } - - if (qtClass == 0) { - if (wrapperClass == 0) { - quickClass->location().warning(tr("Cannot find Qt class '%1'") - .arg(qtClassName)); - } - else { - quickClass->location().warning(tr("Cannot find Qt class '%1'" - " wrapped by '%2'") - .arg(qtClassName) - .arg(wrapperClass->name())); - } - return; - } - - QList::ConstIterator r = qtClass->baseClasses().begin(); - while (r != qtClass->baseClasses().end()) { - ClassNode *quickBaseClass = cpp2qs.findClassNode(qsTre, - (*r).node->name()); - if (quickBaseClass) - quickClass->addBaseClass((*r).access, quickBaseClass); - ++r; - } - if (quickClass->baseClasses().isEmpty() && quickClass->name() != "Object") - quickClass->addBaseClass(Node::Public, - cpp2qs.findClassNode(qsTre,"Object")); - - QSet funcBlackList; - QSet propertyBlackList; - - NodeList children; - if (wrapperClass != 0) { - children = wrapperClass->childNodes(); - - funcBlackList.insert(wrapperClass->name()); - funcBlackList.insert("~" + wrapperClass->name()); - } - children += qtClass->childNodes(); - - for (int pass = 0; pass < 2; pass++) { - NodeList::ConstIterator c = children.begin(); - while (c != children.end()) { - if ((*c)->access() != Node::Private && - (*c)->status() == Node::Commendable) { - if (pass == 0) { - if ((*c)->type() == Node::Enum) { - EnumNode *enume = (EnumNode *) *c; - quickifyEnum(quickClass, enume); - } - else if ((*c)->type() == Node::Property) { - if (!propertyBlackList.contains((*c)->name())) { - PropertyNode *property = (PropertyNode *) *c; - quickifyProperty(quickClass, qtClass, property); - if (!property->getters().isEmpty()) - funcBlackList.insert(property->getters().first()->name()); - if (!property->setters().isEmpty()) - funcBlackList.insert(property->setters().first()->name()); - if (!property->resetters().isEmpty()) - funcBlackList.insert(property->resetters().first()->name()); - propertyBlackList.insert(property->name()); - } - } - } - else if ((*c)->type() == Node::Function) { - FunctionNode *func = (FunctionNode *) *c; - quickifyFunction(quickClass, qtClass, func, - funcBlackList.contains((*c)->name()) && - func->parameters().count() < 2); - } - } - ++c; - } - } - setQtDoc(quickClass, qtClass->doc()); - classesWithNoQuickDoc.insert(quickClass->name(), quickClass); -} - -void QsCodeParser::quickifyEnum(ClassNode *quickClass, EnumNode *enume) -{ - EnumNode *quickEnum = new EnumNode(quickClass, enume->name()); - quickEnum->setLocation(enume->location()); -#if 0 // ### not yet - quickEnum->setAccess(Node::Protected); -#endif - - QList::ConstIterator it = enume->items().begin(); - while (it != enume->items().end()) { - QString name = (*it).name(); - QString value = (*it).value(); - quickEnum->addItem(EnumItem(name, value)); - ++it; - } - setQtDoc(quickEnum, enume->doc()); -} - -void QsCodeParser::quickifyFunction(ClassNode *quickClass, ClassNode *qtClass, - FunctionNode *func, bool onBlackList) -{ - if (func->metaness() == FunctionNode::Dtor) - return; - - FunctionNode *kernelFunc = findKernelFunction( - QStringList() << quickClass->name(), func->name()); - - QString quickName = func->name(); - if (func->metaness() == FunctionNode::Ctor) - quickName = quickClass->name(); - FunctionNode *quickFunc = new FunctionNode(quickClass, quickName); - quickFunc->setLocation(func->location()); - - if (onBlackList) { - quickFunc->setAccess(Node::Protected); - } - else { - if (kernelFunc != 0 && func->numOverloads() == 1 && - (func->parameters().count() == 0 || - func->parameters().last().defaultValue().isEmpty())) { - kernelFunc->setAccess(Node::Private); - } - else { - if (func->metaness() == FunctionNode::Plain) - quickFunc->setAccess(Node::Protected); - } - } - - quickFunc->setReturnType(cpp2qs.convertedDataType(qsTre, - func->returnType())); - if (func->metaness() != FunctionNode::Slot) - quickFunc->setMetaness(func->metaness()); - quickFunc->setVirtualness(FunctionNode::ImpureVirtual); - quickFunc->setOverload(func->isOverload()); - - QList::ConstIterator q = func->parameters().begin(); - while (q != func->parameters().end()) { - QString dataType = cpp2qs.convertedDataType(qsTre, (*q).leftType(), - (*q).rightType()); - if (dataType.isEmpty()) { - dataType = "UNKNOWN"; - quickFunc->setAccess(Node::Private); - } - Parameter param(dataType, "", (*q).name(), - (*q).defaultValue().isEmpty() ? "" : "undefined"); - quickFunc->addParameter(param); - ++q; - } - - if (func->doc().isEmpty()) { - if (func->parent() != (InnerNode *) qtClass) { - func = qtClass->findFunctionNode(func); - if (func != 0) - setQtDoc(quickFunc, func->doc()); - } - } - else { - setQtDoc(quickFunc, func->doc()); - } -} - -void QsCodeParser::quickifyProperty(ClassNode *quickClass, - ClassNode * /* qtClass */, - PropertyNode *property) -{ - PropertyNode *quickProperty = new PropertyNode(quickClass, - property->name()); - quickProperty->setLocation(property->location()); - quickProperty->setDataType(cpp2qs.convertedDataType(qsTre, - property->dataType())); -#if 0 - quickProperty->setGetter(property->getter()); - quickProperty->setSetter(property->setter()); - quickProperty->setResetter(property->resetter()); -#endif - quickProperty->setStored(property->isStored()); - quickProperty->setDesignable(property->isDesignable()); - - setQtDoc(quickProperty, property->doc()); -} - -QString QsCodeParser::quickifiedDoc(const QString& source) -{ - QString result; - int i = 0; - - while (i < (int) source.length()) { - if (leftWordBoundary(source, i)) { - if (source[i] == 'Q') { - if (source[i + 1] == 'C' && source.mid(i, 8) == "QCString") { - i += 2; - } - else { - int end = i + 1; - while (isWord(source[end])) - ++end; - if (!classesWithNoQ.contains( - source.mid(i + 1, end - (i + 1)))) - result += "Q"; - i++; - } - } - else if (source[i] == 'T' && source.mid(i, 4) == "TRUE" && - rightWordBoundary(source, i + 4)) { - result += "\\c{true}"; - i += 4; - } - else if (source[i] == 'F' && source.mid(i, 5) == "FALSE" && - rightWordBoundary(source, i + 5)) { - result += "\\c{false}"; - i += 5; - } - else if (source[i] == 'c' && source.mid(i, 6) == "const ") { - i += 6; - } - else { - result += source[i++]; - } - } - else if ((source[i] == ':' && source[i + 1] == ':') || - (source[i] == '-' && source[i + 1] == '>')) { - result += '.'; - i += 2; - } - else if (source[i] == '\\') { - // ### make independent of the command name - if (source.mid(i, 5) == "\\code") { - do { - result += source[i++]; - } while (source[i - 1] != '\n'); - - int begin = i; - int end = source.indexOf("\\endcode", i); - if (end != -1) { - QString code = source.mid(begin, end - begin); - result += cpp2qs.convertedCode(qsTre, code, - classesWithNoQ); - i = end; - } - } - else { - result += source[i++]; - } - } - else { - result += source[i++]; - } - } - - QList::ConstIterator b = replaceBefores.begin(); - QStringList::ConstIterator a = replaceAfters.begin(); - while (a != replaceAfters.end()) { - result.replace(*b, *a); - ++b; - ++a; - } - return result; -} - -void QsCodeParser::setQtDoc(Node *quickNode, const Doc& doc) -{ - if (!doc.isEmpty()) { - Doc quickDoc(doc.location(), doc.location(), - quickifiedDoc(doc.source()), - CppCodeParser::topicCommands() + - CppCodeParser::otherMetaCommands()); - quickNode->setDoc(quickDoc, true); - } -} - -void QsCodeParser::setQuickDoc(Node *quickNode, - const Doc& doc, - const QStringList& qtParams, - const QStringList& quickParams) -{ - QRegExp quickifyCommand("\\\\" + COMMAND_QUICKIFY + "([^\n]*)(?:\n|$)"); - - if (quickNode->type() == Node::Function) { - FunctionNode *quickFunc = (FunctionNode *) quickNode; - quickFunc->setOverload(false); - } - - if (doc.metaCommandsUsed().contains(COMMAND_QUICKIFY)) { - QString source = doc.source(); - int pos = source.indexOf(quickifyCommand); - if (pos != -1) { - QString quickifiedSource = quickNode->doc().source(); - if (!qtParams.isEmpty() && qtParams != quickParams) - renameParameters(quickifiedSource, doc, qtParams, - quickParams); - applyReplacementList(quickifiedSource, doc); - - do { - QString extract = quickifiedSource; - QString arg = quickifyCommand.cap(1).simplified(); - if (!arg.isEmpty()) { - if (arg.startsWith("/") && arg.endsWith("/") && - arg.length() > 2) { - QString pattern = arg.mid(1, arg.length() - 2); - extractRegExp(QRegExp(pattern), extract, doc); - } - else { - extractTarget(arg, extract, doc); - } - } - source.replace(pos, quickifyCommand.matchedLength(), extract); - pos += extract.length(); - } while ((pos = source.indexOf(quickifyCommand, pos)) != -1); - - QRegExp quickcodeRegExp( - "\\\\" + COMMAND_QUICKCODE + "(.*)\\\\" + - COMMAND_ENDQUICKCODE); - quickcodeRegExp.setMinimal(true); - source.replace(quickcodeRegExp, ""); - } - - Doc quickDoc(doc.location(), - doc.location(), - source, - (CppCodeParser::topicCommands() + topicCommands() + - CppCodeParser::otherMetaCommands()) << COMMAND_REPLACE); - quickNode->setDoc(quickDoc, true); - processOtherMetaCommands(quickDoc, quickNode); - } - else { - quickNode->setDoc(doc, true); - processOtherMetaCommands(doc, quickNode); - } -} - -bool QsCodeParser::makeFunctionNode(const QString& synopsis, - QStringList *parentPathPtr, - FunctionNode **funcPtr) -{ - QRegExp funcRegExp( - "\\s*([A-Za-z0-9_]+)\\.([A-Za-z0-9_]+)\\s*\\((" + - balancedParens + - ")\\)(?:\\s*:\\s*([A-Za-z0-9_]+))?\\s*"); - QRegExp paramRegExp( - "\\s*(\\[)?\\s*(?:([A-Za-z0-9_]+)\\s*:\\s*)?" - "([A-Za-z0-9_]+|\\.\\.\\.)\\s*(\\[)?[\\s\\]]*"); - - if (!funcRegExp.exactMatch(synopsis)) - return false; - - ClassNode *classe = (ClassNode*) - qsTre->findNode(QStringList(funcRegExp.cap(1)),Node::Class); - if (classe == 0) - return false; - - FunctionNode *clone = new FunctionNode(0, funcRegExp.cap(2)); - bool optional = false; - - QString paramStr = funcRegExp.cap(3); - QStringList params = paramStr.split(","); - QStringList::ConstIterator p = params.begin(); - while (p != params.end()) { - if (paramRegExp.exactMatch(*p)) { - if (!paramRegExp.cap(1).isEmpty()) - optional = true; - clone->addParameter(Parameter(paramRegExp.cap(3), - "", - paramRegExp.cap(2), - optional ? "undefined" : "")); - if (!paramRegExp.cap(4).isEmpty()) - optional = true; - } - else { - delete clone; - return false; - } - ++p; - } - QString returnType = funcRegExp.cap(4); - if (!returnType.isEmpty()) - clone->setReturnType(returnType); - if (parentPathPtr != 0) - *parentPathPtr = QStringList() << classe->name(); - if (funcPtr != 0) { - *funcPtr = clone; - } - else { - delete clone; - } - return true; -} - -bool QsCodeParser::isWord(QChar ch) -{ - return ch.isLetterOrNumber() || ch == QChar('_'); -} - -bool QsCodeParser::leftWordBoundary(const QString& str, int pos) -{ - return !isWord(str[pos - 1]) && isWord(str[pos]); -} - -bool QsCodeParser::rightWordBoundary(const QString& str, int pos) -{ - return isWord(str[pos - 1]) && !isWord(str[pos]); -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/qscodeparser.h b/tools/qdoc3/qscodeparser.h deleted file mode 100644 index 28924d7..0000000 --- a/tools/qdoc3/qscodeparser.h +++ /dev/null @@ -1,128 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - qscodeparser.h -*/ - -#ifndef QSCODEPARSER_H -#define QSCODEPARSER_H - -#include "cppcodeparser.h" -#include "cpptoqsconverter.h" - -QT_BEGIN_NAMESPACE - -class QsCodeParser : public CppCodeParser -{ - public: - QsCodeParser(Tree *cppTree); - ~QsCodeParser(); - - virtual void initializeParser(const Config& config); - virtual void terminateParser(); - virtual QString language(); - virtual QString headerFileNameFilter(); - virtual QString sourceFileNameFilter(); - virtual void parseHeaderFile(const Location& location, - const QString& filePath, Tree *tree); - virtual void parseSourceFile(const Location& location, - const QString& filePath, Tree *tree); - virtual void doneParsingHeaderFiles(Tree *tree); - virtual void doneParsingSourceFiles(Tree *tree); - - FunctionNode *findFunctionNode(const QString& synopsis, Tree *tree); - - protected: - virtual QSet topicCommands(); - virtual Node *processTopicCommand(const Doc& doc, const QString& command, - const QString& arg); - virtual QSet otherMetaCommands(); - virtual void processOtherMetaCommand(const Doc& doc, - const QString& command, - const QString& arg, Node *node); - - private: - ClassNode *tryClass(const QString& className); - FunctionNode *findKernelFunction(const QStringList& parentPath, - const QString& name); - void extractRegExp(const QRegExp& regExp, QString& source, - const Doc& doc); - void extractTarget(const QString& target, QString& source, - const Doc& doc); - void renameParameters(QString& source, const Doc& doc, - const QStringList& qtNames, - const QStringList& quickNames); - void applyReplacementList(QString& source, const Doc& doc); - void quickifyClass(ClassNode *quickClass); - void quickifyEnum(ClassNode *quickClass, EnumNode *enume); - void quickifyFunction(ClassNode *quickClass, ClassNode *qtClass, - FunctionNode *func, bool onBlackList); - void quickifyProperty(ClassNode *quickClass, ClassNode *qtClass, - PropertyNode *property); - QString quickifiedDoc(const QString& source); - void setQtDoc(Node *quickNode, const Doc& doc); - void setQuickDoc(Node *quickNode, const Doc& doc, - const QStringList& qtParams = QStringList(), - const QStringList& quickParams = QStringList()); - bool makeFunctionNode(const QString& synopsis, QStringList *parentPathPtr, - FunctionNode **funcPtr); - - static bool isWord(QChar ch); - static bool leftWordBoundary(const QString& str, int pos); - static bool rightWordBoundary(const QString& str, int pos); - - QMap nodeTypeMap; - QMap classesWithNoQuickDoc; - QList replaceBefores; - QStringList replaceAfters; - QSet classesWithNoQ; - Tree* cppTre; - Tree* qsTre; - QRegExp replaceRegExp; - CppToQsConverter cpp2qs; - - static int tabSize; -}; - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/sgmlgenerator.cpp b/tools/qdoc3/sgmlgenerator.cpp deleted file mode 100644 index 1858028..0000000 --- a/tools/qdoc3/sgmlgenerator.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - sgmlgenerator.cpp -*/ - -#include "sgmlgenerator.h" - -QT_BEGIN_NAMESPACE - -SgmlGenerator::SgmlGenerator() -{ -} - -SgmlGenerator::~SgmlGenerator() -{ -} - -QString SgmlGenerator::format() -{ - return "SGML"; -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/sgmlgenerator.h b/tools/qdoc3/sgmlgenerator.h deleted file mode 100644 index ef1f07f..0000000 --- a/tools/qdoc3/sgmlgenerator.h +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - sgmlgenerator.h -*/ - -#ifndef SGMLGENERATOR_H -#define SGMLGENERATOR_H - -#include "bookgenerator.h" - -QT_BEGIN_NAMESPACE - -class SgmlGenerator : public BookGenerator -{ -public: - SgmlGenerator(); - ~SgmlGenerator(); - - virtual QString format(); - -protected: - // ### -}; - -QT_END_NAMESPACE - -#endif -- cgit v0.12