From: Ivailo Monev Date: Thu, 27 Apr 2017 13:37:28 +0000 (+0000) Subject: add script to convert forward declarations to include directives X-Git-Tag: 4.12.0~6376 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=63218fb00f6cadb1a55b1e458e4499421a60c948;p=kde%2FKatie.git add script to convert forward declarations to include directives Signed-off-by: Ivailo Monev --- diff --git a/package/archlinux/PKGBUILD b/package/archlinux/PKGBUILD index 90dbeddfa..4ece4cd12 100644 --- a/package/archlinux/PKGBUILD +++ b/package/archlinux/PKGBUILD @@ -2,7 +2,7 @@ # Maintainer: Ivailo Monev pkgname=katie-git -pkgver=4.9.0.a0bca8a7 +pkgver=4.9.0.4ac6a9e5 pkgrel=1 pkgdesc='C++ toolkit derived from the Qt 4.8 framework' arch=('i686' 'x86_64') diff --git a/scripts/genmap.py b/scripts/genmap.py index 450094ea0..731b199f9 100755 --- a/scripts/genmap.py +++ b/scripts/genmap.py @@ -51,6 +51,16 @@ mapdata += '};\n' mapdata += 'static const int qclass_lib_count = %d;\n\n' % classcount mapdata += '#endif\n' +if '--printmap' in sys.argv: + qmappedclasses = [] + for sclass in mappedclasses: + if not sclass.startswith('Q'): + # internal class + continue + print(' "%s",' % sclass) + sys.exit(0) + + with open(mapoutput, 'wb') as f: sys.stdout.write('-- Writing: %s\n' % mapoutput) if sys.version_info[0] == 3: diff --git a/scripts/namefsck.py b/scripts/namefsck.py new file mode 100755 index 000000000..4bbe33d2d --- /dev/null +++ b/scripts/namefsck.py @@ -0,0 +1,683 @@ +#!/usr/bin/python2 + +import sys, os, re + +# generated via genmap.py --printmap +classlist = { + "QDomImplementation", + "QDomNode", + "QDomNodeList", + "QDomDocumentType", + "QDomDocument", + "QDomNamedNodeMap", + "QDomDocumentFragment", + "QDomCharacterData", + "QDomAttr", + "QDomElement", + "QDomText", + "QDomComment", + "QDomCDATASection", + "QDomNotation", + "QDomEntity", + "QDomEntityReference", + "QDomProcessingInstruction", + "QXmlNamespaceSupport", + "QXmlAttributes", + "QXmlInputSource", + "QXmlParseException", + "QXmlReader", + "QXmlSimpleReader", + "QXmlLocator", + "QXmlContentHandler", + "QXmlErrorHandler", + "QXmlDTDHandler", + "QXmlEntityResolver", + "QXmlLexicalHandler", + "QXmlDeclHandler", + "QXmlDefaultHandler", + "QAbstractSocket", + "QLocalServer", + "QLocalSocket", + "QTcpServer", + "QTcpSocket", + "QUdpSocket", + "QNetworkConfigurationManager", + "QNetworkConfiguration", + "QNetworkSession", + "QAuthenticator", + "QIPv6Address", + "QHostAddress", + "QHostInfo", + "QNetworkAddressEntry", + "QNetworkInterface", + "QNetworkProxyQuery", + "QNetworkProxy", + "QNetworkProxyFactory", + "QUrlInfo", + "QNetworkCacheMetaData", + "QAbstractNetworkCache", + "QFtp", + "QHttpHeader", + "QHttpResponseHeader", + "QHttpRequestHeader", + "QHttp", + "QHttpPart", + "QHttpMultiPart", + "QNetworkAccessManager", + "QNetworkCookie", + "QNetworkCookieJar", + "QNetworkDiskCache", + "QNetworkReply", + "QNetworkRequest", + "QSslCertificate", + "QSslCipher", + "QSslConfiguration", + "QSslError", + "QSslKey", + "QSslSocket", + "QScriptable", + "QScriptClass", + "QScriptClassPropertyIterator", + "QScriptContext", + "QScriptContextInfo", + "QScriptSyntaxCheckResult", + "QScriptEngine", + "QScriptEngineAgent", + "QScriptExtensionInterface", + "QScriptExtensionPlugin", + "QScriptProgram", + "QScriptString", + "QScriptValue", + "QScriptValueIterator", + "QAbstractFormBuilder", + "QFormBuilder", + "QUiLoader", + "QGraphicsSvgItem", + "QSvgGenerator", + "QSvgRenderer", + "QSvgWidget", + "QAbstractTextDocumentLayout", + "QTextObjectInterface", + "QFont", + "QFontDatabase", + "QFontInfo", + "QFontMetrics", + "QFontMetricsF", + "QGlyphRun", + "QRawFont", + "QStaticText", + "QSyntaxHighlighter", + "QTextCursor", + "QAbstractUndoItem", + "QTextDocument", + "QTextDocumentFragment", + "QTextDocumentWriter", + "QTextLength", + "QTextFormat", + "QTextCharFormat", + "QTextBlockFormat", + "QTextListFormat", + "QTextImageFormat", + "QTextFrameFormat", + "QTextTableFormat", + "QTextTableCellFormat", + "QTextInlineObject", + "QTextLayout", + "QTextLine", + "QTextList", + "QTextObject", + "QTextBlockGroup", + "QTextFrameLayoutData", + "QTextFrame", + "QTextBlockUserData", + "QTextBlock", + "QTextFragment", + "QTextOption", + "QTextTableCell", + "QTextTable", + "QGraphicsAnchor", + "QGraphicsAnchorLayout", + "QGraphicsGridLayout", + "QGraphicsItem", + "QGraphicsObject", + "QAbstractGraphicsShapeItem", + "QGraphicsPathItem", + "QGraphicsRectItem", + "QGraphicsEllipseItem", + "QGraphicsPolygonItem", + "QGraphicsLineItem", + "QGraphicsPixmapItem", + "QGraphicsTextItem", + "QGraphicsSimpleTextItem", + "QGraphicsItemGroup", + "QGraphicsItemAnimation", + "QGraphicsLayout", + "QGraphicsLayoutItem", + "QGraphicsLinearLayout", + "QGraphicsProxyWidget", + "QGraphicsScene", + "QGraphicsSceneEvent", + "QGraphicsSceneMouseEvent", + "QGraphicsSceneWheelEvent", + "QGraphicsSceneContextMenuEvent", + "QGraphicsSceneHoverEvent", + "QGraphicsSceneHelpEvent", + "QGraphicsSceneDragDropEvent", + "QGraphicsSceneResizeEvent", + "QGraphicsSceneMoveEvent", + "QGraphicsTransform", + "QGraphicsScale", + "QGraphicsRotation", + "QGraphicsView", + "QGraphicsWidget", + "QBitmap", + "QIcon", + "QIconEngine", + "QIconEngineFactoryInterface", + "QIconEnginePlugin", + "QImageTextKeyLang", + "QImage", + "QImageIOHandler", + "QImageIOHandlerFactoryInterface", + "QImageIOPlugin", + "QImageReader", + "QImageWriter", + "QMovie", + "QPixmap", + "QPixmapCache", + "QAccessible", + "QAccessibleInterface", + "QAccessibleEvent", + "QAccessible2Interface", + "QAccessibleTextInterface", + "QAccessibleEditableTextInterface", + "QAccessibleSimpleEditableTextInterface", + "QAccessibleValueInterface", + "QAccessibleTableInterface", + "QAccessibleTable2CellInterface", + "QAccessibleTable2Interface", + "QAccessibleActionInterface", + "QAccessibleImageInterface", + "QAccessibleBridgeFactoryInterface", + "QAccessibleBridgePlugin", + "QAccessibleObject", + "QAccessibleApplication", + "QAccessibleFactoryInterface", + "QAccessiblePlugin", + "QAccessibleWidget", + "QBrush", + "QGradient", + "QLinearGradient", + "QRadialGradient", + "QConicalGradient", + "QColor", + "QColormap", + "QMatrix", + "QPaintDevice", + "QTextItem", + "QPaintEngine", + "QPaintEngineState", + "QPainter", + "QPainterPath", + "QPainterPathStroker", + "QPen", + "QPolygon", + "QPolygonF", + "QPrintEngine", + "QPrinter", + "QPrinterInfo", + "QRegion", + "QTransform", + "QAbstractItemDelegate", + "QAbstractItemView", + "QAbstractProxyModel", + "QColumnView", + "QDataWidgetMapper", + "QDirModel", + "QFileIconProvider", + "QHeaderView", + "QIdentityProxyModel", + "QItemDelegate", + "QItemEditorCreatorBase", + "QItemEditorFactory", + "QItemSelectionRange", + "QItemSelectionModel", + "QItemSelection", + "QListView", + "QListWidgetItem", + "QListWidget", + "QProxyModel", + "QSortFilterProxyModel", + "QStandardItem", + "QStandardItemModel", + "QStringListModel", + "QStyledItemDelegate", + "QTableView", + "QTableWidgetSelectionRange", + "QTableWidgetItem", + "QTableWidget", + "QTreeView", + "QTreeWidgetItem", + "QTreeWidget", + "QTreeWidgetItemIterator", + "QGraphicsEffect", + "QGraphicsColorizeEffect", + "QGraphicsBlurEffect", + "QGraphicsDropShadowEffect", + "QGraphicsOpacityEffect", + "QMatrix4x4", + "QQuaternion", + "QVector2D", + "QVector3D", + "QVector4D", + "QAbstractButton", + "QAbstractScrollArea", + "QAbstractSlider", + "QAbstractSpinBox", + "QButtonGroup", + "QCalendarWidget", + "QCheckBox", + "QComboBox", + "QCommandLinkButton", + "QDateTimeEdit", + "QTimeEdit", + "QDateEdit", + "QDial", + "QDialogButtonBox", + "QDockWidget", + "QFocusFrame", + "QFontComboBox", + "QFrame", + "QGroupBox", + "QLabel", + "QLCDNumber", + "QLineEdit", + "QMainWindow", + "QMdiArea", + "QMdiSubWindow", + "QMenu", + "QMenuBar", + "QPlainTextEdit", + "QPlainTextDocumentLayout", + "QPrintPreviewWidget", + "QProgressBar", + "QPushButton", + "QRadioButton", + "QRubberBand", + "QScrollArea", + "QScrollBar", + "QSizeGrip", + "QSlider", + "QSpinBox", + "QDoubleSpinBox", + "QSplashScreen", + "QSplitter", + "QSplitterHandle", + "QStackedWidget", + "QStatusBar", + "QTabBar", + "QTabWidget", + "QTextBrowser", + "QTextEdit", + "QToolBar", + "QToolBox", + "QToolButton", + "QValidator", + "QIntValidator", + "QDoubleValidator", + "QRegExpValidator", + "QWorkspace", + "QCompleter", + "QDesktopServices", + "QSystemTrayIcon", + "QUndoGroup", + "QUndoCommand", + "QUndoStack", + "QUndoView", + "QAction", + "QActionGroup", + "QApplication", + "QBoxLayout", + "QHBoxLayout", + "QVBoxLayout", + "QClipboard", + "QCursor", + "QDesktopWidget", + "QDrag", + "QInputEvent", + "QMouseEvent", + "QHoverEvent", + "QWheelEvent", + "QKeyEvent", + "QFocusEvent", + "QPaintEvent", + "QMoveEvent", + "QResizeEvent", + "QCloseEvent", + "QIconDragEvent", + "QShowEvent", + "QHideEvent", + "QContextMenuEvent", + "QDropEvent", + "QDragMoveEvent", + "QDragEnterEvent", + "QDragResponseEvent", + "QDragLeaveEvent", + "QHelpEvent", + "QStatusTipEvent", + "QWhatsThisClickedEvent", + "QActionEvent", + "QFileOpenEvent", + "QToolBarChangeEvent", + "QShortcutEvent", + "QClipboardEvent", + "QWindowStateChangeEvent", + "QTouchEvent", + "QGestureEvent", + "QFormLayout", + "QGesture", + "QPanGesture", + "QPinchGesture", + "QSwipeGesture", + "QTapGesture", + "QTapAndHoldGesture", + "QGestureRecognizer", + "QGridLayout", + "QKeySequence", + "QLayout", + "QLayoutItem", + "QSpacerItem", + "QWidgetItem", + "QWidgetItemV2", + "QPalette", + "QShortcut", + "QSizePolicy", + "QStackedLayout", + "QToolTip", + "QWhatsThis", + "QWidget", + "QWidgetAction", + "QX11EmbedWidget", + "QX11EmbedContainer", + "QX11Info", + "QCDEStyle", + "QCleanlooksStyle", + "QCommonStyle", + "QMotifStyle", + "QPlastiqueStyle", + "QProxyStyle", + "QStyle", + "QStyleFactory", + "QStyleOption", + "QStyleOptionFocusRect", + "QStyleOptionFrame", + "QStyleOptionTabWidgetFrame", + "QStyleOptionTabBarBase", + "QStyleOptionHeader", + "QStyleOptionButton", + "QStyleOptionTab", + "QStyleOptionToolBar", + "QStyleOptionProgressBar", + "QStyleOptionMenuItem", + "QStyleOptionDockWidget", + "QStyleOptionViewItem", + "QStyleOptionToolBox", + "QStyleOptionRubberBand", + "QStyleOptionComplex", + "QStyleOptionSlider", + "QStyleOptionSpinBox", + "QStyleOptionToolButton", + "QStyleOptionComboBox", + "QStyleOptionTitleBar", + "QStyleOptionGroupBox", + "QStyleOptionSizeGrip", + "QStyleOptionGraphicsItem", + "QStyleHintReturn", + "QStyleHintReturnMask", + "QStyleHintReturnVariant", + "QStyleFactoryInterface", + "QStylePlugin", + "QWindowsStyle", + "QAbstractPageSetupDialog", + "QAbstractPrintDialog", + "QColorDialog", + "QDialog", + "QErrorMessage", + "QFileDialog", + "QFileSystemModel", + "QFontDialog", + "QInputDialog", + "QMessageBox", + "QPageSetupDialog", + "QPrintDialog", + "QPrintPreviewDialog", + "QProgressDialog", + "QWizard", + "QWizardPage", + "QBenchmarkIterationController", + "QTestData", + "QTestEventLoop", + "QTextCodec", + "QTextEncoder", + "QTextDecoder", + "QTextCodecFactoryInterface", + "QTextCodecPlugin", + "QXmlStreamAttribute", + "QXmlStreamAttributes", + "QXmlStreamNamespaceDeclaration", + "QXmlStreamNotationDeclaration", + "QXmlStreamEntityDeclaration", + "QXmlStreamEntityResolver", + "QXmlStreamReader", + "QXmlStreamWriter", + "QFutureInterfaceBase", + "QFutureWatcherBase", + "QThreadPool", + "QBitArray", + "QBitRef", + "QByteArray", + "QByteRef", + "QByteArrayMatcher", + "QChar", + "QCommandLineOption", + "QCommandLineParser", + "QContiguousCacheData", + "QCryptographicHash", + "QDate", + "QTime", + "QDateTime", + "QEasingCurve", + "QElapsedTimer", + "QHashData", + "QLine", + "QLineF", + "QLinkedListData", + "QListData", + "QSystemLocale", + "QLocale", + "QMapData", + "QPoint", + "QPointF", + "QRect", + "QRectF", + "QRegExp", + "QSharedData", + "QSize", + "QSizeF", + "QString", + "QLatin1String", + "QCharRef", + "QStringRef", + "QAbstractConcatenable", + "QStringList", + "QStringMatcher", + "QTextBoundaryFinder", + "QTimeLine", + "QVectorData", + "QAtomicInt", + "QAtomicPointer", + "QMutex", + "QMutexLocker", + "QReadWriteLock", + "QReadLocker", + "QWriteLocker", + "QSemaphore", + "QThread", + "QThreadStorageData", + "QWaitCondition", + "QFactoryInterface", + "QLibrary", + "QPluginLoader", + "QUuid", + "QAbstractAnimation", + "QAnimationDriver", + "QAnimationGroup", + "QParallelAnimationGroup", + "QPauseAnimation", + "QPropertyAnimation", + "QSequentialAnimationGroup", + "QVariantAnimation", + "QLibraryInfo", + "QInternal", + "QJsonArray", + "QJsonParseError", + "QJsonDocument", + "QJsonObject", + "QJsonValue", + "QJsonValueRef", + "QJsonValueRefPtr", + "QJsonValuePtr", + "QAbstractFileEngine", + "QAbstractFileEngineHandler", + "QAbstractFileEngineIterator", + "QBuffer", + "QDataStream", + "QDebug", + "QDir", + "QDirIterator", + "QFile", + "QFileInfo", + "QFileSystemWatcher", + "QFSFileEngine", + "QIODevice", + "QProcessEnvironment", + "QProcess", + "QResource", + "QSettings", + "QStandardPaths", + "QTemporaryFile", + "QTextStream", + "QTextStreamManipulator", + "QUrl", + "QAbstractEventDispatcher", + "QModelIndex", + "QPersistentModelIndex", + "QAbstractItemModel", + "QAbstractTableModel", + "QAbstractListModel", + "QBasicTimer", + "QCoreApplication", + "QEvent", + "QTimerEvent", + "QChildEvent", + "QDynamicPropertyChangeEvent", + "QEventLoop", + "QMetaMethod", + "QMetaEnum", + "QMetaProperty", + "QMetaClassInfo", + "QMetaType", + "QMimeData", + "QObject", + "QObjectCleanupHandler", + "QGenericArgument", + "QGenericReturnArgument", + "QMetaObject", + "QSharedMemory", + "QSignalMapper", + "QSocketNotifier", + "QSystemSemaphore", + "QTimer", + "QTranslator", + "QVariant", + "QDesignerComponents", + "QToolBarActionProvider", + "QMenuBarActionProvider", + "QMenuActionProvider", + "QDesignerResource", + "QtBrushManager", + "QExtensionFactory", + "QExtensionManager", + "QScriptEngineDebugger", + "QDBusAbstractAdaptor", + "QDBusAbstractInterfaceBase", + "QDBusAbstractInterface", + "QDBusArgument", + "QDBusConnection", + "QDBusConnectionInterface", + "QDBusContext", + "QDBusError", + "QDBusObjectPath", + "QDBusSignature", + "QDBusInterface", + "QDBusMessage", + "QDBusMetaType", + "QDBusPendingCall", + "QDBusPendingCallWatcher", + "QDBusPendingReplyData", + "QDBusServer", + "QDBusServiceWatcher", + "QDBusUnixFileDescriptor", + "QDBusVirtualObject", + "QDeclarativeComponent", + "QDeclarativeContext", + "QDeclarativeEngine", + "QDeclarativeError", + "QDeclarativeExpression", + "QDeclarativeExtensionInterface", + "QDeclarativeExtensionPlugin", + "QDeclarativeImageProvider", + "QDeclarativeInfo", + "QDeclarativeListReference", + "QDeclarativeNetworkAccessManagerFactory", + "QDeclarativeParserStatus", + "QDeclarativeProperty", + "QDeclarativePropertyValueInterceptor", + "QDeclarativePropertyValueSource", + "QDeclarativeScriptString", + "QDeclarativeItem", + "QDeclarativePropertyMap", + "QDeclarativeView", + "QSqlQueryModel", + "QSqlRelation", + "QSqlRelationalTableModel", + "QSqlTableModel", + "QSqlDriverCreatorBase", + "QSqlDatabase", + "QSqlDriver", + "QSqlDriverFactoryInterface", + "QSqlDriverPlugin", + "QSqlError", + "QSqlField", + "QSqlIndex", + "QSqlQuery", + "QSqlRecord", + "QSqlResult", +} + +cppfiles = [] +for root, dirs, files in os.walk(os.curdir): + for f in files: + if f.endswith(('.cpp', '.cc', '.hpp', '.h')): + cppfiles.append('%s/%s' % (root, f)) + +for cpp in cppfiles: + cpp = os.path.realpath(cpp) + cppbase = os.path.basename(cpp) + with open(cpp, 'r') as f: + cppcontent = f.read() + for match, sclass in re.findall('((?:class|struct) (%s);)' % '|'.join(classlist), cppcontent): + with open(cpp, 'w') as f: + print('replacing folrward declaration of %s with inclusion in: %s' % (sclass, cpp)) + cppcontent = cppcontent.replace(match, '#include <%s>' % sclass) + f.write(cppcontent)