| 684 | |
| 685 | class LibraryIncludes: |
| 686 | def __init__(self): |
| 687 | include_mappings = {'avr': ['<avr/'], |
| 688 | 'boost': ['<boost/'], |
| 689 | 'bsd': ['<sys/queue.h>', '<sys/tree.h>', '<sys/uio.h>','<bsd/', '<fts.h>', '<db.h>', '<err.h>', '<vis.h>'], |
| 690 | 'cairo': ['<cairo.h>'], |
| 691 | 'cppunit': ['<cppunit/'], |
| 692 | 'emscripten': ['<emscripten.h>'], |
| 693 | 'icu': ['<unicode/', '"unicode/'], |
| 694 | 'ginac': ['<ginac/', '"ginac/'], |
| 695 | 'googletest': ['<gtest/gtest.h>'], |
| 696 | 'gtk': ['<gtk', '<glib.h>', '<glib-', '<glib/', '<gdk/', '<gnome'], |
| 697 | 'kde': ['<KGlobal>', '<KApplication>', '<KLocalizedString>', '<KDE/', '<klocalizedstring.h>'], |
| 698 | 'libcerror': ['<libcerror.h>'], |
| 699 | 'libcurl': ['<curl/curl.h>'], |
| 700 | 'libsigc++': ['<sigc++/'], |
| 701 | 'lua': ['<lua.h>', '"lua.h"'], |
| 702 | 'mfc': ['<afx.h>', '<afxwin.h>', '<afxext.h>'], |
| 703 | 'microsoft_atl': ['<atlbase.h>'], |
| 704 | 'microsoft_sal': ['<sal.h>'], |
| 705 | 'microsoft_unittest': ['<CppUnitTest.h>'], |
| 706 | 'motif': ['<X11/', '<Xm/'], |
| 707 | 'nspr': ['<prtypes.h>', '"prtypes.h"'], |
| 708 | 'ntl': ['<ntl/', '"ntl/'], |
| 709 | 'opencv2': ['<opencv2/', '"opencv2/'], |
| 710 | 'opengl': ['<GL/gl.h>', '<GL/glu.h>', '<GL/glut.h>'], |
| 711 | 'openmp': ['<omp.h>'], |
| 712 | 'openssl': ['<openssl/'], |
| 713 | 'pcre': ['<pcre.h>', '"pcre.h"'], |
| 714 | 'python': ['<Python.h>', '"Python.h"'], |
| 715 | 'qt': ['<QAbstractSeries>', '<QAction>', '<QActionGroup>', '<QApplication>', '<QByteArray>', '<QChartView>', '<QClipboard>', '<QCloseEvent>', '<QColor>', '<QColorDialog>', '<QComboBox>', '<QCoreApplication>', '<QCryptographicHash>', '<QDate>', '<QDateTime>', '<QDateTimeAxis>', '<QDebug>', '<QDesktopServices>', '<QDialog>', '<QDialogButtonBox>', '<QDir>', '<QElapsedTimer>', '<QFile>', '<QFileDialog>', '<QFileInfo>', '<QFileInfoList>', '<QFlags>', '<QFont>', '<QFormLayout>', '<QHelpContentWidget>', '<QHelpEngine>', '<QHelpIndexWidget>', '<QImageReader>', '<QInputDialog>', '<QKeyEvent>', '<QLabel>', '<QLineSeries>', '<QList>', '<qlist.h>', '<QLocale>', '<QMainWindow>', '<QMap>', '<QMenu>', '<QMessageBox>', '<QMetaType>', '<QMimeData>', '<QMimeDatabase>', '<QMimeType>', '<QMutex>', '<QObject>', '<qobjectdefs.h>', '<QPainter>', '<QPlainTextEdit>', '<QPrintDialog>', '<QPrinter>', '<QPrintPreviewDialog>', '<QProcess>', '<QPushButton>', '<QQueue>', '<QReadWriteLock>', '<QRegularExpression>', '<QRegularExpressionValidator>', '<QSet>', '<QSettings>', '<QShortcut>', '<QSignalMapper>', '<QStandardItemModel>', '<QString>', '<qstring.h>', '<QStringList>', '<QSyntaxHighlighter>', '<QTest>', '<QTextBrowser>', '<QTextDocument>', '<QTextEdit>', '<QTextStream>', '<QThread>', '<QTimer>', '<QTranslator>', '<QTreeView>', '<QtWidgets>', '<QUrl>', '<QValueAxis>', '<QVariant>', '<QWaitCondition>', '<QWidget>', '<QXmlStreamReader>', '<QXmlStreamWriter>', '<QtGui'], |
| 716 | 'ruby': ['<ruby.h>', '<ruby/', '"ruby.h"'], |
| 717 | 'sdl': ['<SDL.h>', '<SDL/SDL.h>', '<SDL2/SDL.h>'], |
| 718 | 'selinux': ['<selinux/'], |
| 719 | 'sfml': ['<SFML/'], |
| 720 | 'sqlite3': ['<sqlite3.h>', '"sqlite3.h"'], |
| 721 | 'tinyxml2': ['<tinyxml2', '"tinyxml2'], |
| 722 | 'wxsqlite3': ['<wx/wxsqlite3', '"wx/wxsqlite3'], |
| 723 | 'wxwidgets': ['<wx/', '"wx/'], |
| 724 | 'zephyr': ['<zephyr/'], |
| 725 | 'zlib': ['<zlib.h>'], |
| 726 | } |
| 727 | |
| 728 | self.__library_includes_re = {} |
| 729 | |
| 730 | for library, includes in include_mappings.items(): |
| 731 | re_includes = [re.escape(inc) for inc in includes] |
| 732 | re_expr = '^[ \\t]*#[ \\t]*include[ \\t]*(?:' + '|'.join(re_includes) + ')' |
| 733 | re_obj = re.compile(re_expr, re.MULTILINE) |
| 734 | self.__library_includes_re[library] = re_obj |
| 735 | |
| 736 | def __iterate_files(self, path, has_include_cb): |
| 737 | for root, _, files in os.walk(path): |