当前位置: 首页>>代码示例>>C++>>正文


C++ QChar::isLetterOrNumber方法代码示例

本文整理汇总了C++中QChar::isLetterOrNumber方法的典型用法代码示例。如果您正苦于以下问题:C++ QChar::isLetterOrNumber方法的具体用法?C++ QChar::isLetterOrNumber怎么用?C++ QChar::isLetterOrNumber使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QChar的用法示例。


在下文中一共展示了QChar::isLetterOrNumber方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: normalizedName

QString Driver::normalizedName(const QString &name)
{
    QString result = name;
    QChar *data = result.data();
    for (int i = name.size(); --i >= 0; ++data) {
        if (!data->isLetterOrNumber())
            *data = QLatin1Char('_');
    }
    return result;
}
开发者ID:Suneal,项目名称:qt,代码行数:10,代码来源:driver.cpp

示例2: validateAlphaNum

/*
Returns true if none of the characters in [str] does not match isLetterOrNumber() and validChars.
*/
bool validateAlphaNum(const QString & str)
{
  const QString validChars = "[email protected]:;,[](){}~#$! ";
  for (uint i=0; i < str.length() ; i++)
  {
    QChar tmp = str.at(i);
    if ((!tmp.isLetterOrNumber()) && (validChars.find(tmp) == -1))
      return false;
  }
  return true;
}
开发者ID:andrewbasterfield,项目名称:mysqlcc,代码行数:14,代码来源:shared.cpp

示例3: normalizeString

void AIMLParser::normalizeString(QString &str)
{
    QString newStr;
    for (int i = 0; i < str.length(); i++)
    {
        QChar c = str.at(i);
        if (c.isLetterOrNumber() || (c == '*') || (c == '_') || (c == ' '))
            newStr += c.lower();
    }
    str = newStr;
}
开发者ID:devartis,项目名称:chatbot,代码行数:11,代码来源:aimlparser.cpp

示例4: acceptsIdleEditor

bool QssCompletionAssistProcessor::acceptsIdleEditor()
{
    const int pos = m_interface->position();
    QChar characterUnderCursor = m_interface->characterAt(pos);
    if (!characterUnderCursor.isLetterOrNumber()) {
        m_startPosition = findStartOfName();
        if (pos - m_startPosition >= 3  && !isInComment())
            return true;
    }
    return false;
}
开发者ID:gonboy,项目名称:qsseditor,代码行数:11,代码来源:qsscompletionassist.cpp

示例5: assistInterface

IAssistProposal *DocumentContentCompletionProcessor::perform(const AssistInterface *interface)
{
    QScopedPointer<const AssistInterface> assistInterface(interface);
    if (running())
        return nullptr;

    int pos = interface->position();

    QChar chr;
    // Skip to the start of a name
    do {
        chr = interface->characterAt(--pos);
    } while (chr.isLetterOrNumber() || chr == '_');

    ++pos;
    int length = interface->position() - pos;

    if (interface->reason() == IdleEditor) {
        QChar characterUnderCursor = interface->characterAt(interface->position());
        if (characterUnderCursor.isLetterOrNumber() || length < 3)
            return nullptr;
    }

    const QString wordUnderCursor = interface->textAt(pos, length);
    const QString text = interface->textDocument()->toPlainText();

    m_watcher.setFuture(Utils::runAsync(&createProposal, text, wordUnderCursor));
    QObject::connect(&m_watcher, &QFutureWatcher<QStringList>::resultReadyAt,
                     &m_watcher, [this, pos](int index){
        const TextEditor::SnippetAssistCollector snippetCollector(
                    m_snippetGroup, QIcon(":/texteditor/images/snippet.png"));
        QList<AssistProposalItemInterface *> items = snippetCollector.collect();
        for (const QString &word : m_watcher.resultAt(index)) {
            auto item = new AssistProposalItem();
            item->setText(word);
            items.append(item);
        }
        setAsyncProposalAvailable(new GenericProposal(pos, items));
    });
    return nullptr;
}
开发者ID:kai66673,项目名称:qt-creator,代码行数:41,代码来源:documentcontentcompletion.cpp

示例6: fixWord

QString WordFixFormattedStringVisitor::fixWord(const QString &content, const QString &word, const QString &fix)
{
	QString result = content;
	const int wordLength = word.length();
	const int fixLength = fix.length();

	int pos = 0;
	while ((pos = result.indexOf(word, pos)) != -1)
	{
		bool beginsWord = (pos == 0);
		if (!beginsWord)
		{
			const QChar ch(result.at(pos - 1));
			beginsWord = !ch.isLetterOrNumber() && !ch.isMark() && ch != QLatin1Char('_');

			if (!beginsWord)
			{
				pos += wordLength;
				continue;
			}
		}

		bool endsWord = (pos + wordLength == result.length());
		if (!endsWord)
		{
			const QChar ch(result.at(pos + wordLength));
			endsWord = !ch.isLetterOrNumber() && !ch.isMark() && ch != QLatin1Char('_');

			if (!endsWord)
			{
				pos += wordLength;
				continue;
			}
		}

		result.replace(pos, wordLength, fix);
		pos += fixLength;
	}

	return result;
}
开发者ID:leewood,项目名称:kadu,代码行数:41,代码来源:word-fix-formatted-string-visitor.cpp

