Merge branch 'master' of github.com:royqh1979/RedPanda-CPP

This commit is contained in:
Roy Qu 2024-04-11 18:59:37 +08:00
commit 306e1b6bc4
27 changed files with 383 additions and 669 deletions

View File

@ -131,6 +131,8 @@ Red Panda C++ Version 2.27
- fix: Can't find the correct type if current symbol is member of a class that has constructors. - fix: Can't find the correct type if current symbol is member of a class that has constructors.
- fix: Alias a namespace to itself will create infinite loop. - fix: Alias a namespace to itself will create infinite loop.
- fix: Can't find symbols indirectly included by other files. - fix: Can't find symbols indirectly included by other files.
- enhancement: Function tip's width changes with editor width.
- fix: '<' / '>' not shown in function tips.
Red Panda C++ Version 2.26 Red Panda C++ Version 2.26
- enhancement: Code suggestion for embedded std::vectors. - enhancement: Code suggestion for embedded std::vectors.

View File

@ -401,7 +401,7 @@ QStringList Compiler::getCharsetArgument(const QByteArray& encoding,FileType fil
//qDebug()<<encodingName<<execEncodingName; //qDebug()<<encodingName<<execEncodingName;
if (checkSyntax) { if (checkSyntax) {
result << "-finput-charset=" + encodingName; result << "-finput-charset=" + encodingName;
} else if (encodingName!=execEncodingName) { } else if (QString::compare(encodingName, execEncodingName, Qt::CaseInsensitive) != 0) {
result += { result += {
"-finput-charset=" + encodingName, "-finput-charset=" + encodingName,
"-fexec-charset=" + execEncodingName, "-fexec-charset=" + execEncodingName,

View File

@ -478,7 +478,7 @@ void ProjectCompiler::writeMakeObjFilesRules(QFile &file)
if (sourceEncoding==ENCODING_SYSTEM_DEFAULT) if (sourceEncoding==ENCODING_SYSTEM_DEFAULT)
sourceEncoding = defaultSystemEncoding; sourceEncoding = defaultSystemEncoding;
if (sourceEncoding!=targetEncoding) { if (QString::compare(sourceEncoding,targetEncoding,Qt::CaseInsensitive)!=0) {
encodingStr = QString(" -finput-charset=%1 -fexec-charset=%2") encodingStr = QString(" -finput-charset=%1 -fexec-charset=%2")
.arg(QString(sourceEncoding), .arg(QString(sourceEncoding),
QString(targetEncoding)); QString(targetEncoding));

View File

@ -1640,6 +1640,7 @@ void Editor::hideEvent(QHideEvent */*event*/)
void Editor::resizeEvent(QResizeEvent *event) void Editor::resizeEvent(QResizeEvent *event)
{ {
QSynedit::QSynEdit::resizeEvent(event); QSynedit::QSynEdit::resizeEvent(event);
pMainWindow->functionTip()->setMinWidth(width()*3/4);
pMainWindow->functionTip()->hide(); pMainWindow->functionTip()->hide();
} }

View File

@ -399,8 +399,8 @@ MainWindow::MainWindow(QWidget *parent)
m=ui->treeFiles->selectionModel(); m=ui->treeFiles->selectionModel();
ui->treeFiles->setModel(&mFileSystemModel); ui->treeFiles->setModel(&mFileSystemModel);
delete m; delete m;
connect(&mFileSystemModel, &QFileSystemModel::layoutChanged, // connect(&mFileSystemModel, &QFileSystemModel::layoutChanged,
this, &MainWindow::onFileSystemModelLayoutChanged, Qt::QueuedConnection); // this, &MainWindow::onFileSystemModelLayoutChanged, Qt::QueuedConnection);
connect(&mFileSystemModel, &QFileSystemModel::fileRenamed, connect(&mFileSystemModel, &QFileSystemModel::fileRenamed,
this, &MainWindow::onFileSystemModelLayoutChanged, Qt::QueuedConnection); this, &MainWindow::onFileSystemModelLayoutChanged, Qt::QueuedConnection);
connect(&mFileSystemModel, &QFileSystemModel::fileRenamed, connect(&mFileSystemModel, &QFileSystemModel::fileRenamed,

View File

@ -119,8 +119,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>2345</width> <width>1236</width>
<height>30</height> <height>17</height>
</rect> </rect>
</property> </property>
<widget class="QMenu" name="menuFile"> <widget class="QMenu" name="menuFile">
@ -795,6 +795,11 @@
<property name="text"> <property name="text">
<string>New Problem Set</string> <string>New Problem Set</string>
</property> </property>
<property name="icon">
<iconset>
<normalon>:/resources/iconsets/newlook/actions/08Problem-01Problem.svg</normalon>
</iconset>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -805,6 +810,11 @@
<property name="text"> <property name="text">
<string>Add Problem</string> <string>Add Problem</string>
</property> </property>
<property name="icon">
<iconset>
<normalon>:/resources/iconsets/newlook/actions/00Misc-03Add.svg</normalon>
</iconset>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -815,6 +825,11 @@
<property name="text"> <property name="text">
<string>Remove Problem</string> <string>Remove Problem</string>
</property> </property>
<property name="icon">
<iconset>
<normalon>:/resources/iconsets/newlook/actions/00Misc-04Remove.svg</normalon>
</iconset>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -825,6 +840,11 @@
<property name="text"> <property name="text">
<string>Save Problem Set</string> <string>Save Problem Set</string>
</property> </property>
<property name="icon">
<iconset>
<normalon>:/resources/iconsets/newlook/actions/01File-04SaveAs.svg</normalon>
</iconset>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -835,6 +855,11 @@
<property name="text"> <property name="text">
<string>Load Problem Set</string> <string>Load Problem Set</string>
</property> </property>
<property name="icon">
<iconset>
<normalon>:/resources/iconsets/newlook/actions/06View-03Files.svg</normalon>
</iconset>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -842,6 +867,11 @@
<property name="text"> <property name="text">
<string>Import FPS Problem Set</string> <string>Import FPS Problem Set</string>
</property> </property>
<property name="icon">
<iconset>
<normalon>:/resources/iconsets/newlook/actions/00Misc-01Back.svg</normalon>
</iconset>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -849,6 +879,11 @@
<property name="text"> <property name="text">
<string>Export FPS Problem Set</string> <string>Export FPS Problem Set</string>
</property> </property>
<property name="icon">
<iconset>
<normalon>:/resources/iconsets/newlook/actions/00Misc-02Forward.svg</normalon>
</iconset>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -917,7 +952,7 @@
<enum>QTabWidget::South</enum> <enum>QTabWidget::South</enum>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>6</number> <number>2</number>
</property> </property>
<property name="iconSize"> <property name="iconSize">
<size> <size>
@ -946,7 +981,6 @@
<widget class="IssuesTable" name="tableIssues"> <widget class="IssuesTable" name="tableIssues">
<property name="font"> <property name="font">
<font> <font>
<weight>50</weight>
<bold>false</bold> <bold>false</bold>
</font> </font>
</property> </property>
@ -1098,7 +1132,7 @@
<enum>QTabWidget::North</enum> <enum>QTabWidget::North</enum>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>3</number>
</property> </property>
<widget class="QWidget" name="tabDebugConsole"> <widget class="QWidget" name="tabDebugConsole">
<attribute name="title"> <attribute name="title">
@ -1628,6 +1662,10 @@
<property name="text"> <property name="text">
<string>Add Probem Case</string> <string>Add Probem Case</string>
</property> </property>
<property name="icon">
<iconset resource="Z:/Red_Panda_CPP/RedPandaIDE/release/qmake_iconsets_files.qrc">
<normaloff>:/resources/iconsets/newlook/actions/00Misc-03Add.svg</normaloff>:/resources/iconsets/newlook/actions/00Misc-03Add.svg</iconset>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -1638,6 +1676,10 @@
<property name="text"> <property name="text">
<string>Remove Problem Case</string> <string>Remove Problem Case</string>
</property> </property>
<property name="icon">
<iconset resource="Z:/Red_Panda_CPP/RedPandaIDE/release/qmake_iconsets_files.qrc">
<normaloff>:/resources/iconsets/newlook/actions/00Misc-04Remove.svg</normaloff>:/resources/iconsets/newlook/actions/00Misc-04Remove.svg</iconset>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -1648,6 +1690,10 @@
<property name="text"> <property name="text">
<string>Open Anwser Source File</string> <string>Open Anwser Source File</string>
</property> </property>
<property name="icon">
<iconset resource="Z:/Red_Panda_CPP/RedPandaIDE/release/qmake_iconsets_files.qrc">
<normaloff>:/resources/iconsets/newlook/actions/08Problem-04EditSource.svg</normaloff>:/resources/iconsets/newlook/actions/08Problem-04EditSource.svg</iconset>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -1665,6 +1711,10 @@
<property name="text"> <property name="text">
<string>Run All Cases</string> <string>Run All Cases</string>
</property> </property>
<property name="icon">
<iconset resource="Z:/Red_Panda_CPP/RedPandaIDE/release/qmake_iconsets_files.qrc">
<normaloff>:/resources/iconsets/newlook/actions/08Problem-05RunCases.svg</normaloff>:/resources/iconsets/newlook/actions/08Problem-05RunCases.svg</iconset>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -1672,6 +1722,10 @@
<property name="text"> <property name="text">
<string>Problem Cases Validation Options</string> <string>Problem Cases Validation Options</string>
</property> </property>
<property name="icon">
<iconset resource="Z:/Red_Panda_CPP/RedPandaIDE/release/qmake_iconsets_files.qrc">
<normaloff>:/resources/iconsets/newlook/actions/00Misc-05Gear.svg</normaloff>:/resources/iconsets/newlook/actions/00Misc-05Gear.svg</iconset>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -1789,6 +1843,10 @@
<property name="text"> <property name="text">
<string>Choose Input File</string> <string>Choose Input File</string>
</property> </property>
<property name="icon">
<iconset resource="Z:/Red_Panda_CPP/RedPandaIDE/release/qmake_iconsets_files.qrc">
<normaloff>:/resources/iconsets/newlook/actions/00Misc-07Folder.svg</normaloff>:/resources/iconsets/newlook/actions/00Misc-07Folder.svg</iconset>
</property>
</widget> </widget>
</item> </item>
<item row="0" column="2"> <item row="0" column="2">
@ -1904,6 +1962,10 @@
<property name="text"> <property name="text">
<string>Choose Expected Output File</string> <string>Choose Expected Output File</string>
</property> </property>
<property name="icon">
<iconset resource="Z:/Red_Panda_CPP/RedPandaIDE/release/qmake_iconsets_files.qrc">
<normaloff>:/resources/iconsets/newlook/actions/00Misc-07Folder.svg</normaloff>:/resources/iconsets/newlook/actions/00Misc-07Folder.svg</iconset>
</property>
</widget> </widget>
</item> </item>
</layout> </layout>
@ -1973,6 +2035,10 @@
</widget> </widget>
</widget> </widget>
<action name="actionNew"> <action name="actionNew">
<property name="icon">
<iconset resource="Z:/Red_Panda_CPP/RedPandaIDE/release/qmake_iconsets_files.qrc">
<normaloff>:/resources/iconsets/newlook/actions/01File-01New.svg</normaloff>:/resources/iconsets/newlook/actions/01File-01New.svg</iconset>
</property>
<property name="text"> <property name="text">
<string>New C/C++ File</string> <string>New C/C++ File</string>
</property> </property>
@ -1984,6 +2050,10 @@
</property> </property>
</action> </action>
<action name="actionOpen"> <action name="actionOpen">
<property name="icon">
<iconset resource="Z:/Red_Panda_CPP/RedPandaIDE/release/qmake_iconsets_files.qrc">
<normaloff>:/resources/iconsets/newlook/actions/01File-02Open.svg</normaloff>:/resources/iconsets/newlook/actions/01File-02Open.svg</iconset>
</property>
<property name="text"> <property name="text">
<string>Open...</string> <string>Open...</string>
</property> </property>
@ -1992,6 +2062,10 @@
</property> </property>
</action> </action>
<action name="actionSave"> <action name="actionSave">
<property name="icon">
<iconset resource="Z:/Red_Panda_CPP/RedPandaIDE/release/qmake_iconsets_files.qrc">
<normaloff>:/resources/iconsets/newlook/actions/01File-03Save.svg</normaloff>:/resources/iconsets/newlook/actions/01File-03Save.svg</iconset>
</property>
<property name="text"> <property name="text">
<string>Save</string> <string>Save</string>
</property> </property>
@ -2000,6 +2074,10 @@
</property> </property>
</action> </action>
<action name="actionSaveAs"> <action name="actionSaveAs">
<property name="icon">
<iconset resource="Z:/Red_Panda_CPP/RedPandaIDE/release/qmake_iconsets_files.qrc">
<normaloff>:/resources/iconsets/newlook/actions/01File-04SaveAs.svg</normaloff>:/resources/iconsets/newlook/actions/01File-04SaveAs.svg</iconset>
</property>
<property name="text"> <property name="text">
<string>Save As...</string> <string>Save As...</string>
</property> </property>
@ -2011,6 +2089,10 @@
</property> </property>
</action> </action>
<action name="actionSaveAll"> <action name="actionSaveAll">
<property name="icon">
<iconset resource="Z:/Red_Panda_CPP/RedPandaIDE/release/qmake_iconsets_files.qrc">
<normaloff>:/resources/iconsets/newlook/actions/01File-05SaveAll.svg</normaloff>:/resources/iconsets/newlook/actions/01File-05SaveAll.svg</iconset>
</property>
<property name="text"> <property name="text">
<string>Save All</string> <string>Save All</string>
</property> </property>
@ -2019,11 +2101,19 @@
</property> </property>
</action> </action>
<action name="actionOptions"> <action name="actionOptions">
<property name="icon">
<iconset resource="Z:/Red_Panda_CPP/RedPandaIDE/release/qmake_iconsets_files.qrc">
<normaloff>:/resources/iconsets/newlook/actions/00Misc-05Gear.svg</normaloff>:/resources/iconsets/newlook/actions/00Misc-05Gear.svg</iconset>
</property>
<property name="text"> <property name="text">
<string>Options</string> <string>Options</string>
</property> </property>
</action> </action>
<action name="actionCompile"> <action name="actionCompile">
<property name="icon">
<iconset resource="Z:/Red_Panda_CPP/RedPandaIDE/release/qmake_iconsets_files.qrc">
<normaloff>:/resources/iconsets/newlook/actions/05Run-01Compile.svg</normaloff>:/resources/iconsets/newlook/actions/05Run-01Compile.svg</iconset>
</property>
<property name="text"> <property name="text">
<string>Compile</string> <string>Compile</string>
</property> </property>
@ -2035,6 +2125,10 @@
</property> </property>
</action> </action>
<action name="actionRun"> <action name="actionRun">
<property name="icon">
<iconset resource="Z:/Red_Panda_CPP/RedPandaIDE/release/qmake_iconsets_files.qrc">
<normaloff>:/resources/iconsets/newlook/actions/05Run-03Run.svg</normaloff>:/resources/iconsets/newlook/actions/05Run-03Run.svg</iconset>
</property>
<property name="text"> <property name="text">
<string>Run</string> <string>Run</string>
</property> </property>
@ -2046,6 +2140,10 @@
</property> </property>
</action> </action>
<action name="actionUndo"> <action name="actionUndo">
<property name="icon">
<iconset resource="Z:/Red_Panda_CPP/RedPandaIDE/release/qmake_iconsets_files.qrc">
<normaloff>:/resources/iconsets/newlook/actions/03Edit-01Undo.svg</normaloff>:/resources/iconsets/newlook/actions/03Edit-01Undo.svg</iconset>
</property>
<property name="text"> <property name="text">
<string>Undo</string> <string>Undo</string>
</property> </property>
@ -2054,6 +2152,10 @@
</property> </property>
</action> </action>
<action name="actionRedo"> <action name="actionRedo">
<property name="icon">
<iconset resource="Z:/Red_Panda_CPP/RedPandaIDE/release/qmake_iconsets_files.qrc">
<normaloff>:/resources/iconsets/newlook/actions/03Edit-02Redo.svg</normaloff>:/resources/iconsets/newlook/actions/03Edit-02Redo.svg</iconset>
</property>
<property name="text"> <property name="text">
<string>Redo</string> <string>Redo</string>
</property> </property>
@ -2062,6 +2164,10 @@
</property> </property>
</action> </action>
<action name="actionCut"> <action name="actionCut">
<property name="icon">
<iconset resource="Z:/Red_Panda_CPP/RedPandaIDE/release/qmake_iconsets_files.qrc">
<normaloff>:/resources/iconsets/newlook/actions/03Edit-03Cut.svg</normaloff>:/resources/iconsets/newlook/actions/03Edit-03Cut.svg</iconset>
</property>
<property name="text"> <property name="text">
<string>Cut</string> <string>Cut</string>
</property> </property>
@ -2070,6 +2176,10 @@
</property> </property>
</action> </action>
<action name="actionCopy"> <action name="actionCopy">
<property name="icon">
<iconset resource="Z:/Red_Panda_CPP/RedPandaIDE/release/qmake_iconsets_files.qrc">
<normaloff>:/resources/iconsets/newlook/actions/03Edit-04Copy.svg</normaloff>:/resources/iconsets/newlook/actions/03Edit-04Copy.svg</iconset>
</property>
<property name="text"> <property name="text">
<string>Copy</string> <string>Copy</string>
</property> </property>
@ -2078,6 +2188,10 @@
</property> </property>
</action> </action>
<action name="actionPaste"> <action name="actionPaste">
<property name="icon">
<iconset resource="Z:/Red_Panda_CPP/RedPandaIDE/release/qmake_iconsets_files.qrc">
<normaloff>:/resources/iconsets/newlook/actions/03Edit-05Paste.svg</normaloff>:/resources/iconsets/newlook/actions/03Edit-05Paste.svg</iconset>
</property>
<property name="text"> <property name="text">
<string>Paste</string> <string>Paste</string>
</property> </property>
@ -2094,6 +2208,10 @@
</property> </property>
</action> </action>
<action name="actionIndent"> <action name="actionIndent">
<property name="icon">
<iconset resource="Z:/Red_Panda_CPP/RedPandaIDE/release/qmake_iconsets_files.qrc">
<normaloff>:/resources/iconsets/newlook/actions/03Edit-06Indent.svg</normaloff>:/resources/iconsets/newlook/actions/03Edit-06Indent.svg</iconset>
</property>
<property name="text"> <property name="text">
<string>Indent</string> <string>Indent</string>
</property> </property>
@ -2102,6 +2220,10 @@
</property> </property>
</action> </action>
<action name="actionUnIndent"> <action name="actionUnIndent">
<property name="icon">
<iconset resource="Z:/Red_Panda_CPP/RedPandaIDE/release/qmake_iconsets_files.qrc">
<normaloff>:/resources/iconsets/newlook/actions/03Edit-07Unindent.svg</normaloff>:/resources/iconsets/newlook/actions/03Edit-07Unindent.svg</iconset>
</property>
<property name="text"> <property name="text">
<string>UnIndent</string> <string>UnIndent</string>
</property> </property>
@ -2156,6 +2278,10 @@
</property> </property>
</action> </action>
<action name="actionRebuild"> <action name="actionRebuild">
<property name="icon">
<iconset resource="Z:/Red_Panda_CPP/RedPandaIDE/release/qmake_iconsets_files.qrc">
<normaloff>:/resources/iconsets/newlook/actions/05Run-04Rebuild.svg</normaloff>:/resources/iconsets/newlook/actions/05Run-04Rebuild.svg</iconset>
</property>
<property name="text"> <property name="text">
<string>Rebuild All</string> <string>Rebuild All</string>
</property> </property>
@ -2167,6 +2293,10 @@
</property> </property>
</action> </action>
<action name="actionStop_Execution"> <action name="actionStop_Execution">
<property name="icon">
<iconset resource="Z:/Red_Panda_CPP/RedPandaIDE/release/qmake_iconsets_files.qrc">
<normaloff>:/resources/iconsets/newlook/actions/05Run-11Stop.svg</normaloff>:/resources/iconsets/newlook/actions/05Run-11Stop.svg</iconset>
</property>
<property name="text"> <property name="text">
<string>Stop Execution</string> <string>Stop Execution</string>
</property> </property>
@ -2175,6 +2305,10 @@
</property> </property>
</action> </action>
<action name="actionDebug"> <action name="actionDebug">
<property name="icon">
<iconset resource="Z:/Red_Panda_CPP/RedPandaIDE/release/qmake_iconsets_files.qrc">
<normaloff>:/resources/iconsets/newlook/actions/05Run-06Debug.svg</normaloff>:/resources/iconsets/newlook/actions/05Run-06Debug.svg</iconset>
</property>
<property name="text"> <property name="text">
<string>Debug</string> <string>Debug</string>
</property> </property>
@ -2186,6 +2320,10 @@
</property> </property>
</action> </action>
<action name="actionStep_Over"> <action name="actionStep_Over">
<property name="icon">
<iconset resource="Z:/Red_Panda_CPP/RedPandaIDE/release/qmake_iconsets_files.qrc">
<normaloff>:/resources/iconsets/newlook/actions/05Run-07StepOver.svg</normaloff>:/resources/iconsets/newlook/actions/05Run-07StepOver.svg</iconset>
</property>
<property name="text"> <property name="text">
<string>Step Over</string> <string>Step Over</string>
</property> </property>
@ -2194,6 +2332,10 @@
</property> </property>
</action> </action>
<action name="actionStep_Into"> <action name="actionStep_Into">
<property name="icon">
<iconset resource="Z:/Red_Panda_CPP/RedPandaIDE/release/qmake_iconsets_files.qrc">
<normaloff>:/resources/iconsets/newlook/actions/05Run-08StepInto.svg</normaloff>:/resources/iconsets/newlook/actions/05Run-08StepInto.svg</iconset>
</property>
<property name="text"> <property name="text">
<string>Step Into</string> <string>Step Into</string>
</property> </property>
@ -2202,6 +2344,10 @@
</property> </property>
</action> </action>
<action name="actionStep_Out"> <action name="actionStep_Out">
<property name="icon">
<iconset resource="Z:/Red_Panda_CPP/RedPandaIDE/release/qmake_iconsets_files.qrc">
<normaloff>:/resources/iconsets/newlook/actions/05Run-08StepOut.svg</normaloff>:/resources/iconsets/newlook/actions/05Run-08StepOut.svg</iconset>
</property>
<property name="text"> <property name="text">
<string>Step Out</string> <string>Step Out</string>
</property> </property>
@ -2210,6 +2356,10 @@
</property> </property>
</action> </action>
<action name="actionRun_To_Cursor"> <action name="actionRun_To_Cursor">
<property name="icon">
<iconset resource="Z:/Red_Panda_CPP/RedPandaIDE/release/qmake_iconsets_files.qrc">
<normaloff>:/resources/iconsets/newlook/actions/05Run-09RunToCursor.svg</normaloff>:/resources/iconsets/newlook/actions/05Run-09RunToCursor.svg</iconset>
</property>
<property name="text"> <property name="text">
<string>Run To Cursor</string> <string>Run To Cursor</string>
</property> </property>
@ -2218,6 +2368,10 @@
</property> </property>
</action> </action>
<action name="actionContinue"> <action name="actionContinue">
<property name="icon">
<iconset resource="Z:/Red_Panda_CPP/RedPandaIDE/release/qmake_iconsets_files.qrc">
<normaloff>:/resources/iconsets/newlook/actions/05Run-10Continue.svg</normaloff>:/resources/iconsets/newlook/actions/05Run-10Continue.svg</iconset>
</property>
<property name="text"> <property name="text">
<string>Continue</string> <string>Continue</string>
</property> </property>
@ -2226,6 +2380,10 @@
</property> </property>
</action> </action>
<action name="actionAdd_Watch"> <action name="actionAdd_Watch">
<property name="icon">
<iconset resource="Z:/Red_Panda_CPP/RedPandaIDE/release/qmake_iconsets_files.qrc">
<normaloff>:/resources/iconsets/newlook/actions/05Run-12AddWatch.svg</normaloff>:/resources/iconsets/newlook/actions/05Run-12AddWatch.svg</iconset>
</property>
<property name="text"> <property name="text">
<string>Add Watch...</string> <string>Add Watch...</string>
</property> </property>
@ -2281,6 +2439,10 @@
</property> </property>
</action> </action>
<action name="actionRemove_Watch"> <action name="actionRemove_Watch">
<property name="icon">
<iconset resource="Z:/Red_Panda_CPP/RedPandaIDE/release/qmake_iconsets_files.qrc">
<normaloff>:/resources/iconsets/newlook/actions/05Run-13RemoveWatch.svg</normaloff>:/resources/iconsets/newlook/actions/05Run-13RemoveWatch.svg</iconset>
</property>
<property name="text"> <property name="text">
<string>Remove Watch</string> <string>Remove Watch</string>
</property> </property>
@ -2296,6 +2458,10 @@
</property> </property>
</action> </action>
<action name="actionReformat_Code"> <action name="actionReformat_Code">
<property name="icon">
<iconset resource="Z:/Red_Panda_CPP/RedPandaIDE/release/qmake_iconsets_files.qrc">
<normaloff>:/resources/iconsets/newlook/actions/04Code-05Reformat.svg</normaloff>:/resources/iconsets/newlook/actions/04Code-05Reformat.svg</iconset>
</property>
<property name="text"> <property name="text">
<string>Reformat Code</string> <string>Reformat Code</string>
</property> </property>
@ -2304,6 +2470,10 @@
</property> </property>
</action> </action>
<action name="actionBack"> <action name="actionBack">
<property name="icon">
<iconset resource="Z:/Red_Panda_CPP/RedPandaIDE/release/qmake_iconsets_files.qrc">
<normaloff>:/resources/iconsets/newlook/actions/04Code-01Back.svg</normaloff>:/resources/iconsets/newlook/actions/04Code-01Back.svg</iconset>
</property>
<property name="text"> <property name="text">
<string>Go back</string> <string>Go back</string>
</property> </property>
@ -2312,6 +2482,10 @@
</property> </property>
</action> </action>
<action name="actionForward"> <action name="actionForward">
<property name="icon">
<iconset resource="Z:/Red_Panda_CPP/RedPandaIDE/release/qmake_iconsets_files.qrc">
<normaloff>:/resources/iconsets/newlook/actions/04Code-02Forward.svg</normaloff>:/resources/iconsets/newlook/actions/04Code-02Forward.svg</iconset>
</property>
<property name="text"> <property name="text">
<string>Forward</string> <string>Forward</string>
</property> </property>
@ -2561,6 +2735,10 @@
</property> </property>
</action> </action>
<action name="actionRun_Parameters"> <action name="actionRun_Parameters">
<property name="icon">
<iconset resource="Z:/Red_Panda_CPP/RedPandaIDE/release/qmake_iconsets_files.qrc">
<normaloff>:/resources/iconsets/newlook/actions/05Run-05Options.svg</normaloff>:/resources/iconsets/newlook/actions/05Run-05Options.svg</iconset>
</property>
<property name="text"> <property name="text">
<string>Running Parameters...</string> <string>Running Parameters...</string>
</property> </property>
@ -2723,6 +2901,10 @@
</property> </property>
</action> </action>
<action name="actionInterrupt"> <action name="actionInterrupt">
<property name="icon">
<iconset resource="Z:/Red_Panda_CPP/RedPandaIDE/release/qmake_iconsets_files.qrc">
<normaloff>:/resources/iconsets/newlook/actions/05Run-16Interrupt.svg</normaloff>:/resources/iconsets/newlook/actions/05Run-16Interrupt.svg</iconset>
</property>
<property name="text"> <property name="text">
<string>Interrupt</string> <string>Interrupt</string>
</property> </property>
@ -2883,6 +3065,10 @@
</property> </property>
</action> </action>
<action name="actionCompiler_Options"> <action name="actionCompiler_Options">
<property name="icon">
<iconset resource="Z:/Red_Panda_CPP/RedPandaIDE/release/qmake_iconsets_files.qrc">
<normaloff>:/resources/iconsets/newlook/actions/05Run-17CompilerOptions.svg</normaloff>:/resources/iconsets/newlook/actions/05Run-17CompilerOptions.svg</iconset>
</property>
<property name="text"> <property name="text">
<string>Compiler Options...</string> <string>Compiler Options...</string>
</property> </property>
@ -3197,6 +3383,8 @@
<container>1</container> <container>1</container>
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<resources/> <resources>
<include location="Z:/Red_Panda_CPP/RedPandaIDE/release/qmake_iconsets_files.qrc"/>
</resources>
<connections/> <connections/>
</ui> </ui>

View File

@ -1524,11 +1524,13 @@ PStatement CppParser::addStatement(const PStatement &parent,
QChar ch=mTokenizer[i]->text[0]; QChar ch=mTokenizer[i]->text[0];
if (this->isIdentChar(ch)) { if (this->isIdentChar(ch)) {
QString spaces=(i>argStart)?" ":""; QString spaces=(i>argStart)?" ":"";
if (args.length()>0 && isWordChar(args.back())) if (args.length()>0 && (isWordChar(args.back()) || args.back()=='>'))
args+=spaces; args+=spaces;
word += mTokenizer[i]->text; word += mTokenizer[i]->text;
if (!typeGetted) { if (!typeGetted) {
noNameArgs+=spaces+word; if (noNameArgs.length()>0 && isWordChar(noNameArgs.back()))
noNameArgs+=spaces;
noNameArgs+=word;
if (mCppTypeKeywords.contains(word) || !isCppKeyword(word)) if (mCppTypeKeywords.contains(word) || !isCppKeyword(word))
typeGetted = true; typeGetted = true;
} else { } else {
@ -1541,6 +1543,7 @@ PStatement CppParser::addStatement(const PStatement &parent,
} else if (mTokenizer[i]->text=="::") { } else if (mTokenizer[i]->text=="::") {
if (braceLevel==0) { if (braceLevel==0) {
noNameArgs+= mTokenizer[i]->text; noNameArgs+= mTokenizer[i]->text;
typeGetted = false;
} }
} else { } else {
switch(ch.unicode()) { switch(ch.unicode()) {

View File

@ -138,11 +138,6 @@ void CppPreprocessor::getDefineParts(const QString &input, QString &name, QStrin
args.squeeze(); args.squeeze();
} }
void CppPreprocessor::addHardDefineByLine(const QString &line)
{
addDefineByLine(line,true);
}
void CppPreprocessor::addDefineByLine(const QString &line, bool hardCoded) void CppPreprocessor::addDefineByLine(const QString &line, bool hardCoded)
{ {
// Remove define // Remove define
@ -157,22 +152,13 @@ void CppPreprocessor::addDefineByLine(const QString &line, bool hardCoded)
addDefineByParts(name, args, value, hardCoded); addDefineByParts(name, args, value, hardCoded);
} }
void CppPreprocessor::setScanOptions(bool parseSystem, bool parseLocal)
{
mParseSystem = parseSystem;
mParseLocal=parseLocal;
}
void CppPreprocessor::preprocess(const QString &fileName) void CppPreprocessor::preprocess(const QString &fileName)
{ {
clearTempResults(); clearTempResults();
mFileName = fileName; mFileName = fileName;
//mDefines = mHardDefines;
openInclude(fileName); openInclude(fileName);
// StringsToFile(mBuffer,"f:\\buffer.txt");
preprocessBuffer(); preprocessBuffer();
// StringsToFile(mBuffer,"f:\\buffer.txt");
// StringsToFile(mResult,"f:\\log.txt");
} }
void CppPreprocessor::invalidDefinesInFile(const QString &fileName) void CppPreprocessor::invalidDefinesInFile(const QString &fileName)
@ -265,18 +251,6 @@ void CppPreprocessor::addProjectIncludePath(const QString &fileName)
} }
} }
void CppPreprocessor::clearIncludePaths()
{
mIncludePaths.clear();
mIncludePathList.clear();
}
void CppPreprocessor::clearProjectIncludePaths()
{
mProjectIncludePaths.clear();
mProjectIncludePathList.clear();
}
void CppPreprocessor::removeScannedFile(const QString &filename) void CppPreprocessor::removeScannedFile(const QString &filename)
{ {
invalidDefinesInFile(filename); invalidDefinesInFile(filename);
@ -1204,71 +1178,6 @@ void CppPreprocessor::skipToPreprocessor()
} }
} }
bool CppPreprocessor::isWordChar(const QChar &ch)
{
if (ch=='_'
// || (ch>='a' && ch<='z') || (ch>='A' && ch<='Z')
|| ch.isLetter()
|| (ch>='0' && ch<='9')) {
return true;
}
return false;
}
bool CppPreprocessor::isIdentChar(const QChar &ch)
{
if (ch=='_' || ch == '*' || ch == '&' || ch == '~' ||
ch.isLetter()
//(ch>='a' && ch<='z') || (ch>='A' && ch<='Z')
|| (ch>='0' && ch<='9')) {
return true;
}
return false;
}
bool CppPreprocessor::isLineChar(const QChar &ch)
{
return ch=='\r' || ch == '\n';
}
bool CppPreprocessor::isSpaceChar(const QChar &ch)
{
return ch == ' ' || ch == '\t';
}
//bool CppPreprocessor::isOperatorChar(const QChar &ch)
//{
// switch(ch.unicode()) {
// case '+':
// case '-':
// case '*':
// case '/':
// case '!':
// case '=':
// case '<':
// case '>':
// case '&':
// case '|':
// case '^':
// return true;
// default:
// return false;
// }
//}
bool CppPreprocessor::isMacroIdentChar(const QChar &ch)
{
//return (ch>='A' && ch<='Z') || (ch>='a' && ch<='z')
return ch.isLetter()
|| ch == '_';
}
bool CppPreprocessor::isDigit(const QChar &ch)
{
return (ch>='0' && ch<='9');
}
bool CppPreprocessor::isNumberChar(const QChar &ch) bool CppPreprocessor::isNumberChar(const QChar &ch)
{ {
if (ch>='0' && ch<='9') if (ch>='0' && ch<='9')
@ -1290,11 +1199,6 @@ bool CppPreprocessor::isNumberChar(const QChar &ch)
} }
} }
QString CppPreprocessor::lineBreak()
{
return "\n";
}
bool CppPreprocessor::evaluateIf(const QString &line) bool CppPreprocessor::evaluateIf(const QString &line)
{ {
QString newLine = expandDefines(line); // replace FOO by numerical value of FOO QString newLine = expandDefines(line); // replace FOO by numerical value of FOO
@ -1961,22 +1865,4 @@ int CppPreprocessor::evaluateExpression(QString line)
return result; return result;
} }
void CppPreprocessor::setOnGetFileStream(const GetFileStreamCallBack &newOnGetFileStream)
{
mOnGetFileStream = newOnGetFileStream;
}
const QList<QString> &CppPreprocessor::projectIncludePathList() const
{
return mProjectIncludePathList;
}
const QList<QString> &CppPreprocessor::includePathList() const
{
return mIncludePathList;
}
const DefineMap &CppPreprocessor::hardDefines() const
{
return mHardDefines;
}

View File

@ -69,16 +69,25 @@ public:
void clearTempResults(); void clearTempResults();
void getDefineParts(const QString& input, QString &name, QString &args, QString &value); void getDefineParts(const QString& input, QString &name, QString &args, QString &value);
void addHardDefineByLine(const QString& line); void addHardDefineByLine(const QString& line) { addDefineByLine(line,true); }
void setScanOptions(bool parseSystem, bool parseLocal); void setScanOptions(bool parseSystem, bool parseLocal) {
mParseSystem = parseSystem;
mParseLocal=parseLocal;
}
void preprocess(const QString& fileName); void preprocess(const QString& fileName);
void dumpDefinesTo(const QString& fileName) const; void dumpDefinesTo(const QString& fileName) const;
void dumpIncludesListTo(const QString& fileName) const; void dumpIncludesListTo(const QString& fileName) const;
void addIncludePath(const QString& fileName); void addIncludePath(const QString& fileName);
void addProjectIncludePath(const QString& fileName); void addProjectIncludePath(const QString& fileName);
void clearIncludePaths(); void clearIncludePaths() {
void clearProjectIncludePaths(); mIncludePaths.clear();
mIncludePathList.clear();
}
void clearProjectIncludePaths() {
mProjectIncludePaths.clear();
mProjectIncludePathList.clear();
}
void removeScannedFile(const QString& filename); void removeScannedFile(const QString& filename);
PDefine getDefine(const QString& name) const{ PDefine getDefine(const QString& name) const{
@ -116,12 +125,12 @@ public:
return mProjectIncludePaths; return mProjectIncludePaths;
} }
const DefineMap &hardDefines() const; const DefineMap &hardDefines() const { return mHardDefines; }
const QList<QString> &includePathList() const; const QList<QString> &includePathList() const { return mIncludePathList; }
const QList<QString> &projectIncludePathList() const; const QList<QString> &projectIncludePathList() const { return mProjectIncludePathList; }
void setOnGetFileStream(const GetFileStreamCallBack &newOnGetFileStream); void setOnGetFileStream(const GetFileStreamCallBack &newOnGetFileStream) { mOnGetFileStream = newOnGetFileStream; }
static QList<PDefineArgToken> tokenizeValue(const QString& value); static QList<PDefineArgToken> tokenizeValue(const QString& value);
@ -198,40 +207,46 @@ private:
/* /*
* '_','a'..'z','A'..'Z','0'..'9' * '_','a'..'z','A'..'Z','0'..'9'
*/ */
static bool isWordChar(const QChar& ch); static bool isWordChar(const QChar& ch) {
return (ch=='_'
|| ch.isLetter()
|| (ch>='0' && ch<='9'));
}
/* /*
* 'A'..'Z', '0'..'9', 'a'..'z', '_', '*', '&', '~' * 'A'..'Z', '0'..'9', 'a'..'z', '_', '*', '&', '~'
*/ */
static bool isIdentChar(const QChar& ch); static bool isIdentChar(const QChar& ch) {
return (ch=='_' || ch == '*' || ch == '&' || ch == '~' ||
ch.isLetter()
|| (ch>='0' && ch<='9'));
}
/* /*
* '\r','\n' * '\r','\n'
*/ */
static bool isLineChar(const QChar& ch); static bool isLineChar(const QChar& ch) { return ch=='\r' || ch == '\n'; }
/* /*
* '\t' ' ' * '\t' ' '
*/ */
static bool isSpaceChar(const QChar& ch); static bool isSpaceChar(const QChar& ch) { return ch == ' ' || ch == '\t'; }
/*
* '+', '-', '*', '/', '!', '=', '<', '>', '&', '|', '^'
*/
//static bool isOperatorChar(const QChar& ch);
/* /*
* 'A'..'Z', 'a'..'z', '_' * 'A'..'Z', 'a'..'z', '_'
*/ */
static bool isMacroIdentChar(const QChar& ch); static bool isMacroIdentChar(const QChar& ch) { return ch.isLetter() || ch == '_'; }
/* /*
* '0'..'9' * '0'..'9'
*/ */
static bool isDigit(const QChar& ch); static bool isDigit(const QChar& ch) { return (ch>='0' && ch<='9'); }
/* /*
* '0'..'9','x',X','a'..'f','A'..'F','u','U','l','L' * '0'..'9','x',X','a'..'f','A'..'F','u','U','l','L'
*/ */
static bool isNumberChar(const QChar& ch); static bool isNumberChar(const QChar& ch);
QString lineBreak(); QString lineBreak() { return "\n"; }
bool evaluateIf(const QString& line); bool evaluateIf(const QString& line);
QString expandDefines(QString line); QString expandDefines(QString line);

View File

@ -526,34 +526,6 @@ QString CppTokenizer::getWord()
return result; return result;
} }
bool CppTokenizer::isArguments()
{
return *mCurrent == '(';
}
//bool CppTokenizer::isForInit()
//{
// return (*mCurrent == '(') && (mLastToken == "for");
//}
bool CppTokenizer::isNumber()
{
return isDigitChar(*mCurrent);
}
bool CppTokenizer::isPreprocessor()
{
return *mCurrent=='#';
}
bool CppTokenizer::isWord()
{
bool result = isIdentChar(*mCurrent);
if (result && (*(mCurrent+1) == '"'))
result = false;
return result;
}
void CppTokenizer::simplify(QString &output) void CppTokenizer::simplify(QString &output)
{ {
//remove \n \r; //remove \n \r;

View File

@ -49,31 +49,18 @@ public:
void clear(); void clear();
void tokenize(const QStringList& buffer); void tokenize(const QStringList& buffer);
void dumpTokens(const QString& fileName); void dumpTokens(const QString& fileName);
const PToken& operator[](int i) const { const PToken& operator[](int i) const { return mTokenList[i]; }
return mTokenList[i]; int tokenCount() const { return mTokenList.count(); }
} static bool isIdentChar(const QChar& ch) { return ch=='_' || ch.isLetter(); }
int tokenCount() const { int lambdasCount() const { return mLambdas.count(); }
return mTokenList.count();
}
static bool isIdentChar(const QChar& ch) {
return ch=='_' || ch.isLetter() ;
}
int lambdasCount() const {
return mLambdas.count();
}
int indexOfFirstLambda() const { int indexOfFirstLambda() const { return mLambdas.front(); }
return mLambdas.front(); void removeFirstLambda() { mLambdas.pop_front(); }
}
void removeFirstLambda() {
mLambdas.pop_front();
}
private: private:
void addToken(const QString& sText, int iLine, TokenType tokenType); void addToken(const QString& sText, int iLine, TokenType tokenType);
void advance(); void advance();
void countLines(); void countLines();
PToken getToken(int index);
// QString getForInit(); // QString getForInit();
QString getNextToken( QString getNextToken(
@ -81,11 +68,11 @@ private:
QString getNumber(); QString getNumber();
QString getPreprocessor(); QString getPreprocessor();
QString getWord(); QString getWord();
bool isArguments(); bool isArguments() { return *mCurrent == '('; }
// bool isForInit(); // bool isForInit();
bool isNumber(); bool isNumber() { return isDigitChar(*mCurrent); }
bool isPreprocessor(); bool isPreprocessor() { return *mCurrent=='#'; }
bool isWord(); bool isWord() { return isIdentChar(*mCurrent) && (*(mCurrent+1) != '"') && (*(mCurrent+1) != '\''); }
void simplify(QString& output); void simplify(QString& output);
void simplifyArgs(QString& output); void simplifyArgs(QString& output);
// void skipAssignment(); // void skipAssignment();

View File

@ -529,7 +529,6 @@ bool isHFile(const QString& filename)
{ {
if (filename.isEmpty()) if (filename.isEmpty())
return false; return false;
QFileInfo fileInfo(filename); QFileInfo fileInfo(filename);
return CppHeaderExts->contains(fileInfo.suffix().toLower()); return CppHeaderExts->contains(fileInfo.suffix().toLower());
@ -576,28 +575,12 @@ void CppScopes::addScope(int line, PStatement scopeStatement)
scope->startLine = line; scope->startLine = line;
scope->statement = scopeStatement; scope->statement = scopeStatement;
mScopes.append(scope); mScopes.append(scope);
#ifdef QT_DEBUG
if (!mScopes.isEmpty() && mScopes.back()->startLine>line) { if (!mScopes.isEmpty() && mScopes.back()->startLine>line) {
qDebug()<<QString("Error: new scope %1 at %2 which is less that last scope %3") qDebug()<<QString("Error: new scope %1 at %2 which is less that last scope %3")
.arg(scopeStatement->fullName, line,mScopes.back()->startLine>line); .arg(scopeStatement->fullName, line,mScopes.back()->startLine>line);
} }
} #endif
PStatement CppScopes::lastScope() const
{
if (mScopes.isEmpty())
return PStatement();
return mScopes.back()->statement;
}
void CppScopes::removeLastScope()
{
if (!mScopes.isEmpty())
mScopes.pop_back();
}
void CppScopes::clear()
{
mScopes.clear();
} }
MemberOperatorType getOperatorType(const QString &phrase, int index) MemberOperatorType getOperatorType(const QString &phrase, int index)
@ -767,17 +750,6 @@ bool isTypeKind(StatementKind kind)
} }
} }
ParsedFileInfo::ParsedFileInfo(const QString &fileName):
mFileName { fileName }
{
}
void ParsedFileInfo::insertBranch(int level, bool branchTrue)
{
mBranches.insert(level, branchTrue);
}
bool ParsedFileInfo::isLineVisible(int line) const bool ParsedFileInfo::isLineVisible(int line) const
{ {
int lastI=-1; int lastI=-1;
@ -790,93 +762,3 @@ bool ParsedFileInfo::isLineVisible(int line) const
} }
return lastI<0?true:mBranches[lastI]; return lastI<0?true:mBranches[lastI];
} }
void ParsedFileInfo::addInclude(const QString &fileName)
{
mIncludes.insert(fileName);
}
void ParsedFileInfo::addDirectInclude(const QString &fileName)
{
mDirectIncludes.append(fileName);
}
bool ParsedFileInfo::including(const QString &fileName) const
{
return mIncludes.contains(fileName);
}
const QSet<QString>& ParsedFileInfo::includes() const
{
return mIncludes;
}
const QList<std::weak_ptr<ClassInheritanceInfo> >& ParsedFileInfo::handledInheritances() const
{
return mHandledInheritances;
}
QString ParsedFileInfo::fileName() const
{
return mFileName;
}
PStatement ParsedFileInfo::findScopeAtLine(int line) const
{
return mScopes.findScopeAtLine(line);
}
void ParsedFileInfo::addStatement(const PStatement &statement)
{
mStatements.insert(statement->fullName,statement);
}
void ParsedFileInfo::clearStatements()
{
mStatements.clear();
}
void ParsedFileInfo::addScope(int line, const PStatement &scope)
{
mScopes.addScope(line,scope);
}
void ParsedFileInfo::removeLastScope()
{
mScopes.removeLastScope();
}
PStatement ParsedFileInfo::lastScope() const
{
return mScopes.lastScope();
}
void ParsedFileInfo::addUsing(const QString &usingSymbol)
{
mUsings.insert(usingSymbol);
}
void ParsedFileInfo::addHandledInheritances(std::weak_ptr<ClassInheritanceInfo> classInheritanceInfo)
{
mHandledInheritances.append(classInheritanceInfo);
}
void ParsedFileInfo::clearHandledInheritances()
{
mHandledInheritances.clear();
}
const StatementMap& ParsedFileInfo::statements() const
{
return mStatements;
}
const QSet<QString>& ParsedFileInfo::usings() const
{
return mUsings;
}
const QStringList& ParsedFileInfo::directIncludes() const
{
return mDirectIncludes;
}

View File

@ -174,8 +174,6 @@ Q_DECLARE_FLAGS(StatementProperties, StatementProperty)
Q_DECLARE_OPERATORS_FOR_FLAGS(StatementProperties) Q_DECLARE_OPERATORS_FOR_FLAGS(StatementProperties)
using PStatementMathPosition = std::shared_ptr<StatementMatchPosition>; using PStatementMathPosition = std::shared_ptr<StatementMatchPosition>;
struct Statement; struct Statement;
@ -184,8 +182,6 @@ using StatementList = QList<PStatement>;
using PStatementList = std::shared_ptr<StatementList>; using PStatementList = std::shared_ptr<StatementList>;
using StatementMap = QMultiMap<QString, PStatement>; using StatementMap = QMultiMap<QString, PStatement>;
struct Statement { struct Statement {
// Statement();
// ~Statement();
std::weak_ptr<Statement> parentScope; // parent class/struct/namespace scope, use weak pointer to prevent circular reference std::weak_ptr<Statement> parentScope; // parent class/struct/namespace scope, use weak pointer to prevent circular reference
QString type; // type "int" QString type; // type "int"
QString command; // identifier/name of statement "foo" QString command; // identifier/name of statement "foo"
@ -293,13 +289,19 @@ struct CppScope {
using PCppScope = std::shared_ptr<CppScope>; using PCppScope = std::shared_ptr<CppScope>;
class CppScopes { class CppScopes {
public: public:
PStatement findScopeAtLine(int line) const; PStatement findScopeAtLine(int line) const;
void addScope(int line, PStatement scopeStatement); void addScope(int line, PStatement scopeStatement);
PStatement lastScope() const; PStatement lastScope() const {
void removeLastScope(); if (mScopes.isEmpty())
void clear(); return PStatement();
return mScopes.back()->statement;
}
void removeLastScope() {
if (!mScopes.isEmpty())
mScopes.pop_back();
}
void clear() { mScopes.clear(); }
private: private:
QVector<PCppScope> mScopes; QVector<PCppScope> mScopes;
}; };
@ -319,32 +321,30 @@ using PClassInheritanceInfo = std::shared_ptr<ClassInheritanceInfo>;
class ParsedFileInfo { class ParsedFileInfo {
public: public:
ParsedFileInfo(const QString& fileName); ParsedFileInfo(const QString& fileName): mFileName {fileName} { }
ParsedFileInfo(const ParsedFileInfo&)=delete; ParsedFileInfo(const ParsedFileInfo&)=delete;
ParsedFileInfo& operator=(const ParsedFileInfo&)=delete; ParsedFileInfo& operator=(const ParsedFileInfo&)=delete;
void insertBranch(int level, bool branchTrue); void insertBranch(int level, bool branchTrue) { mBranches.insert(level, branchTrue); }
bool isLineVisible(int line) const; bool isLineVisible(int line) const;
void addInclude(const QString &fileName); void addInclude(const QString &fileName) { mIncludes.insert(fileName); }
void addDirectInclude(const QString &fileName); void addDirectInclude(const QString &fileName) { mDirectIncludes.append(fileName); }
bool including(const QString &fileName) const; bool including(const QString &fileName) const { return mIncludes.contains(fileName); }
PStatement findScopeAtLine(int line) const; PStatement findScopeAtLine(int line) const { return mScopes.findScopeAtLine(line); }
void addStatement(const PStatement &statement); void addStatement(const PStatement &statement) { mStatements.insert(statement->fullName,statement); }
void clearStatements(); void clearStatements() { mStatements.clear(); }
void addScope(int line, const PStatement &scope); void addScope(int line, const PStatement &scope) { mScopes.addScope(line,scope); }
void removeLastScope(); void removeLastScope() { mScopes.removeLastScope(); }
PStatement lastScope() const; PStatement lastScope() const { return mScopes.lastScope(); }
void addUsing(const QString &usingSymbol); void addUsing(const QString &usingSymbol) { mUsings.insert(usingSymbol); }
void addHandledInheritances(std::weak_ptr<ClassInheritanceInfo> classInheritanceInfo); void addHandledInheritances(std::weak_ptr<ClassInheritanceInfo> classInheritanceInfo) { mHandledInheritances.append(classInheritanceInfo); }
void clearHandledInheritances(); void clearHandledInheritances() { mHandledInheritances.clear(); }
QString fileName() const; QString fileName() const { return mFileName; }
const StatementMap& statements() const; const StatementMap& statements() const { return mStatements; }
const QSet<QString>& usings() const; const QSet<QString>& usings() const { return mUsings; }
const QStringList& directIncludes() const; const QStringList& directIncludes() const { return mDirectIncludes; }
const QSet<QString>& includes() const; const QSet<QString>& includes() const { return mIncludes; }
const QList<std::weak_ptr<ClassInheritanceInfo> >& handledInheritances() const; const QList<std::weak_ptr<ClassInheritanceInfo> >& handledInheritances() const { return mHandledInheritances; }
const QSet<QString> &includedBySet() const;
int includedByCount(const QString &fileName) const;
private: private:
QString mFileName; QString mFileName;

View File

@ -39,7 +39,6 @@ void StatementModel::add(const PStatement& statement)
#ifdef QT_DEBUG #ifdef QT_DEBUG
mAllStatements.append(statement); mAllStatements.append(statement);
#endif #endif
} }
void StatementModel::deleteStatement(const PStatement& statement) void StatementModel::deleteStatement(const PStatement& statement)
@ -61,29 +60,6 @@ void StatementModel::deleteStatement(const PStatement& statement)
} }
const StatementMap &StatementModel::childrenStatements(const PStatement& statement) const
{
if (!statement) {
return mGlobalStatements;
} else {
return statement->children;
}
}
const StatementMap &StatementModel::childrenStatements(std::weak_ptr<Statement> statement) const
{
PStatement s = statement.lock();
return childrenStatements(s);
}
void StatementModel::clear() {
mCount=0;
mGlobalStatements.clear();
#ifdef QT_DEBUG
mAllStatements.clear();
#endif
}
#ifdef QT_DEBUG #ifdef QT_DEBUG
void StatementModel::dump(const QString &logFile) void StatementModel::dump(const QString &logFile)
{ {

View File

@ -30,12 +30,22 @@ public:
StatementModel& operator=(const StatementModel&)=delete; StatementModel& operator=(const StatementModel&)=delete;
void add(const PStatement& statement); void add(const PStatement& statement);
// function DeleteFirst: Integer;
// function DeleteLast: Integer;
void deleteStatement(const PStatement& statement); void deleteStatement(const PStatement& statement);
const StatementMap& childrenStatements(const PStatement& statement = PStatement()) const; const StatementMap& childrenStatements(const PStatement& statement = PStatement()) const {
const StatementMap& childrenStatements(std::weak_ptr<Statement> statement) const; if (!statement) {
void clear(); return mGlobalStatements;
} else {
return statement->children;
}
}
const StatementMap& childrenStatements(std::weak_ptr<Statement> statement) const { return childrenStatements(statement.lock()); }
void clear() {
mCount=0;
mGlobalStatements.clear();
#ifdef QT_DEBUG
mAllStatements.clear();
#endif
}
int count() const { return mCount; } int count() const { return mCount; }
#ifdef QT_DEBUG #ifdef QT_DEBUG
void dump(const QString& logFile); void dump(const QString& logFile);

View File

@ -18,9 +18,11 @@
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QPushButton> #include <QPushButton>
#include <QDebug>
FunctionTooltipWidget::FunctionTooltipWidget(QWidget *parent) : FunctionTooltipWidget::FunctionTooltipWidget(QWidget *parent) :
QFrame(parent, Qt::ToolTip | Qt::WindowStaysOnTopHint | Qt::WindowDoesNotAcceptFocus) QFrame{parent, Qt::ToolTip | Qt::WindowStaysOnTopHint | Qt::WindowDoesNotAcceptFocus},
mMinWidth{410}
{ {
setFocusPolicy(Qt::NoFocus); setFocusPolicy(Qt::NoFocus);
mInfoLabel = new QLabel(this); mInfoLabel = new QLabel(this);
@ -120,12 +122,19 @@ void FunctionTooltipWidget::updateTip()
return; return;
PFunctionInfo info = mInfos[mInfoIndex]; PFunctionInfo info = mInfos[mInfoIndex];
QString text = info->returnType+ " " + info->name; QString text = info->returnType+ " " + info->name;
QString originText = text;
if (info->params.length()==0) { if (info->params.length()==0) {
text += "()"; text += "()";
originText += "()";
} else { } else {
QStringList displayList; QStringList displayList;
QStringList originList;
for (int i=0;i<info->params.length();i++){ for (int i=0;i<info->params.length();i++){
const QString& param = info->params[i]; QString param = info->params[i];
originList.append(param);
param.replace("<","&lt;");
param.replace(">","&gt;");
if (mParamIndex == i) { if (mParamIndex == i) {
displayList.append(QString("<b>%1</b>").arg(param)); displayList.append(QString("<b>%1</b>").arg(param));
} else { } else {
@ -133,13 +142,14 @@ void FunctionTooltipWidget::updateTip()
} }
} }
text += "( "+displayList.join(", ") + ") "; text += "( "+displayList.join(", ") + ") ";
originText += "( "+originList.join(", ") + ") ";
} }
if (mInfos.length()>1) { if (mInfos.length()>1) {
mTotalLabel->setText(QString("%1/%2").arg(mInfoIndex+1).arg(mInfos.length())); mTotalLabel->setText(QString("%1/%2").arg(mInfoIndex+1).arg(mInfos.length()));
} }
int width = mInfoLabel->fontMetrics().horizontalAdvance(text); int width = mInfoLabel->fontMetrics().horizontalAdvance(originText)+10;
if (width > 400) { if (width > mMinWidth) {
mInfoLabel->setMinimumWidth(410); mInfoLabel->setMinimumWidth(mMinWidth);
} else { } else {
mInfoLabel->setMinimumWidth(width); mInfoLabel->setMinimumWidth(width);
} }
@ -192,6 +202,16 @@ QStringList FunctionTooltipWidget::splitArgs(QString argStr)
return result; return result;
} }
int FunctionTooltipWidget::minWidth() const
{
return mMinWidth;
}
void FunctionTooltipWidget::setMinWidth(int newMinWidth)
{
mMinWidth = newMinWidth;
}
const QString &FunctionTooltipWidget::functionFullName() const const QString &FunctionTooltipWidget::functionFullName() const
{ {
return mFunctioFullName; return mFunctioFullName;

View File

@ -54,6 +54,9 @@ public:
const QString &functionFullName() const; const QString &functionFullName() const;
void setFunctioFullName(const QString &newFunctioFullName); void setFunctioFullName(const QString &newFunctioFullName);
int minWidth() const;
void setMinWidth(int newMinWidth);
private: private:
QStringList splitArgs(QString args); QStringList splitArgs(QString args);
private: private:
@ -67,6 +70,7 @@ private:
QString mFunctioFullName; QString mFunctioFullName;
QList<PFunctionInfo> mInfos; QList<PFunctionInfo> mInfos;
int mMinWidth;
// QWidget interface // QWidget interface
protected: protected:

View File

@ -1334,9 +1334,9 @@ int DocumentLine::glyphWidth(int i)
return calcSegmentInterval(mGlyphStartPositionList, mWidth, i); return calcSegmentInterval(mGlyphStartPositionList, mWidth, i);
} }
int DocumentLine::width(bool forceUpdate) int DocumentLine::width()
{ {
if(mWidth<0 || forceUpdate) if(mWidth<0)
updateWidth(); updateWidth();
return mWidth; return mWidth;
} }

View File

@ -68,17 +68,13 @@ private:
* *
* @return the glyphs count * @return the glyphs count
*/ */
int glyphsCount() const { int glyphsCount() const { return mGlyphStartCharList.length(); }
return mGlyphStartCharList.length();
}
/** /**
* @brief get list of start index of the glyphs in the line text * @brief get list of start index of the glyphs in the line text
* @return start indice of the glyph. * @return start indice of the glyph.
*/ */
const QList<int>& glyphStartCharList() const { const QList<int>& glyphStartCharList() const { return mGlyphStartCharList; }
return mGlyphStartCharList;
}
/** /**
* @brief get list of start position of the glyphs in the line text * @brief get list of start position of the glyphs in the line text
@ -131,7 +127,7 @@ private:
* @brief get the width (pixel) of the line text * @brief get the width (pixel) of the line text
* @return the width (in width) * @return the width (in width)
*/ */
int width(bool forceUpdate=false); int width();
/** /**
* @brief get the state of the syntax highlighter after this line is parsed * @brief get the state of the syntax highlighter after this line is parsed

View File

@ -81,12 +81,6 @@ bool enumTokenAttributes(PSyntaxer syntaxer, bool skipDuplicates,
tokenAttriProc, params, syntaxerList); tokenAttriProc, params, syntaxerList);
} }
int mulDiv(int a, int b, int c)
{
//todo: handle overflow?
return a*b/c;
}
FontStyles getFontStyles(const QFont &font) FontStyles getFontStyles(const QFont &font)
{ {
FontStyles styles; FontStyles styles;

View File

@ -37,7 +37,6 @@ class QColor;
namespace QSynedit { namespace QSynedit {
int minMax(int x, int mi, int ma); int minMax(int x, int mi, int ma);
int mulDiv(int a, int b, int c);
BufferCoord maxBufferCoord(const BufferCoord& P1, const BufferCoord& P2); BufferCoord maxBufferCoord(const BufferCoord& P1, const BufferCoord& P2);
BufferCoord minBufferCoord(const BufferCoord& P1, const BufferCoord& P2); BufferCoord minBufferCoord(const BufferCoord& P1, const BufferCoord& P2);

View File

@ -220,110 +220,10 @@ CppSyntaxer::CppSyntaxer(): Syntaxer()
resetState(); resetState();
} }
const PTokenAttribute &CppSyntaxer::preprocessorAttribute() const
{
return mPreprocessorAttribute;
}
const PTokenAttribute &CppSyntaxer::invalidAttribute() const
{
return mInvalidAttribute;
}
const PTokenAttribute &CppSyntaxer::numberAttribute() const
{
return mNumberAttribute;
}
const PTokenAttribute &CppSyntaxer::floatAttribute() const
{
return mFloatAttribute;
}
const PTokenAttribute &CppSyntaxer::hexAttribute() const
{
return mHexAttribute;
}
const PTokenAttribute &CppSyntaxer::octAttribute() const
{
return mOctAttribute;
}
const PTokenAttribute &CppSyntaxer::stringEscapeSequenceAttribute() const
{
return mStringEscapeSequenceAttribute;
}
const PTokenAttribute &CppSyntaxer::charAttribute() const
{
return mCharAttribute;
}
const PTokenAttribute &CppSyntaxer::variableAttribute() const
{
return mVariableAttribute;
}
const PTokenAttribute &CppSyntaxer::functionAttribute() const
{
return mFunctionAttribute;
}
const PTokenAttribute &CppSyntaxer::classAttribute() const
{
return mClassAttribute;
}
const PTokenAttribute &CppSyntaxer::globalVarAttribute() const
{
return mGlobalVarAttribute;
}
const PTokenAttribute &CppSyntaxer::localVarAttribute() const
{
return mLocalVarAttribute;
}
bool CppSyntaxer::isStringToNextLine(int state)
{
return state == RangeState::rsStringNextLine;
}
bool CppSyntaxer::isRawStringStart(int state)
{
return state == RangeState::rsRawString;
}
bool CppSyntaxer::isRawStringNoEscape(int state)
{
return state == RangeState::rsRawStringNotEscaping;
}
bool CppSyntaxer::isRawStringEnd(int state)
{
return state == RangeState::rsRawStringEnd;
}
bool CppSyntaxer::isCharNotFinished(int state)
{
return state == RangeState::rsChar || state == RangeState::rsCharEscaping;
}
bool CppSyntaxer::isCharEscaping(int state)
{
return state == RangeState::rsCharEscaping;
}
bool CppSyntaxer::isInAttribute(const SyntaxState &state) bool CppSyntaxer::isInAttribute(const SyntaxState &state)
{ {
return state.extraData.contains(DATA_KEY_IN_ATTRIBUTE) return state.extraData.contains(DATA_KEY_IN_ATTRIBUTE)
&& state.extraData[DATA_KEY_IN_ATTRIBUTE].toBool(); && state.extraData[DATA_KEY_IN_ATTRIBUTE].toBool();
}
CppSyntaxer::TokenId CppSyntaxer::getTokenId()
{
return mTokenId;
} }
void CppSyntaxer::procAndSymbol() void CppSyntaxer::procAndSymbol()

View File

@ -60,31 +60,31 @@ public:
CppSyntaxer(const CppSyntaxer&)=delete; CppSyntaxer(const CppSyntaxer&)=delete;
CppSyntaxer operator=(const CppSyntaxer&)=delete; CppSyntaxer operator=(const CppSyntaxer&)=delete;
const PTokenAttribute &preprocessorAttribute() const; const PTokenAttribute &preprocessorAttribute() const { return mPreprocessorAttribute; }
const PTokenAttribute &invalidAttribute() const; const PTokenAttribute &invalidAttribute() const { return mInvalidAttribute; }
const PTokenAttribute &numberAttribute() const; const PTokenAttribute &numberAttribute() const { return mNumberAttribute; }
const PTokenAttribute &floatAttribute() const; const PTokenAttribute &floatAttribute() const { return mFloatAttribute; }
const PTokenAttribute &hexAttribute() const; const PTokenAttribute &hexAttribute() const { return mHexAttribute; }
const PTokenAttribute &octAttribute() const; const PTokenAttribute &octAttribute() const { return mOctAttribute; }
const PTokenAttribute &stringEscapeSequenceAttribute() const; const PTokenAttribute &stringEscapeSequenceAttribute() const { return mStringEscapeSequenceAttribute; }
const PTokenAttribute &charAttribute() const; const PTokenAttribute &charAttribute() const { return mCharAttribute; }
const PTokenAttribute &variableAttribute() const; const PTokenAttribute &variableAttribute() const { return mVariableAttribute; }
const PTokenAttribute &functionAttribute() const; const PTokenAttribute &functionAttribute() const { return mFunctionAttribute; }
const PTokenAttribute &classAttribute() const; const PTokenAttribute &classAttribute() const { return mClassAttribute; }
const PTokenAttribute &globalVarAttribute() const; const PTokenAttribute &globalVarAttribute() const { return mGlobalVarAttribute; }
const PTokenAttribute &localVarAttribute() const; const PTokenAttribute &localVarAttribute() const { return mLocalVarAttribute; }
static const QSet<QString> Keywords; static const QSet<QString> Keywords;
@ -92,15 +92,15 @@ public:
static const QSet<QString> StandardAttributes; static const QSet<QString> StandardAttributes;
bool isStringToNextLine(int state); bool isStringToNextLine(int state) { return state == RangeState::rsStringNextLine; }
bool isRawStringStart(int state); bool isRawStringStart(int state) { return state == RangeState::rsRawString; }
bool isRawStringNoEscape(int state); bool isRawStringNoEscape(int state) { return state == RangeState::rsRawStringNotEscaping; }
bool isRawStringEnd(int state); bool isRawStringEnd(int state) { return state == RangeState::rsRawStringEnd; }
bool isCharNotFinished(int state); bool isCharNotFinished(int state) { return state == RangeState::rsChar || state == RangeState::rsCharEscaping; }
bool isCharEscaping(int state); bool isCharEscaping(int state) { return state == RangeState::rsCharEscaping; }
bool isInAttribute(const SyntaxState &state); bool isInAttribute(const SyntaxState &state);
TokenId getTokenId(); TokenId getTokenId() { return mTokenId; }
private: private:
void procAndSymbol(); void procAndSymbol();
void procCppStyleComment(); void procCppStyleComment();
@ -159,7 +159,6 @@ private:
private: private:
SyntaxState mRange; SyntaxState mRange;
// SynRangeState mSpaceRange;
QString mLine; QString mLine;
int mLineSize; int mLineSize;
int mRun; int mRun;

View File

@ -41,46 +41,6 @@ Syntaxer::Syntaxer() :
addAttribute(mSymbolAttribute); addAttribute(mSymbolAttribute);
} }
QMap<QString, PTokenAttribute> Syntaxer::attributes() const
{
return mAttributes;
}
const QSet<QChar>& Syntaxer::wordBreakChars() const
{
return mWordBreakChars;
}
const PTokenAttribute& Syntaxer::identifierAttribute() const
{
return mIdentifierAttribute;
}
const PTokenAttribute &Syntaxer::keywordAttribute() const
{
return mKeywordAttribute;
}
const PTokenAttribute &Syntaxer::commentAttribute() const
{
return mCommentAttribute;
}
const PTokenAttribute& Syntaxer::stringAttribute() const
{
return mStringAttribute;
}
const PTokenAttribute& Syntaxer::whitespaceAttribute() const
{
return mWhitespaceAttribute;
}
const PTokenAttribute& Syntaxer::symbolAttribute() const
{
return mSymbolAttribute;
}
bool Syntaxer::isKeyword(const QString &) bool Syntaxer::isKeyword(const QString &)
{ {
return false; return false;
@ -153,48 +113,17 @@ bool Syntaxer::isWordBreakChar(const QChar &ch)
bool Syntaxer::isIdentChar(const QChar &ch) const bool Syntaxer::isIdentChar(const QChar &ch) const
{ {
if (ch == '_') { return (ch == '_')
return true; || ((ch>='0') && (ch <= '9'))
} || ((ch>='a') && (ch <= 'z'))
if ((ch>='0') && (ch <= '9')) { || ((ch>='A') && (ch <= 'Z'));
return true;
}
if ((ch>='a') && (ch <= 'z')) {
return true;
}
if ((ch>='A') && (ch <= 'Z')) {
return true;
}
return false;
} }
bool Syntaxer::isIdentStartChar(const QChar &ch) const bool Syntaxer::isIdentStartChar(const QChar &ch) const
{ {
if (ch == '_') { return (ch == '_')
return true; || ((ch>='a') && (ch <= 'z'))
} || ((ch>='A') && (ch <= 'Z'));
if ((ch>='a') && (ch <= 'z')) {
return true;
}
if ((ch>='A') && (ch <= 'Z')) {
return true;
}
return false;
}
void Syntaxer::addAttribute(PTokenAttribute attribute)
{
mAttributes[attribute->name()]=attribute;
}
void Syntaxer::clearAttributes()
{
mAttributes.clear();
}
int Syntaxer::attributesCount() const
{
return mAttributes.size();
} }
PTokenAttribute Syntaxer::getAttribute(const QString& name) const PTokenAttribute Syntaxer::getAttribute(const QString& name) const
@ -217,48 +146,6 @@ QString Syntaxer::blockCommentEndSymbol()
return QString(); return QString();
} }
FontStyles TokenAttribute::styles() const
{
return mStyles;
}
void TokenAttribute::setStyles(const FontStyles &styles)
{
if (mStyles!=styles) {
mStyles = styles;
}
}
const QColor& TokenAttribute::foreground() const
{
return mForeground;
}
void TokenAttribute::setForeground(const QColor &color)
{
mForeground = color;
}
const QColor &TokenAttribute::background() const
{
return mBackground;
}
void TokenAttribute::setBackground(const QColor &background)
{
mBackground = background;
}
TokenType TokenAttribute::tokenType() const
{
return mTokenType;
}
QString TokenAttribute::name() const
{
return mName;
}
TokenAttribute::TokenAttribute(const QString &name, TokenType tokenType): TokenAttribute::TokenAttribute(const QString &name, TokenType tokenType):
mForeground(QColor()), mForeground(QColor()),
mBackground(QColor()), mBackground(QColor()),
@ -280,11 +167,9 @@ bool SyntaxState::operator==(const SyntaxState &s2)
&& (braceLevel == s2.braceLevel) // current braces embedding level (needed by rainbow color) && (braceLevel == s2.braceLevel) // current braces embedding level (needed by rainbow color)
&& (bracketLevel == s2.bracketLevel) // current brackets embedding level (needed by rainbow color) && (bracketLevel == s2.bracketLevel) // current brackets embedding level (needed by rainbow color)
&& (parenthesisLevel == s2.parenthesisLevel) // current parenthesis embedding level (needed by rainbow color) && (parenthesisLevel == s2.parenthesisLevel) // current parenthesis embedding level (needed by rainbow color)
&& (indents == s2.indents) && (indents == s2.indents)
&& (lastUnindent == s2.lastUnindent) && (lastUnindent == s2.lastUnindent)
; ;
} }
IndentInfo SyntaxState::getLastIndent() IndentInfo SyntaxState::getLastIndent()

View File

@ -93,18 +93,22 @@ public:
TokenAttribute(const TokenAttribute&)=delete; TokenAttribute(const TokenAttribute&)=delete;
TokenAttribute& operator=(const TokenAttribute&)=delete; TokenAttribute& operator=(const TokenAttribute&)=delete;
QString name() const; QString name() const { return mName; }
FontStyles styles() const; FontStyles styles() const { return mStyles; }
void setStyles(const FontStyles &styles); void setStyles(const FontStyles &styles) {
if (mStyles!=styles) {
mStyles = styles;
}
}
const QColor &foreground() const; const QColor &foreground() const { return mForeground; }
void setForeground(const QColor &color); void setForeground(const QColor &color) { mForeground = color; }
const QColor &background() const; const QColor &background() const { return mBackground; }
void setBackground(const QColor &background); void setBackground(const QColor &background) { mBackground = background; }
TokenType tokenType() const; TokenType tokenType() const { return mTokenType; }
private: private:
QColor mForeground; QColor mForeground;
@ -122,21 +126,21 @@ public:
Syntaxer(const Syntaxer&)=delete; Syntaxer(const Syntaxer&)=delete;
Syntaxer& operator=(const Syntaxer&)=delete; Syntaxer& operator=(const Syntaxer&)=delete;
virtual QMap<QString, PTokenAttribute> attributes() const; QMap<QString, PTokenAttribute> attributes() const { return mAttributes; }
const QSet<QChar>& wordBreakChars() const; const QSet<QChar>& wordBreakChars() const { return mWordBreakChars; }
const PTokenAttribute& identifierAttribute() const; const PTokenAttribute& identifierAttribute() const { return mIdentifierAttribute; }
const PTokenAttribute& keywordAttribute() const; const PTokenAttribute& keywordAttribute() const { return mKeywordAttribute; }
const PTokenAttribute& commentAttribute() const; const PTokenAttribute& commentAttribute() const { return mCommentAttribute; }
const PTokenAttribute& stringAttribute() const; const PTokenAttribute& stringAttribute() const { return mStringAttribute; }
const PTokenAttribute& whitespaceAttribute() const; const PTokenAttribute& whitespaceAttribute() const { return mWhitespaceAttribute; }
const PTokenAttribute& symbolAttribute() const; const PTokenAttribute& symbolAttribute() const { return mSymbolAttribute; }
virtual bool isIdentChar(const QChar& ch) const; virtual bool isIdentChar(const QChar& ch) const;
virtual bool isIdentStartChar(const QChar& ch) const; virtual bool isIdentStartChar(const QChar& ch) const;
@ -183,9 +187,9 @@ protected:
PTokenAttribute mWhitespaceAttribute; PTokenAttribute mWhitespaceAttribute;
PTokenAttribute mSymbolAttribute; PTokenAttribute mSymbolAttribute;
void addAttribute(PTokenAttribute attribute); void addAttribute(PTokenAttribute attribute) { mAttributes[attribute->name()]=attribute; }
void clearAttributes(); void clearAttributes() { mAttributes.clear(); }
virtual int attributesCount() const; virtual int attributesCount() const { return mAttributes.size(); }
private: private:
QMap<QString,PTokenAttribute> mAttributes; QMap<QString,PTokenAttribute> mAttributes;

View File

@ -48,14 +48,6 @@ void TextSyntaxer::procNull()
mState = RangeState::Unknown; mState = RangeState::Unknown;
} }
QMap<QString, PTokenAttribute> TextSyntaxer::attributes() const
{
QMap<QString, PTokenAttribute> result;
result.insert(SYNS_AttrText, mTextAttribute);
result.insert(SYNS_AttrSpace, whitespaceAttribute());
return result;
}
bool TextSyntaxer::eol() const bool TextSyntaxer::eol() const
{ {
return mTokenID == TokenId::Null; return mTokenID == TokenId::Null;

View File

@ -61,7 +61,6 @@ private:
void procNull(); void procNull();
public: public:
QMap<QString, PTokenAttribute> attributes() const override;
bool eol() const override; bool eol() const override;
QString languageName() override; QString languageName() override;