本文整理汇总了C++中QByteArray::toUpper方法的典型用法代码示例。如果您正苦于以下问题:C++ QByteArray::toUpper方法的具体用法?C++ QByteArray::toUpper怎么用?C++ QByteArray::toUpper使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QByteArray
的用法示例。
在下文中一共展示了QByteArray::toUpper方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetSupportedFileFormats
void GetSupportedFileFormats(QList<QByteArray> &g_supportedFormats)
{
// Assemble list of supported Image Formats from our plugin
int numPlugins = g_pluginManager.getNumPlugins();
for (int i = 0; i< numPlugins; i++)
{
if (strcmp(g_pluginManager.getPluginType(i), "IMAGE") == 0)
{
QByteArray bArray = g_pluginManager.getPluginName(i);
QByteArray fformat = bArray.toUpper();
if (!g_supportedFormats.contains(fformat))
g_supportedFormats.append(fformat);
}
}
// Get a list of all Supported file formats from Qt Plugins
QList<QByteArray> QtFormats = QImageReader::supportedImageFormats();
// Upppercase List
QList<QByteArray>::Iterator i;
for (i = QtFormats.begin(); i != QtFormats.end(); ++i)
{
QByteArray fformat = (*i);
fformat = fformat.toUpper();
if (!g_supportedFormats.contains(fformat))
g_supportedFormats.append(fformat);
}
// Sort the list to alphabetical order
std::sort(g_supportedFormats.begin(), g_supportedFormats.end());
}
示例2: setHeader
void HttpMessage::setHeader(const QByteArray &name, const QByteArray &value)
{
if (!name.isEmpty()) {
if (!value.isNull())
// sets the value
m_headers[name.toUpper()] = value;
else
// erases the header
m_headers.remove(name.toUpper());
}
}
示例3: error
void CiscoSecret7::transform(const QByteArray &input, QByteArray &output)
{
if (wayValue == INBOUND) {
QByteArray data;
cipher(seed,input, data);
output = data.toHex().prepend(QByteArray::number(seed));
} else {
QByteArray encrypted = input.toUpper();
if (encrypted.isEmpty())
return;
if (encrypted.size() < 3) {
emit error(tr("Invalid hash (far too small)"),id);
return;
}
bool k = true;
seed = encrypted.mid(0,2).toInt(&k);
if (!k || seed > MAXSEED) {
emit error(tr("Invalid seed, it must be an unsigned integer <= %1").arg(MAXSEED),id);
return;
}
QByteArray data = encrypted.mid(2);
data = fromHex(data);
cipher(seed,data,output);
}
}
示例4: toByteArray
QByteArray vCardParam::toByteArray(QList<vCardParam> params, vCardVersion version)
{
QByteArray buffer;
switch (version)
{
case VC_VER_2_1:
{
QStringList ps;
for (const vCardParam& param : params)
ps.append(param.toByteArray(VC_VER_2_1));
buffer.append(ps.join(QString(VC_SEPARATOR_TOKEN)));
}
break;
case VC_VER_3_0:
{
QStringList types;
QStringList encodings;
QStringList charsets;
QStringList unknowns;
for (const vCardParam& param : params)
{
QByteArray param_str = param.toByteArray(VC_VER_2_1);
switch (param.group())
{
case Type:
types.append(param_str);
break;
case Encoding:
encodings.append(param_str);
break;
case Charset:
charsets.append(param_str);
break;
default:
unknowns.append(param_str);
}
}
unknowns += charsets;
unknowns += encodings;
if (!types.isEmpty())
unknowns.prepend(QString(VC_GROUP_TOKEN).arg(VC_TYPE_TOKEN).arg(types.join(QString(VC_TYPE_SEP_TOKEN))));
if (!unknowns.isEmpty())
buffer.append(unknowns.join(QString(VC_SEPARATOR_TOKEN)));
}
break;
default:
break;
}
return buffer.toUpper();
}
示例5: authorizationHeader
QByteArray TwitterDataUtil::authorizationHeader(const QByteArray &oauthConsumerKey,
const QByteArray &oauthConsumerSecret,
const QByteArray &requestMethod,
const QByteArray &requestUrl,
const std::vector<std::pair<QByteArray, QByteArray>> ¶meters,
const QByteArray &oauthToken,
const QByteArray &oauthTokenSecret,
const QByteArray &oauthNonce,
const QByteArray &oauthTimestamp)
{
// Twitter requires all requests to be signed with an authorization header.
QByteArray nonce {oauthNonce};
if (nonce.isEmpty()) {
nonce = QUuid::createUuid().toByteArray().toBase64();
}
QByteArray timestamp {oauthTimestamp};
if (timestamp.isEmpty()) {
timestamp = QByteArray::number(qFloor(QDateTime::currentMSecsSinceEpoch() / 1000.0));
}
// now build up the encoded parameters map. We use a map to perform alphabetical sorting.
QMap<QByteArray, QByteArray> encodedParams {};
encodedParams.insert(QByteArray("oauth_consumer_key").toPercentEncoding(), QByteArray(oauthConsumerKey).toPercentEncoding());
encodedParams.insert(QByteArray("oauth_nonce").toPercentEncoding(), nonce.toPercentEncoding());
encodedParams.insert(QByteArray("oauth_signature_method").toPercentEncoding(), QByteArray(OAUTH_SIGNATURE_METHOD).toPercentEncoding());
encodedParams.insert(QByteArray("oauth_timestamp").toPercentEncoding(), timestamp.toPercentEncoding());
encodedParams.insert(QByteArray("oauth_version").toPercentEncoding(), QByteArray(OAUTH_VERSION).toPercentEncoding());
if (!oauthToken.isEmpty()) {
encodedParams.insert(QByteArray("oauth_token").toPercentEncoding(), oauthToken.toPercentEncoding());
}
for (const std::pair<QByteArray, QByteArray> ¶meter : parameters) {
encodedParams.insert(parameter.first, parameter.second);
}
QByteArray parametersByteArray {};
QList<QByteArray> keys = encodedParams.keys();
for (const QByteArray &key : keys) {
parametersByteArray += key + QByteArray("=") + encodedParams.value(key) + QByteArray("&");
}
parametersByteArray.chop(1);
QByteArray signatureBaseString {requestMethod.toUpper() + QByteArray("&") + requestUrl.toPercentEncoding() + QByteArray("&") + parametersByteArray.toPercentEncoding()};
QByteArray signingKey {oauthConsumerSecret.toPercentEncoding() + QByteArray("&") + oauthTokenSecret.toPercentEncoding()};
QByteArray oauthSignature {QMessageAuthenticationCode::hash(signatureBaseString, signingKey, QCryptographicHash::Sha1).toBase64()};
encodedParams.insert(QByteArray("oauth_signature").toPercentEncoding(), oauthSignature.toPercentEncoding());
// now generate the Authorization header from the encoded parameters map.
// we need to remove the query items from the encoded parameters map first.
QByteArray authHeader = QByteArray("OAuth ");
for (const std::pair<QByteArray, QByteArray> ¶meter : parameters) {
encodedParams.remove(parameter.first);
}
keys = encodedParams.keys();
foreach (const QByteArray &key, keys) {
authHeader += key + "=\"" + encodedParams.value(key) + "\", ";
}
示例6: toByteArray
QByteArray vCardParam::toByteArray(vCardVersion version) const
{
QByteArray buffer;
switch (version)
{
case VC_VER_2_1:
{
switch (m_group)
{
case vCardParam::Charset:
buffer.append(QString(VC_GROUP_TOKEN).arg(VC_CHARSET_TOKEN).arg(m_value));
break;
case vCardParam::Encoding:
buffer.append(QString(VC_GROUP_TOKEN).arg(VC_ENCODING_TOKEN).arg(m_value));
break;
default:
buffer.append(m_value);
break;
}
break;
}
break;
case VC_VER_3_0:
{
switch (m_group)
{
case vCardParam::Type:
buffer.append(QString(VC_GROUP_TOKEN).arg(VC_TYPE_TOKEN).arg(m_value));
break;
case vCardParam::Charset:
buffer.append(QString(VC_GROUP_TOKEN).arg(VC_CHARSET_TOKEN).arg(m_value));
break;
case vCardParam::Encoding:
buffer.append(QString(VC_GROUP_TOKEN).arg(VC_ENCODING_TOKEN).arg(m_value));
break;
default:
buffer.append(m_value);
break;
}
}
break;
default:
break;
}
return buffer.toUpper();
}
示例7: save
bool QImageLoader::save(const QString& filePath, DImgLoaderObserver* const observer)
{
QVariant qualityAttr = imageGetAttribute(QLatin1String("quality"));
int quality = qualityAttr.isValid() ? qualityAttr.toInt() : 90;
if (quality < 0)
{
quality = 90;
}
if (quality > 100)
{
quality = 100;
}
QVariant formatAttr = imageGetAttribute(QLatin1String("format"));
QByteArray format = formatAttr.toByteArray();
QImage image = m_image->copyQImage();
if (observer)
{
observer->progressInfo(m_image, 0.1F);
}
// Saving is opaque to us. No support for stopping from observer,
// progress info are only pseudo values
bool success = image.save(filePath, format.toUpper().constData(), quality);
if (observer && success)
{
observer->progressInfo(m_image, 1.0F);
}
imageSetAttribute(QLatin1String("format"), format.toUpper());
saveMetadata(filePath);
return success;
}
示例8: detectKDEDesktopIsRunning
static inline bool detectKDEDesktopIsRunning()
{
const QByteArray xdgCurrentDesktop = qgetenv("XDG_CURRENT_DESKTOP");
if (!xdgCurrentDesktop.isEmpty())
return (xdgCurrentDesktop.toUpper() == "KDE");
// Classic fallbacks
if (!qgetenv("KDE_FULL_SESSION").isEmpty())
return true;
return false;
}
示例9: run
void BestPositionFindTask::run() {
U2SequenceObject dnaSeq("sequence", sequenceRef);
QByteArray sequence = dnaSeq.getWholeSequenceData(stateInfo);
CHECK_OP(stateInfo, );
if(sequence.isEmpty()) {
return;
}
if(!inputMsa->getAlphabet()->isCaseSensitive()) {
sequence = sequence.toUpper();
}
const int aliLen = inputMsa->getLength();
const int nSeq = inputMsa->getNumRows();
int similarity = 0;
if(referenceRowId >= 0) {
const MultipleSequenceAlignmentRow row = inputMsa->getMsaRow(referenceRowId);
int iterationsNum = aliLen - sequence.length() + 1;
for (int p = 0; p < iterationsNum; p++ ) {
stateInfo.setProgress(100 * p / iterationsNum);
char c = row->charAt(p);
int selLength = 0;
int patternSimilarity = MSAUtils::getPatternSimilarityIgnoreGaps(row, p, sequence, selLength);
if (U2Msa::GAP_CHAR != c && patternSimilarity > similarity) {
similarity = patternSimilarity;
bestPosition = p;
}
}
} else {
int processedRows = 0;
foreach(const MultipleSequenceAlignmentRow &row, inputMsa->getMsaRows()) {
stateInfo.setProgress(100 * processedRows / nSeq);
for (int p = 0; p < ( aliLen - sequence.length() + 1 ); p++ ) {
char c = row->charAt(p);
int selLength = 0;
int patternSimilarity = MSAUtils::getPatternSimilarityIgnoreGaps(row, p, sequence, selLength);
if (U2Msa::GAP_CHAR != c && patternSimilarity > similarity) {
similarity = patternSimilarity;
bestPosition = p;
}
}
processedRows++;
}
}
}
示例10: export_as
void MainWindow::export_as()
{
QAction *action = qobject_cast<QAction *>(sender());
QByteArray fileFormat = action->data().toByteArray();
QString initialPath = QDir::currentPath() + "/map." + fileFormat;
QString fileName = QFileDialog::getSaveFileName(this, tr("Export As"),
initialPath,
tr("%1 Files (*.%2);;All Files (*)")
.arg(QString(fileFormat.toUpper()))
.arg(QString(fileFormat)));
if (!fileName.isEmpty())
{
QPixmap const& pix = mapWidget_->pixmap();
pix.save(fileName);
}
}
示例11: setSymbol
void CurrencyPairItem::setSymbol(QByteArray symb)
{
symbol=symb.toUpper();
if(symbol.size()!=6){symbol.clear();return;}
currAStr=symbol.left(3);
currAStrLow=currAStr.toLower();
currBStr=symbol.right(3);
currBStrLow=currBStr.toLower();
currAInfo=baseValues_->currencyMap.value(currAStr,CurencyInfo("$"));
currBInfo=baseValues_->currencyMap.value(currBStr,CurencyInfo("$"));
currASign=currAInfo.sign;
currBSign=currBInfo.sign;
currAName=currAInfo.name;
}
示例12: QByteArrayLiteral
static inline QByteArray detectDesktopEnvironment()
{
const QByteArray xdgCurrentDesktop = qgetenv("XDG_CURRENT_DESKTOP");
if (!xdgCurrentDesktop.isEmpty())
return xdgCurrentDesktop.toUpper(); // KDE, GNOME, UNITY, LXDE, MATE, XFCE...
// Classic fallbacks
if (!qEnvironmentVariableIsEmpty("KDE_FULL_SESSION"))
return QByteArrayLiteral("KDE");
if (!qEnvironmentVariableIsEmpty("GNOME_DESKTOP_SESSION_ID"))
return QByteArrayLiteral("GNOME");
// Fallback to checking $DESKTOP_SESSION (unreliable)
const QByteArray desktopSession = qgetenv("DESKTOP_SESSION");
if (desktopSession == "gnome")
return QByteArrayLiteral("GNOME");
if (desktopSession == "xfce")
return QByteArrayLiteral("XFCE");
return QByteArrayLiteral("UNKNOWN");
}
示例13: QByteArrayLiteral
static inline QByteArray detectDesktopEnvironment()
{
const QByteArray xdgCurrentDesktop = qgetenv("XDG_CURRENT_DESKTOP");
if (!xdgCurrentDesktop.isEmpty())
// See http://standards.freedesktop.org/menu-spec/latest/apb.html
return xdgCurrentDesktop.toUpper();
// Classic fallbacks
if (!qEnvironmentVariableIsEmpty("KDE_FULL_SESSION"))
return QByteArrayLiteral("KDE");
if (!qEnvironmentVariableIsEmpty("GNOME_DESKTOP_SESSION_ID"))
return QByteArrayLiteral("GNOME");
// Fallback to checking $DESKTOP_SESSION (unreliable)
const QByteArray desktopSession = qgetenv("DESKTOP_SESSION");
if (desktopSession == "gnome")
return QByteArrayLiteral("GNOME");
if (desktopSession == "xfce")
return QByteArrayLiteral("XFCE");
return QByteArrayLiteral("UNKNOWN");
}
示例14: regexUnseen
ImapMailbox *ImapPrivate::parseMailbox (const QString& mailboxName) {
ImapMailbox *mailbox = NULL;
QByteArray response = readLine();
//QByteArray response = socket->readAll().data();
if (response.startsWith(IMAP_TAG) || response.startsWith('*')) {
QRegExp regexUnseen("\\[UNSEEN (\\d+)\\]");
QRegExp regexExists("(\\d+) EXISTS");
QRegExp regexRecent("(\\d+) RECENT");
QRegExp regexFlags(" FLAGS \\((.*)\\)");
mailbox = new ImapMailbox(mailboxName);
do {
if (regexExists.indexIn(response) != -1) {
mailbox->setExists(regexExists.cap(1).toInt());
} else if (regexRecent.indexIn(response) != -1) {
mailbox->setRecent(regexRecent.cap(1).toInt());
} else if (regexFlags.indexIn(response) != -1) {
mailbox->setFlags(regexFlags.cap(1));
} else if (regexUnseen.indexIn(response) != -1) {
mailbox->setUnseen(regexUnseen.cap(1).toInt());
}
response = readLine();
} while (response.startsWith('*'));
response = response.toUpper();
if (isResponseOk(response) &&
(response.contains("READ/WRITE") || response.contains("READ-WRITE")))
{
mailbox->setReadWrite(true);
}
}
return(mailbox);
}
示例15: escapeIdentifier
QByteArray Driver::escapeIdentifier(const QByteArray& str, int options) const
{
if (options & EscapeKexi) {
return KexiDB::escapeIdentifier(str, options);
}
bool needOuterQuotes = false;
// Need to use quotes if ...
// ... we have been told to, or ...
if (options & EscapeAlways)
needOuterQuotes = true;
// ... or if the driver does not have a list of keywords,
else if (d->driverSpecificSQLKeywords.isEmpty())
needOuterQuotes = true;
// ... or if it's a keyword in Kexi's SQL dialect,
else if (KexiDB::isKexiSQLKeyword(str))
needOuterQuotes = true;
// ... or if it's a keyword in the backends SQL dialect,
else if ((options & EscapeDriver) && d->driverSpecificSQLKeywords.contains(str.toUpper()))
needOuterQuotes = true;
// ... or if the identifier has a space in it...
else if (str.contains(' '))
needOuterQuotes = true;
if (needOuterQuotes) {
const char quote = beh->QUOTATION_MARKS_FOR_IDENTIFIER.toLatin1();
return quote + drv_escapeIdentifier(str) + quote;
} else {
return drv_escapeIdentifier(str);
}
}