本文整理汇总了C++中QChar::isMark方法的典型用法代码示例。如果您正苦于以下问题:C++ QChar::isMark方法的具体用法?C++ QChar::isMark怎么用?C++ QChar::isMark使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QChar
的用法示例。
在下文中一共展示了QChar::isMark方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: isWordCharacter
inline bool isWordCharacter(const QChar& c)
{
// The Qt docs say for word characters:
// \w - Matches a word character (QChar::isLetterOrNumber(), QChar::isMark(), or '_').
// see also: http://doc.trolltech.com/qregexp.html
return c.isLetterOrNumber() || c.isMark() || c.unicode() == '_';
}
示例2: isWordChar
bool Tokenizer::isWordChar(const QChar& c)
{
// this method exists because some languages have non-letter category charaters
// mixed with their letter character to make words (like hindi)
// NOTE: this has to be extended then languages give problems,
// just add a category in the following test
return (c.isLetter() || c.isMark());
}
示例3: deleteWordBefore
CmdState YModeInsert::deleteWordBefore(const YCommandArgs &args)
{
YCursor cur = args.view->getLinePositionCursor();
YBuffer* mBuffer = args.view->buffer();
if(cur.x() == 0 && cur.y() > 0 && args.view->getLocalStringOption("backspace").contains("eol")) {
mBuffer->action()->mergeNextLine(args.view, cur.y() - 1);
//mBuffer->action()->deleteChar( mView, *mView->getLinePositionCursor(), 1 ); see bug #158
} else {
QString line = mBuffer->textline(cur.y());
QChar tmp;
bool isWord;
int x = cur.x();
// delete whitespace characters preceding current word
while(x > 0 && line[x - 1].isSpace()) {
--x;
}
// delete a word or set of not-word not-whitespace characters
if(x > 0) {
tmp = line[x - 1];
isWord = tmp.isLetterOrNumber() || tmp == '_' || tmp.isMark();
// delete word behind the cursor (if there is one)
if(isWord)
while(isWord && --x > 0) {
tmp = line[x - 1];
isWord = (tmp.isLetterOrNumber() || tmp == '_' || tmp.isMark());
}
// otherwise, delete all not-word and not-whitespace
// characters behind the cursor
else
while(!isWord && !tmp.isSpace() && --x > 0) {
tmp = line[x - 1];
isWord = (tmp.isLetterOrNumber() || tmp == '_' || tmp.isMark());
}
}
//do it
mBuffer->action()->deleteChar(args.view, x, cur.y(), cur.x() - x);
}
return CmdOk;
}
示例4: 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;
}
示例5: if
static bool to8bit(const QChar ch, QCString *rstr)
{
bool converted = FALSE;
if( ch.isMark() ) return TRUE; // ignore marks for conversion
if ( ch.row() ) {
if ( ch.row() == 0x05 ) {
if ( ch.cell() > 0x91 )
converted = TRUE;
// 0x0591 - 0x05cf: Hebrew punctuation... dropped
if ( ch.cell() >= 0xD0 )
*rstr += (char)unicode_to_heb_05[ch.cell()- 0xD0];
} else if ( ch.row() == 0x20 ) {
if ( ch.cell() == 0x3E ) {
*rstr += (char)0xAF;
converted = TRUE;
} else if ( ch.cell() == 0x17 ) {
*rstr += (char)0xCF;
converted = TRUE;
}
} else {
converted = FALSE;
}
} else {
if ( ch.cell() < 0x80 ) {
*rstr += (char)ch.cell();
converted = TRUE;
} else if( ch.cell() < 0xA0 ) {
*rstr += (char)unicode_to_heb_00[ch.cell() - 0x80];
converted = TRUE;
}
}
if(converted) return TRUE;
// couldn't convert the char... lets try its decomposition
QString d = ch.decomposition();
if(d.isNull())
return FALSE;
int l = d.length();
for (int i=0; i<l; i++) {
const QChar ch = d[i];
if(to8bit(ch, rstr))
converted = TRUE;
}
return converted;
}
示例6: completionRange
// Return the range containing the word left of the cursor
KTextEditor::Range KateWordCompletionModel::completionRange(KTextEditor::View* view, const KTextEditor::Cursor &position)
{
int line = position.line();
int col = position.column();
KTextEditor::Document *doc = view->document();
while ( col > 0 )
{
QChar c = ( doc->character( KTextEditor::Cursor( line, col-1 ) ) );
if ( c.isLetterOrNumber() || c.isMark() || c == '_' )
{
col--;
continue;
}
break;
}
return KTextEditor::Range( KTextEditor::Cursor( line, col ), position );
}
示例7: isWordCharacter
inline bool isWordCharacter(const QChar &c)
{
// http://pcre.org/pcre.txt say for word characters:
// \w any character that matches \p{L} or \p{N}, plus underscore
return c.isLetterOrNumber() || c.isMark() || c.unicode() == '_';
}
示例8: isSentenceSeparator
static inline bool isSentenceSeparator(const QChar &character)
{
return character.isMark() || character.isPunct() || character.category() == QChar::Separator_Paragraph;
}
示例9: isWordSeparator
static inline bool isWordSeparator(const QChar character)
{
return character.isSpace() || character.isMark() || character.isPunct() || character.isSymbol();
}