本文整理汇总了C++中QChar::isHighSurrogate方法的典型用法代码示例。如果您正苦于以下问题:C++ QChar::isHighSurrogate方法的具体用法?C++ QChar::isHighSurrogate怎么用?C++ QChar::isHighSurrogate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QChar
的用法示例。
在下文中一共展示了QChar::isHighSurrogate方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: isValidIdentifierChar
static bool isValidIdentifierChar(const QChar &character)
{
return character.isLetterOrNumber()
|| character == QLatin1Char('_')
|| character.isHighSurrogate()
|| character.isLowSurrogate();
}
示例2: incr
void iLine::incr()
{
++col;
if (!eol()) {
QChar c = l->txt[p];
if (c.isHighSurrogate())
++p;
if (!(l->txt[p] == '\t' && (col % TABL)))
++p;
}
}
示例3: if
QString KdbxXmlWriter::stripInvalidXml10Chars(QString str)
{
for (int i = str.size() - 1; i >= 0; i--) {
const QChar ch = str.at(i);
const ushort uc = ch.unicode();
if (ch.isLowSurrogate() && i != 0 && str.at(i - 1).isHighSurrogate()) {
// keep valid surrogate pair
i--;
} else if ((uc < 0x20 && uc != 0x09 && uc != 0x0A && uc != 0x0D) // control characters
|| (uc >= 0x7F && uc <= 0x84) // control characters, valid but discouraged by XML
|| (uc >= 0x86 && uc <= 0x9F) // control characters, valid but discouraged by XML
|| (uc > 0xFFFD) // noncharacter
|| ch.isLowSurrogate() // single low surrogate
|| ch.isHighSurrogate()) // single high surrogate
{
qWarning("Stripping invalid XML 1.0 codepoint %x", uc);
str.remove(i, 1);
}
}
return str;
}
示例4: isValidFirstIdentifierChar
bool isValidFirstIdentifierChar(const QChar &ch)
{
return ch.isLetter() || ch == QLatin1Char('_') || ch.isHighSurrogate() || ch.isLowSurrogate();
}
示例5: paste
void TextBase::paste(EditData& ed)
{
QString txt = QApplication::clipboard()->text(QClipboard::Clipboard);
if (MScore::debugMode)
qDebug("<%s>", qPrintable(txt));
int state = 0;
QString token;
QString sym;
bool symState = false;
score()->startCmd();
for (int i = 0; i < txt.length(); i++ ) {
QChar c = txt[i];
if (state == 0) {
if (c == '<') {
state = 1;
token.clear();
}
else if (c == '&') {
state = 2;
token.clear();
}
else {
if (symState)
sym += c;
else {
deleteSelectedText(ed);
if (c.isHighSurrogate()) {
QChar highSurrogate = c;
Q_ASSERT(i + 1 < txt.length());
i++;
QChar lowSurrogate = txt[i];
insertText(ed, QString(QChar::surrogateToUcs4(highSurrogate, lowSurrogate)));
}
else {
insertText(ed, QString(QChar(c.unicode())));
}
}
}
}
else if (state == 1) {
if (c == '>') {
state = 0;
if (token == "sym") {
symState = true;
sym.clear();
}
else if (token == "/sym") {
symState = false;
insertSym(ed, Sym::name2id(sym));
}
}
else
token += c;
}
else if (state == 2) {
if (c == ';') {
state = 0;
if (token == "lt")
insertText(ed, "<");
else if (token == "gt")
insertText(ed, ">");
else if (token == "amp")
insertText(ed, "&");
else if (token == "quot")
insertText(ed, "\"");
else
insertSym(ed, Sym::name2id(token));
}
else if (!c.isLetter()) {
state = 0;
insertText(ed, "&");
insertText(ed, token);
insertText(ed, c);
}
else
token += c;
}
}
if (state == 2) {
insertText(ed, "&");
insertText(ed, token);
}
score()->endCmd();
}