示例7: isNumberChar

static bool isNumberChar(QChar ch)
{
    switch (ch.unicode()) {
    case '.':
    case 'e':
    case 'E': // ### more...
        return true;

    default:
        return ch.isLetterOrNumber();
    }
}
开发者ID:gidlbn,项目名称:dlbn_02,代码行数:12,代码来源:qmljsscanner.cpp

示例8: ibanToElectronic

QString ibanBic::ibanToElectronic(const QString& iban)
{
  QString canonicalIban;
  const int length = iban.length();
  for (int i = 0; i < length; ++i) {
    const QChar letter = iban.at(i);
    if (letter.isLetterOrNumber())
      canonicalIban.append(letter.toUpper());
  }

  return canonicalIban;
}
开发者ID:CGenie,项目名称:kmymoney,代码行数:12,代码来源:ibanbic.cpp

示例9: settingsKey

QWORKBENCH_UTILS_EXPORT QString settingsKey(const QString &category)
{
    QString rc(category);
    const QChar underscore = QLatin1Char('_');
    const int size = rc.size();
    for (int i = 0; i < size; i++) {
        const QChar c = rc.at(i);
        if (!c.isLetterOrNumber() && c != underscore)
            rc[i] = underscore;
    }
    return rc;
}
开发者ID:ramons03,项目名称:qt-creator,代码行数:12,代码来源:settingsutils.cpp

示例10: cleanWord

/*
 * Removes bad characters
 */
QString InstrumentData::cleanWord(QString data)
{
    QString out;
    QChar c;

    for(auto i = data.begin(); i != data.end(); ++i){
        c = *i;
        if(c.isLetterOrNumber()||c.isPunct()) out.append(c);
    }

    return out;
}
开发者ID:ndtmike,项目名称:Aggralinx,代码行数:15,代码来源:instrumentdata.cpp

示例11: wordUnderCursor

QString GLSLTextEditorWidget::wordUnderCursor() const
{
    QTextCursor tc = textCursor();
    const QChar ch = characterAt(tc.position() - 1);
    // make sure that we're not at the start of the next word.
    if (ch.isLetterOrNumber() || ch == QLatin1Char('_'))
        tc.movePosition(QTextCursor::Left);
    tc.movePosition(QTextCursor::StartOfWord);
    tc.movePosition(QTextCursor::EndOfWord, QTextCursor::KeepAnchor);
    const QString word = tc.selectedText();
    return word;
}
开发者ID:KDE,项目名称:android-qt-creator,代码行数:12,代码来源:glsleditor.cpp

示例12: findStartOfName

int ProFileCompletionAssistProcessor::findStartOfName(int pos) const
{
    if (pos == -1)
        pos = m_interface->position();
    QChar chr;

    // Skip to the start of a name
    do {
        chr = m_interface->characterAt(--pos);
    } while (chr.isLetterOrNumber() || chr == QLatin1Char('_'));

    return pos + 1;
}
开发者ID:KDE,项目名称:android-qt-creator,代码行数:13,代码来源:profilecompletionassist.cpp

示例13: isIdentLetter

bool Lexer::isIdentLetter(QChar ch)
{
    // ASCII-biased, since all reserved words are ASCII, aand hence the
    // bulk of content to be parsed.
    if ((ch >= QLatin1Char('a') && ch <= QLatin1Char('z'))
            || (ch >= QLatin1Char('A') && ch <= QLatin1Char('Z'))
            || ch == QLatin1Char('$')
            || ch == QLatin1Char('_'))
        return true;
    if (ch.unicode() < 128)
        return false;
    return ch.isLetterOrNumber();
}
开发者ID:livecv,项目名称:livecv,代码行数:13,代码来源:qmljslexer.cpp

示例14: toAlphaNum

QString CppFileWizard::toAlphaNum(const QString &s)
{
    QString rc;
    const int len = s.size();
    const QChar underscore =  QLatin1Char('_');

    for (int i = 0; i < len; i++) {
        const QChar c = s.at(i);
        if (c == underscore || c.isLetterOrNumber())
            rc += c;
    }
    return rc;
}
开发者ID:halsten,项目名称:beaverdbg,代码行数:13,代码来源:cppfilewizard.cpp

示例15: expressionUnderCursor

QString VariableController::expressionUnderCursor(KTextEditor::Document* doc, const KTextEditor::Cursor& cursor)
{
    QString line = doc->line(cursor.line());
    int index = cursor.column();
    QChar c = line[index];
    if (!c.isLetterOrNumber() && c != '_' && c != '$')
        return QString();

    int start = Utils::expressionAt(line, index);
    int end = index;
    for (; end < line.size(); ++end) {
        QChar c = line[end];
        if (!(c.isLetterOrNumber() || c == '_' || c == '$'))
            break;
    }
    if (!(start < end))
        return QString();

    QString expression(line.mid(start, end-start));
    expression = expression.trimmed();
    return expression;
}
开发者ID:scooterman,项目名称:kdevelop-erlang,代码行数:22,代码来源:variablecontroller.cpp


注:本文中的QChar::isLetterOrNumber方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。