Commit 6875a50d authored by Thorbjørn Lindeijer's avatar Thorbjørn Lindeijer
Browse files

Don't pass QChar as const & since it's just a unsigned short

Reviewed-by: ogoffart
parent 7d4bbf49
......@@ -38,7 +38,7 @@ using namespace CPlusPlus;
enum { MAX_NUM_LINES = 20 };
static bool shouldOverrideChar(const QChar &ch)
static bool shouldOverrideChar(QChar ch)
{
switch (ch.unicode()) {
case ')': case ']': case ';': case '"': case '\'':
......@@ -84,7 +84,7 @@ bool MatchingText::shouldInsertMatchingText(const QTextCursor &tc)
return shouldInsertMatchingText(doc->characterAt(tc.selectionEnd()));
}
bool MatchingText::shouldInsertMatchingText(const QChar &lookAhead)
bool MatchingText::shouldInsertMatchingText(QChar lookAhead)
{
switch (lookAhead.unicode()) {
case '{': case '}':
......@@ -101,7 +101,7 @@ bool MatchingText::shouldInsertMatchingText(const QChar &lookAhead)
}
QString MatchingText::insertMatchingBrace(const QTextCursor &cursor, const QString &textToProcess,
const QChar &la, int *skippedChars) const
QChar la, int *skippedChars) const
{
QTextCursor tc = cursor;
QTextDocument *doc = tc.document();
......
......@@ -42,10 +42,10 @@ public:
MatchingText();
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,
const QChar &la, int *skippedChars) const;
QChar la, int *skippedChars) const;
QString insertParagraphSeparator(const QTextCursor &tc) const;
private:
......
......@@ -1547,7 +1547,7 @@ SemanticInfo CPPEditor::semanticInfo() const
return m_lastSemanticInfo;
}
bool CPPEditor::isElectricCharacter(const QChar &ch) const
bool CPPEditor::isElectricCharacter(QChar ch) const
{
if (ch == QLatin1Char('{') ||
ch == QLatin1Char('}') ||
......@@ -1559,7 +1559,7 @@ bool CPPEditor::isElectricCharacter(const QChar &ch) const
}
QString CPPEditor::insertMatchingBrace(const QTextCursor &tc, const QString &text,
const QChar &la, int *skippedChars) const
QChar la, int *skippedChars) const
{
MatchingText m;
return m.insertMatchingBrace(tc, text, la, skippedChars);
......
......@@ -212,10 +212,10 @@ protected:
TextEditor::BaseTextEditorEditable *createEditableInterface();
// 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,
const QChar &la, int *skippedChars) const;
QChar la, int *skippedChars) const;
virtual QString insertParagraphSeparator(const QTextCursor &tc) const;
......
......@@ -567,7 +567,7 @@ bool CodeCompletion::maybeTriggersCompletion(TextEditor::ITextEditable *editor)
return false;
}
bool CodeCompletion::isDelimiter(const QChar &ch) const
bool CodeCompletion::isDelimiter(QChar ch) const
{
switch (ch.unicode()) {
case '{':
......
......@@ -78,7 +78,7 @@ private:
void updateSnippets();
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,
const QIcon &icon);
......
......@@ -82,9 +82,7 @@ using namespace QmlJS;
using namespace QmlJS::AST;
using namespace QmlJSEditor::Internal;
namespace {
int blockBraceDepth(const QTextBlock &block)
static int blockBraceDepth(const QTextBlock &block)
{
int state = block.userState();
if (state == -1)
......@@ -93,7 +91,7 @@ int blockBraceDepth(const QTextBlock &block)
return (state >> 8) & 0xFF;
}
int blockStartState(const QTextBlock &block)
static int blockStartState(const QTextBlock &block)
{
int state = block.userState();
......@@ -103,7 +101,7 @@ int blockStartState(const QTextBlock &block)
return state & 0xff;
}
bool shouldInsertMatchingText(const QChar &lookAhead)
static bool shouldInsertMatchingText(QChar lookAhead)
{
switch (lookAhead.unicode()) {
case '{': case '}':
......@@ -120,12 +118,14 @@ bool shouldInsertMatchingText(const QChar &lookAhead)
} // switch
}
bool shouldInsertMatchingText(const QTextCursor &tc)
static bool shouldInsertMatchingText(const QTextCursor &tc)
{
QTextDocument *doc = tc.document();
return shouldInsertMatchingText(doc->characterAt(tc.selectionEnd()));
}
namespace {
class FindIdDeclarations: protected Visitor
{
public:
......@@ -938,7 +938,7 @@ QString QmlJSTextEditor::wordUnderCursor() const
return word;
}
bool QmlJSTextEditor::isElectricCharacter(const QChar &ch) const
bool QmlJSTextEditor::isElectricCharacter(QChar ch) const
{
if (ch == QLatin1Char('}')
|| ch == QLatin1Char(']')
......@@ -1177,7 +1177,7 @@ bool QmlJSTextEditor::isInComment(const QTextCursor &) const
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)
return QString();
......
......@@ -246,11 +246,11 @@ protected:
//// brace matching
virtual bool contextAllowsAutoParentheses(const QTextCursor &cursor, const QString &textToInsert = QString()) 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;
private:
virtual bool isElectricCharacter(const QChar &ch) const;
virtual bool isElectricCharacter(QChar ch) const;
virtual void indentBlock(QTextDocument *doc, QTextBlock block, QChar typedChar);
bool isClosingBrace(const QList<QmlJS::Token> &tokens) const;
......
......@@ -3806,7 +3806,7 @@ void BaseTextEditor::zoomReset()
emit requestZoomReset();
}
bool BaseTextEditor::isElectricCharacter(const QChar &) const
bool BaseTextEditor::isElectricCharacter(QChar) const
{
return false;
}
......@@ -3863,7 +3863,7 @@ bool BaseTextEditor::isInComment(const QTextCursor &cursor) const
}
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(text);
......
......@@ -384,7 +384,7 @@ protected:
public:
// 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);
......@@ -407,7 +407,7 @@ protected:
// Returns true if the cursor is inside a comment.
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
virtual QString insertParagraphSeparator(const QTextCursor &tc) const;
......
......@@ -176,7 +176,7 @@ QString IoUtils::shellQuote(const QString &arg)
#else // Q_OS_WIN
inline static bool isSpecial(const QChar &cUnicode)
inline static bool isSpecial(QChar cUnicode)
{
static const uchar iqm[] = {
0xff, 0xff, 0xff, 0xff, 0xdf, 0x07, 0x00, 0xd8,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment