forked from qt-creator/qt-creator
Don't pass QChar as const & since it's just a unsigned short
Reviewed-by: ogoffart
This commit is contained in:
@@ -38,7 +38,7 @@ using namespace CPlusPlus;
|
|||||||
|
|
||||||
enum { MAX_NUM_LINES = 20 };
|
enum { MAX_NUM_LINES = 20 };
|
||||||
|
|
||||||
static bool shouldOverrideChar(const QChar &ch)
|
static bool shouldOverrideChar(QChar ch)
|
||||||
{
|
{
|
||||||
switch (ch.unicode()) {
|
switch (ch.unicode()) {
|
||||||
case ')': case ']': case ';': case '"': case '\'':
|
case ')': case ']': case ';': case '"': case '\'':
|
||||||
@@ -84,7 +84,7 @@ bool MatchingText::shouldInsertMatchingText(const QTextCursor &tc)
|
|||||||
return shouldInsertMatchingText(doc->characterAt(tc.selectionEnd()));
|
return shouldInsertMatchingText(doc->characterAt(tc.selectionEnd()));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MatchingText::shouldInsertMatchingText(const QChar &lookAhead)
|
bool MatchingText::shouldInsertMatchingText(QChar lookAhead)
|
||||||
{
|
{
|
||||||
switch (lookAhead.unicode()) {
|
switch (lookAhead.unicode()) {
|
||||||
case '{': case '}':
|
case '{': case '}':
|
||||||
@@ -101,7 +101,7 @@ bool MatchingText::shouldInsertMatchingText(const QChar &lookAhead)
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString MatchingText::insertMatchingBrace(const QTextCursor &cursor, const QString &textToProcess,
|
QString MatchingText::insertMatchingBrace(const QTextCursor &cursor, const QString &textToProcess,
|
||||||
const QChar &la, int *skippedChars) const
|
QChar la, int *skippedChars) const
|
||||||
{
|
{
|
||||||
QTextCursor tc = cursor;
|
QTextCursor tc = cursor;
|
||||||
QTextDocument *doc = tc.document();
|
QTextDocument *doc = tc.document();
|
||||||
|
@@ -42,10 +42,10 @@ public:
|
|||||||
MatchingText();
|
MatchingText();
|
||||||
|
|
||||||
static bool shouldInsertMatchingText(const QTextCursor &tc);
|
static bool shouldInsertMatchingText(const QTextCursor &tc);
|
||||||
static bool shouldInsertMatchingText(const QChar &lookAhead);
|
static bool shouldInsertMatchingText(QChar lookAhead);
|
||||||
|
|
||||||
QString insertMatchingBrace(const QTextCursor &tc, const QString &text,
|
QString insertMatchingBrace(const QTextCursor &tc, const QString &text,
|
||||||
const QChar &la, int *skippedChars) const;
|
QChar la, int *skippedChars) const;
|
||||||
QString insertParagraphSeparator(const QTextCursor &tc) const;
|
QString insertParagraphSeparator(const QTextCursor &tc) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -1547,7 +1547,7 @@ SemanticInfo CPPEditor::semanticInfo() const
|
|||||||
return m_lastSemanticInfo;
|
return m_lastSemanticInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CPPEditor::isElectricCharacter(const QChar &ch) const
|
bool CPPEditor::isElectricCharacter(QChar ch) const
|
||||||
{
|
{
|
||||||
if (ch == QLatin1Char('{') ||
|
if (ch == QLatin1Char('{') ||
|
||||||
ch == QLatin1Char('}') ||
|
ch == QLatin1Char('}') ||
|
||||||
@@ -1559,7 +1559,7 @@ bool CPPEditor::isElectricCharacter(const QChar &ch) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString CPPEditor::insertMatchingBrace(const QTextCursor &tc, const QString &text,
|
QString CPPEditor::insertMatchingBrace(const QTextCursor &tc, const QString &text,
|
||||||
const QChar &la, int *skippedChars) const
|
QChar la, int *skippedChars) const
|
||||||
{
|
{
|
||||||
MatchingText m;
|
MatchingText m;
|
||||||
return m.insertMatchingBrace(tc, text, la, skippedChars);
|
return m.insertMatchingBrace(tc, text, la, skippedChars);
|
||||||
|
@@ -212,10 +212,10 @@ protected:
|
|||||||
TextEditor::BaseTextEditorEditable *createEditableInterface();
|
TextEditor::BaseTextEditorEditable *createEditableInterface();
|
||||||
|
|
||||||
// These override BaseTextEditor
|
// These override BaseTextEditor
|
||||||
virtual bool isElectricCharacter(const QChar &ch) const;
|
virtual bool isElectricCharacter(QChar ch) const;
|
||||||
|
|
||||||
virtual QString insertMatchingBrace(const QTextCursor &tc, const QString &text,
|
virtual QString insertMatchingBrace(const QTextCursor &tc, const QString &text,
|
||||||
const QChar &la, int *skippedChars) const;
|
QChar la, int *skippedChars) const;
|
||||||
|
|
||||||
virtual QString insertParagraphSeparator(const QTextCursor &tc) const;
|
virtual QString insertParagraphSeparator(const QTextCursor &tc) const;
|
||||||
|
|
||||||
|
@@ -567,7 +567,7 @@ bool CodeCompletion::maybeTriggersCompletion(TextEditor::ITextEditable *editor)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CodeCompletion::isDelimiter(const QChar &ch) const
|
bool CodeCompletion::isDelimiter(QChar ch) const
|
||||||
{
|
{
|
||||||
switch (ch.unicode()) {
|
switch (ch.unicode()) {
|
||||||
case '{':
|
case '{':
|
||||||
|
@@ -78,7 +78,7 @@ private:
|
|||||||
void updateSnippets();
|
void updateSnippets();
|
||||||
|
|
||||||
bool maybeTriggersCompletion(TextEditor::ITextEditable *editor);
|
bool maybeTriggersCompletion(TextEditor::ITextEditable *editor);
|
||||||
bool isDelimiter(const QChar &ch) const;
|
bool isDelimiter(QChar ch) const;
|
||||||
|
|
||||||
void addCompletions(const QHash<QString, const QmlJS::Interpreter::Value *> &newCompletions,
|
void addCompletions(const QHash<QString, const QmlJS::Interpreter::Value *> &newCompletions,
|
||||||
const QIcon &icon);
|
const QIcon &icon);
|
||||||
|
@@ -82,9 +82,7 @@ using namespace QmlJS;
|
|||||||
using namespace QmlJS::AST;
|
using namespace QmlJS::AST;
|
||||||
using namespace QmlJSEditor::Internal;
|
using namespace QmlJSEditor::Internal;
|
||||||
|
|
||||||
namespace {
|
static int blockBraceDepth(const QTextBlock &block)
|
||||||
|
|
||||||
int blockBraceDepth(const QTextBlock &block)
|
|
||||||
{
|
{
|
||||||
int state = block.userState();
|
int state = block.userState();
|
||||||
if (state == -1)
|
if (state == -1)
|
||||||
@@ -93,7 +91,7 @@ int blockBraceDepth(const QTextBlock &block)
|
|||||||
return (state >> 8) & 0xFF;
|
return (state >> 8) & 0xFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
int blockStartState(const QTextBlock &block)
|
static int blockStartState(const QTextBlock &block)
|
||||||
{
|
{
|
||||||
int state = block.userState();
|
int state = block.userState();
|
||||||
|
|
||||||
@@ -103,7 +101,7 @@ int blockStartState(const QTextBlock &block)
|
|||||||
return state & 0xff;
|
return state & 0xff;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool shouldInsertMatchingText(const QChar &lookAhead)
|
static bool shouldInsertMatchingText(QChar lookAhead)
|
||||||
{
|
{
|
||||||
switch (lookAhead.unicode()) {
|
switch (lookAhead.unicode()) {
|
||||||
case '{': case '}':
|
case '{': case '}':
|
||||||
@@ -120,12 +118,14 @@ bool shouldInsertMatchingText(const QChar &lookAhead)
|
|||||||
} // switch
|
} // switch
|
||||||
}
|
}
|
||||||
|
|
||||||
bool shouldInsertMatchingText(const QTextCursor &tc)
|
static bool shouldInsertMatchingText(const QTextCursor &tc)
|
||||||
{
|
{
|
||||||
QTextDocument *doc = tc.document();
|
QTextDocument *doc = tc.document();
|
||||||
return shouldInsertMatchingText(doc->characterAt(tc.selectionEnd()));
|
return shouldInsertMatchingText(doc->characterAt(tc.selectionEnd()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
class FindIdDeclarations: protected Visitor
|
class FindIdDeclarations: protected Visitor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -938,7 +938,7 @@ QString QmlJSTextEditor::wordUnderCursor() const
|
|||||||
return word;
|
return word;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QmlJSTextEditor::isElectricCharacter(const QChar &ch) const
|
bool QmlJSTextEditor::isElectricCharacter(QChar ch) const
|
||||||
{
|
{
|
||||||
if (ch == QLatin1Char('}')
|
if (ch == QLatin1Char('}')
|
||||||
|| ch == QLatin1Char(']')
|
|| ch == QLatin1Char(']')
|
||||||
@@ -1177,7 +1177,7 @@ bool QmlJSTextEditor::isInComment(const QTextCursor &) const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QmlJSTextEditor::insertMatchingBrace(const QTextCursor &tc, const QString &text, const QChar &, int *skippedChars) const
|
QString QmlJSTextEditor::insertMatchingBrace(const QTextCursor &tc, const QString &text, QChar, int *skippedChars) const
|
||||||
{
|
{
|
||||||
if (text.length() != 1)
|
if (text.length() != 1)
|
||||||
return QString();
|
return QString();
|
||||||
|
@@ -246,11 +246,11 @@ protected:
|
|||||||
//// brace matching
|
//// brace matching
|
||||||
virtual bool contextAllowsAutoParentheses(const QTextCursor &cursor, const QString &textToInsert = QString()) const;
|
virtual bool contextAllowsAutoParentheses(const QTextCursor &cursor, const QString &textToInsert = QString()) const;
|
||||||
virtual bool isInComment(const QTextCursor &cursor) const;
|
virtual bool isInComment(const QTextCursor &cursor) const;
|
||||||
virtual QString insertMatchingBrace(const QTextCursor &tc, const QString &text, const QChar &la, int *skippedChars) const;
|
virtual QString insertMatchingBrace(const QTextCursor &tc, const QString &text, QChar la, int *skippedChars) const;
|
||||||
virtual QString insertParagraphSeparator(const QTextCursor &tc) const;
|
virtual QString insertParagraphSeparator(const QTextCursor &tc) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual bool isElectricCharacter(const QChar &ch) const;
|
virtual bool isElectricCharacter(QChar ch) const;
|
||||||
virtual void indentBlock(QTextDocument *doc, QTextBlock block, QChar typedChar);
|
virtual void indentBlock(QTextDocument *doc, QTextBlock block, QChar typedChar);
|
||||||
bool isClosingBrace(const QList<QmlJS::Token> &tokens) const;
|
bool isClosingBrace(const QList<QmlJS::Token> &tokens) const;
|
||||||
|
|
||||||
|
@@ -3806,7 +3806,7 @@ void BaseTextEditor::zoomReset()
|
|||||||
emit requestZoomReset();
|
emit requestZoomReset();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BaseTextEditor::isElectricCharacter(const QChar &) const
|
bool BaseTextEditor::isElectricCharacter(QChar) const
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -3863,7 +3863,7 @@ bool BaseTextEditor::isInComment(const QTextCursor &cursor) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString BaseTextEditor::insertMatchingBrace(const QTextCursor &tc, const QString &text,
|
QString BaseTextEditor::insertMatchingBrace(const QTextCursor &tc, const QString &text,
|
||||||
const QChar &la, int *skippedChars) const
|
QChar la, int *skippedChars) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(tc);
|
Q_UNUSED(tc);
|
||||||
Q_UNUSED(text);
|
Q_UNUSED(text);
|
||||||
|
@@ -384,7 +384,7 @@ protected:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
// Returns true if key triggers an indent.
|
// Returns true if key triggers an indent.
|
||||||
virtual bool isElectricCharacter(const QChar &ch) const;
|
virtual bool isElectricCharacter(QChar ch) const;
|
||||||
|
|
||||||
void indentInsertedText(const QTextCursor &tc);
|
void indentInsertedText(const QTextCursor &tc);
|
||||||
|
|
||||||
@@ -407,7 +407,7 @@ protected:
|
|||||||
// Returns true if the cursor is inside a comment.
|
// Returns true if the cursor is inside a comment.
|
||||||
virtual bool isInComment(const QTextCursor &cursor) const;
|
virtual bool isInComment(const QTextCursor &cursor) const;
|
||||||
|
|
||||||
virtual QString insertMatchingBrace(const QTextCursor &tc, const QString &text, const QChar &la, int *skippedChars) const;
|
virtual QString insertMatchingBrace(const QTextCursor &tc, const QString &text, QChar la, int *skippedChars) const;
|
||||||
|
|
||||||
// Returns the text that needs to be inserted
|
// Returns the text that needs to be inserted
|
||||||
virtual QString insertParagraphSeparator(const QTextCursor &tc) const;
|
virtual QString insertParagraphSeparator(const QTextCursor &tc) const;
|
||||||
|
@@ -176,7 +176,7 @@ QString IoUtils::shellQuote(const QString &arg)
|
|||||||
|
|
||||||
#else // Q_OS_WIN
|
#else // Q_OS_WIN
|
||||||
|
|
||||||
inline static bool isSpecial(const QChar &cUnicode)
|
inline static bool isSpecial(QChar cUnicode)
|
||||||
{
|
{
|
||||||
static const uchar iqm[] = {
|
static const uchar iqm[] = {
|
||||||
0xff, 0xff, 0xff, 0xff, 0xdf, 0x07, 0x00, 0xd8,
|
0xff, 0xff, 0xff, 0xff, 0xdf, 0x07, 0x00, 0xd8,
|
||||||
|
Reference in New Issue
Block a user