本文整理汇总了C++中QChar::isLower方法的典型用法代码示例。如果您正苦于以下问题:C++ QChar::isLower方法的具体用法?C++ QChar::isLower怎么用?C++ QChar::isLower使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QChar
的用法示例。
在下文中一共展示了QChar::isLower方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: wit
//---------------------------------------------------------------------------
// getWordItems
//
//! Construct a list of word items to be inserted into a word list, based on
//! the results of a list of searches.
//
//! @param searchSpecs the list of search specifications
//! @return a list of word items
//---------------------------------------------------------------------------
QList<WordTableModel::WordItem>
WordVariationDialog::getWordItems(const QList<SearchSpec>& searchSpecs) const
{
QList<WordTableModel::WordItem> wordItems;
QMap<QString, QString> wordMap;
QListIterator<SearchSpec> lit (searchSpecs);
while (lit.hasNext()) {
QStringList wordList = wordEngine->search(lexicon, lit.next(), false);
QStringListIterator wit (wordList);
while (wit.hasNext()) {
QString str = wit.next();
wordMap.insert(str.toUpper(), str);
}
}
QMapIterator<QString, QString> mit (wordMap);
while (mit.hasNext()) {
mit.next();
QString value = mit.value();
QList<QChar> wildcardChars;
for (int i = 0; i < value.length(); ++i) {
QChar c = value[i];
if (c.isLower())
wildcardChars.append(c);
}
QString wildcard;
if (!wildcardChars.isEmpty()) {
qSort(wildcardChars.begin(), wildcardChars.end(),
Auxil::localeAwareLessThanQChar);
foreach (const QChar& c, wildcardChars)
wildcard.append(c.toUpper());
}
wordItems.append(WordTableModel::WordItem(
mit.key(), WordTableModel::WordNormal, wildcard));
}
示例2: consumeRegexpModifiers
void Scanner::consumeRegexpModifiers()
{
QChar ch = m_src.peek();
while (ch.isLetter() && ch.isLower()) {
m_src.move();
ch = m_src.peek();
}
}
示例3: charFilterRegExp
static QString charFilterRegExp(QString const & filter)
{
QString re;
for (int i = 0; i < filter.length(); ++i) {
QChar c = filter[i];
if (c.isLower())
re += ".*[" + QRegExp::escape(c) + QRegExp::escape(c.toUpper()) + "]";
else
re += ".*" + QRegExp::escape(c);
}
return re;
}
示例4: is_a_vowel
bool is_a_vowel(QChar single_letter)
{
// Make sure we are dealing with lowercase letters.
single_letter = single_letter.toLower();
if (!single_letter.isLower()) return FALSE;
if (single_letter == 'a') return TRUE;
if (single_letter == 'e') return TRUE;
if (single_letter == 'i') return TRUE;
if (single_letter == 'o') return TRUE;
if (single_letter == 'u') return TRUE;
return (FALSE);
}
示例5: isAllCaps
static bool isAllCaps(const QString &s)
{
for(int n = 0; n < s.length(); ++n)
{
QChar c = s[n];
// non-letters are allowed, so what we really check against is
// lowercase
if(c.isLower())
return false;
}
return true;
}
示例6: letter_to_number
// There is probably a better way with QChar, but I can't find it.
int letter_to_number (QChar let)
{
// Make sure we are dealing with lowercase letters.
let = let.toLower();
if (!let.isLower()) return 0;
for (int i = 0; i < 26; i++)
{
letters_and_numbers *ln_ptr =& lowercase_and_numbers[i];
if (ln_ptr->let == let) return (ln_ptr->num);
}
/* all else - just return zero*/
return 0;
}
示例7: fixTwoUppercaseChars
void Autocorrect::fixTwoUppercaseChars()
{
if (! m_fixTwoUppercaseChars) return;
if (m_word.length() <= 2) return;
if (m_twoUpperLetterExceptions.contains(m_word.trimmed()))
return;
QChar firstChar = m_word.at(0);
QChar secondChar = m_word.at(1);
if (secondChar.isUpper()) {
QChar thirdChar = m_word.at(2);
if (firstChar.isUpper() && thirdChar.isLower())
m_word.replace(1, 1, secondChar.toLower());
}
}
示例8: MorseCodeDecoderNode
void
MorseCodeDecoderNode::add(QString code, QChar character, int level)
{
if (level == code.size()) {
if (m_character == QChar('\0') && character.isLower())
m_character = character;
} else {
QChar part = code[level];
MorseCodeDecoderNode * branch;
if (part == '.') {
if (!m_dot_branch)
m_dot_branch = new MorseCodeDecoderNode();
branch = m_dot_branch;
}
else {
if (!m_dash_branch)
m_dash_branch = new MorseCodeDecoderNode();
branch = m_dash_branch;
}
branch->add(code, character, level+1);
}
}
示例9: parseMember
QVariant Cell::parseMember(const QString &formula, SpreadSheet *widget) const
{
int fOp = firstOperatorPosition(formula);
if (fOp == -1)
fOp = formula.length();
QChar first = formula.at(0);
QRegExp importedData("([\\w\\s]+:[A-Z][1-9][0-9]*)");
QRegExp cellId("([A-Z][1-9][0-9]*)");
//paranteza
if (first=='(')
{
int end = 0;
int open_p_count = 0;
int closed_p_count = 0;
for (int c=0; c<formula.length(); c++)
{
if (formula.at(c) == '(')
open_p_count++;
else if (formula.at(c) == ')')
closed_p_count++;
if (open_p_count == closed_p_count)
{
end = c;
break;
}
}
return computeFormula(formula.mid(1,end-1), widget);
}
//numar 0 sau 0.0
else if (first.isDigit())
{
QString s = formula.left(fOp);
if (s.count('.') <= 1)
{
bool ok;
double x = s.toDouble(&ok);
if (ok)
return x;
}
emit invalidFormula(QString("Invalid number or number format in %1").arg(s));
return "#####";
}
//tabela:identificator
else if (formula.indexOf(importedData) == 0)
{
int idx = 0;
QHash<QString,QString> matches = QHash<QString,QString>();
while ((idx = formula.indexOf(importedData, idx)) != -1)
{
QString match = formula.mid(idx, importedData.matchedLength());
int delim = match.indexOf(':');
QString table = match.left(delim);
QString id = match.mid(delim+1);
matches.insertMulti(table, id);
idx += importedData.matchedLength();
}
QString result = widget->getLinkData(formula, matches);
if (isValidFormula(result))
return display(result);
else
return result;
}
//celula A2
else if (cellId.exactMatch(formula))
{
QVariant cellVal = getCellValue(formula,widget);
if (cellVal == "#####")
emit invalidFormula(QString("Invalid cell data in %1").arg(formula));
return cellVal;
}
//functie nume_functie(A1;A2;A3)
else if (first.isLower())
{
QStringList simple_function_names;
QStringList cond_function_names;
QStringList parameters;
simple_function_names << "sum" << "avg" << "count";
cond_function_names << "if" << "countif";
QString s = formula.left(fOp);
QString params = s.mid(s.lastIndexOf('(')+1,
s.indexOf(')')-s.lastIndexOf('(')-1);
if (s.count('(') == s.count(')'))
parameters = params.split(';');
else
{
emit invalidFormula(QString("Invalid paranthesis number ").append(s));
return "#####";
}
s = formula.left(formula.indexOf('('));
if (simple_function_names.contains(s))
{
QVariantList values;
QListIterator<QString> it(parameters);
while (it.hasNext())
{
QString str = it.next();
QVariant val = parseMember(str, widget);
//.........这里部分代码省略.........
示例10: nextTokenKind
//.........这里部分代码省略.........
m_curpos++;
token = Parser::Token_IS_EQUAL;
}
else if ((it + 1)->unicode() == '<') {
m_curpos++;
token = Parser::Token_IS_SMALLER_OR_EQUAL;
}
else if ((it + 1)->unicode() == ':' && (it + 2)->unicode() == '=')
{
m_curpos += 2;
token = Parser::Token_EXACT_EQUATIONAL;
}
else if ((it + 1)->unicode() == '/' && (it + 2)->unicode() == '=')
{
m_curpos += 2;
token = Parser::Token_EXACT_NOT_EQUATIONAL;
}
else
{
token = Parser::Token_ASSIGN;
}
}
else if (it->isLetter() && it->isUpper())
{
QString name;
while (m_curpos < m_contentSize && (isValidVariableIdentifier(it))) {
name.append(*it);
it++;
m_curpos++;
}
m_curpos--;
token = Parser::Token_VARIABLE;
}
else if (it->isLetter() && it->isLower())
{
QString name;
while (m_curpos < m_contentSize && (isValidVariableIdentifier(it))) {
name.append(*it);
it++;
m_curpos++;
}
m_curpos--;
if (name == "after") {
token = Parser::Token_AFTER;
} else if (name == "begin") {
token = Parser::Token_BEGIN;
} else if (name == "case") {
token = Parser::Token_CASE;
} else if (name == "if") {
token = Parser::Token_IF;
} else if (name == "catch") {
token = Parser::Token_CATCH;
} else if (name == "cond") {
token = Parser::Token_COND;
} else if (name == "end") {
token = Parser::Token_END;
} else if (name == "fun") {
token = Parser::Token_FUN;
} else if (name == "let") {
token = Parser::Token_LET;
} else if (name == "of") {
token = Parser::Token_OF;
} else if (name == "catch") {
token = Parser::Token_CATCH;
示例11: parse
bool Chord::parse(QString text)
{
if (text.isEmpty())
{
return false;
}
QRegExp beforeMatcher( "^(" + IGNORE_BEFORE_PATTERN + ")" );
if (beforeMatcher.indexIn( text ) == 0 )
{
int n = beforeMatcher.matchedLength();
m_before = text.left(n);
text = text.mid(n);
}
QRegExp afterMatcher( "(" + IGNORE_AFTER_PATTERN + ")$" );
if ( afterMatcher.indexIn( text ) >= 0 )
{
int n = afterMatcher.matchedLength();
m_after = text.right( n );
text = text.mid( 0, text.length() - n );
}
QChar baseChar = text[0];
m_base = parseBase(baseChar);
if (m_base < 0)
{
return false;
}
text = text.mid(1);
if ( ifStartsWithTake( text, "es" )
|| (!text.startsWith("sus") && ifStartsWithTake( text, "s") )
|| ifStartsWithTake( text, "b" )
|| ifStartsWithTake( text, flat()) )
{
m_base--;
}
if ( ifStartsWithTake( text, "is" )
|| ifStartsWithTake( text, "#" )
|| ifStartsWithTake( text, sharp() ) )
{
m_base++;
}
m_base %= 12;
m_base += 12;
m_base %= 12;
if ( baseChar.isLower()
|| (!text.startsWith("min") && !text.startsWith("maj") && ifStartsWithTake( text, "m" ) ) )
{
m_isMinor = true;
}
else
{
m_isMinor = false;
}
m_attachment = text;
if (QRegExp( CHORD_EXTENSION_PATTERN ).exactMatch( m_attachment ))
{
return true;
}
else
{
return false;
}
}
示例12: filterActionTipContents
QString ToolTipFiller::filterActionTipContents(const FilterAction& action)
{
if (action.isNull())
{
return QString();
}
QString str;
DToolTipStyleSheet cnt(ApplicationSettings::instance()->getToolTipsFont());
QString tip = cnt.tipHeader;
tip += cnt.headBeg + i18n("Filter") + cnt.headEnd;
// Displayable name
tip += cnt.cellBeg + i18n("Name:") + cnt.cellMid
+ DImgFilterManager::instance()->i18nDisplayableName(action) + cnt.cellEnd;
// Category
QString reproducible("---");
switch (action.category())
{
case FilterAction::ReproducibleFilter:
reproducible = i18nc("Image filter reproducible: Yes", "Yes");
break;
case FilterAction::ComplexFilter:
reproducible = i18nc("Image filter reproducible: Partially", "Partially");
break;
case FilterAction::DocumentedHistory:
reproducible = i18nc("Image filter reproducible: No", "No");
break;
default:
break;
};
tip += cnt.cellBeg + i18n("Reproducible:") + cnt.cellMid
+ reproducible + cnt.cellEnd;
// Description
str = action.description();
if (str.isEmpty())
{
str = QString("---");
}
tip += cnt.cellSpecBeg + i18nc("Image filter description", "Description:") + cnt.cellSpecMid
+ cnt.breakString(str) + cnt.cellSpecEnd;
// Identifier + version
tip += cnt.cellBeg + i18n("Identifier:") + cnt.cellMid
+ action.identifier() + " (v" + QString::number(action.version()) + ") " + cnt.cellEnd;
if (action.hasParameters())
{
tip += cnt.headBeg + i18n("Technical Parameters") + cnt.headEnd;
const QHash<QString, QVariant>& params = action.parameters();
QList<QString> keys = params.keys();
qSort(keys);
foreach(const QString& key, keys)
{
QHash<QString, QVariant>::const_iterator it;
for (it = params.find(key); it != params.end() && it.key() == key; ++it)
{
if (it.key().isEmpty() || !it.value().isValid())
{
continue;
}
if (it.key().startsWith(QLatin1String("curveData")))
{
str = i18n("<i>Binary Data</i>");
}
else
{
str = it.value().toString();
}
if (str.length() > cnt.maxStringLength)
{
str = cnt.elidedText(str, Qt::ElideRight);
}
QString key = it.key();
QChar first = key.at(0);
if (first.isLower())
{
key.replace(0, 1, first.toUpper());
}
tip += cnt.cellBeg + key + cnt.cellMid
+ str + cnt.cellEnd;
}
}
示例13: sentenceCase
void Changecase::sentenceCase()
{
QTextBlock block = m_document->findBlock(m_startPosition);
QTextCursor backCursor(m_cursor);
int pos = block.position() + block.length() - 1;
// TODO
// * Exception?
while (true) {
QString text = block.text();
int prevLetterIndex = -1;
QChar currentWord;
pos = block.position() + block.length() - 1;
QString::Iterator iter = text.end();
if (text.isEmpty()) { // empty block, go to next block
if (!(block.isValid() && block.position() + block.length() < m_endPosition))
break;
block = block.next();
continue;
}
iter--;
while (iter != text.begin()) {
while (iter != text.begin() && !iter->isSpace()) {
iter--;
pos--;
}
prevLetterIndex = pos;
currentWord = QChar(*(iter + 1));
while (iter != text.begin() && iter->isSpace()) {
iter--;
pos--;
}
// found end of sentence, go back to last found letter (indicating start of a word)
if (iter != text.begin() && (*iter == QChar('.') || *iter == QChar('!') || *iter == QChar('?'))) {
if (prevLetterIndex >= m_startPosition && prevLetterIndex <= m_endPosition && currentWord.isLower()) {
// kDebug() <<"Found end of sentence" << *iter <<" :" << currentWord;
m_cursor.setPosition(prevLetterIndex);
m_cursor.deleteChar();
m_cursor.insertText(currentWord.toUpper());
iter--;
pos--;
}
else if (prevLetterIndex < m_startPosition)
break;
}
}
if (iter == text.begin() && --pos >= m_startPosition) { // start of paragraph, must be start of a sentence also
if (pos + 1 == prevLetterIndex && (*iter).isLower()) {
m_cursor.setPosition(pos);
m_cursor.deleteChar();
m_cursor.insertText((*iter).toUpper());
}
else if (!(*iter).isLetter() && currentWord.isLower()) {
m_cursor.setPosition(prevLetterIndex);
m_cursor.deleteChar();
m_cursor.insertText(currentWord.toUpper());
}
}
if (!(block.isValid() && block.position() + block.length() < m_endPosition))
break;
block = block.next();
}
}
示例14: toASS
bool Classic::toASS(const QByteArray &txt, LibASS *ass, double fps)
{
if (!ass)
return false;
bool ok = false, use_mDVD_FPS = Use_mDVD_FPS;
const QRegExp TMPRegExp("\\d{1,2}:\\d{1,2}:\\d{1,2}\\D\\s?");
const QRegExp MPL2RegExp("\\[\\d+\\]\\[\\d*\\]\\s?");
const QRegExp MicroDVDRegExp("\\{\\d+\\}\\{\\d*\\}\\s?");
QRegExp MicroDVDStylesRegExp("\\{(\\w):(.*)\\}");
MicroDVDStylesRegExp.setMinimal(true);
QList<SubWithoutEnd> subsWithoutEnd;
for (const QString &line : QString(txt).remove('\r').split('\n', QString::SkipEmptyParts))
{
double start = 0.0, duration = 0.0;
QString sub;
int idx;
if ((idx = line.indexOf(TMPRegExp)) > -1)
{
int h = -1, m = -1, s = -1;
sscanf(line.toLatin1().constData() + idx, "%d:%d:%d", &h, &m, &s);
if (h > -1 && m > -1 && s > -1)
{
start = h*3600 + m*60 + s;
sub = convertLine(TMPRegExp, line);
}
}
else if ((idx = line.indexOf(MPL2RegExp)) > -1)
{
int s = -1, e = -1;
sscanf(line.toLatin1().constData() + idx, "[%d][%d]", &s, &e);
if (s > -1)
{
for (const QString &l : convertLine(MPL2RegExp, line).split('\n'))
{
if (!sub.isEmpty())
sub.append('\n');
if (!l.isEmpty())
{
switch (l.at(0).toLatin1()) {
case '/':
sub.append("{\\i1}" + l.mid(1) + "{\\i0}");
break;
case '\\':
sub.append("{\\b1}" + l.mid(1) + "{\\b0}");
break;
case '_':
sub.append("{\\u1}" + l.mid(1) + "{\\u0}");
break;
default:
sub.append(l);
break;
}
}
}
start = s / 10.0;
duration = e / 10.0 - start;
}
}
else if ((idx = line.indexOf(MicroDVDRegExp)) > -1)
{
int s = -1, e = -1;
sscanf(line.toLatin1().constData() + idx, "{%d}{%d}", &s, &e);
if (s > -1)
{
sub = convertLine(MicroDVDRegExp, line);
if (use_mDVD_FPS && (s == 0 || s == 1))
{
use_mDVD_FPS = false;
const double newFPS = sub.midRef(0, 6).toDouble();
if (newFPS > 0.0 && newFPS < 100.0)
{
fps = newFPS;
continue;
}
}
int pos = 0;
while ((pos = MicroDVDStylesRegExp.indexIn(sub, pos)) != -1)
{
const int matchedLength = MicroDVDStylesRegExp.matchedLength();
const QString styleText = MicroDVDStylesRegExp.cap(2);
const QChar s = MicroDVDStylesRegExp.cap(1).at(0);
const bool singleLine = s.isLower();
switch (s.toLower().toLatin1())
{
case 'c':
if (styleText.startsWith('$') && styleText.length() == 7)
{
replaceText(sub, pos, matchedLength, singleLine, "{\\1c&" + styleText.mid(1) + "&}", "{\\1c}");
continue;
}
break;
case 'f':
replaceText(sub, pos, matchedLength, singleLine, "{\\fn" + styleText + "}", "{\\fn}");
//.........这里部分代码省略.........