本文整理汇总了C++中qstringlist::iterator::trimmed方法的典型用法代码示例。如果您正苦于以下问题:C++ iterator::trimmed方法的具体用法?C++ iterator::trimmed怎么用?C++ iterator::trimmed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qstringlist::iterator
的用法示例。
在下文中一共展示了iterator::trimmed方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: validate
QValidator::State ListValidator::validate(QString &text, int &pos) const
{
Q_ASSERT(inner);
QStringList strings = text.split(QLatin1Char(','));
int unusedPos;
QValidator::State state = Acceptable;
for (QStringList::iterator i = strings.begin(); i != strings.end(); ++i) {
QString string = i->trimmed();
const int position = i->indexOf(string);
const int size = string.size();
const QValidator::State current = inner->validate(string, unusedPos);
i->replace(position, size, string);
if (current == Invalid) {
state = Invalid;
break;
}
if (current == Intermediate) {
if (state == Intermediate) {
state = Invalid;
break;
}
state = Intermediate;
}
}
text = strings.join(QLatin1Char(','));
return state;
}
示例2: setEditable
void QtVCardPhotoAndNameFields::setEditable(bool editable) {
this->editable = editable;
ui->avatarWidget->setEditable(editable);
ui->lineEditFN->setVisible(editable);
ui->labelFN->setVisible(!editable);
ui->lineEditNICKNAME->setVisible(editable);
ui->labelNICKNAME->setVisible(!editable);
// prefix given middle last suffix
ui->lineEditPREFIX->setVisible(editable);
ui->lineEditGIVEN->setVisible(editable);
ui->lineEditMIDDLE->setVisible(editable);
ui->lineEditFAMILY->setVisible(editable);
ui->lineEditSUFFIX->setVisible(editable);
ui->labelFULLNAME->setVisible(!editable);
QStringList fullname;
fullname << ui->lineEditPREFIX->text() << ui->lineEditGIVEN->text() << ui->lineEditMIDDLE->text();
fullname << ui->lineEditFAMILY->text() << ui->lineEditSUFFIX->text();
for (QStringList::iterator i = fullname.begin(); i != fullname.end(); i++) {
*i = i->trimmed();
}
ui->labelFULLNAME->setText((fullname.filter(QRegExp(".+"))).join(" "));
}
示例3: pathList
QStringList PathListEditor::pathList() const
{
const QString text = d->edit->toPlainText().trimmed();
if (text.isEmpty())
return QStringList();
// trim each line
QStringList rc = text.split(QLatin1Char('\n'), QString::SkipEmptyParts);
const QStringList::iterator end = rc.end();
for (QStringList::iterator it = rc.begin(); it != end; ++it)
*it = it->trimmed();
return rc;
}
示例4: getAttributeInfo
void synaxErrorJudger::getAttributeInfo(vector<string> &attributeNameList,
vector<pair<int, size_t>> &dataTypeInfo, set<string> &uniqueAttribute)
{
int begin = sqlExp.indexOf('(') + 1;
int end = sqlExp.lastIndexOf(',') - 1;
QStringList attrList = sqlExp.mid(begin, end - begin + 1).split(',');
QStringList::iterator it;
for (it = attrList.begin(); it != attrList.end(); ++it) {
if (it->trimmed() == "") {
throw QString("Synax Error: Create statement's format is incorrect.");
}
string attributeName = it->section(' ', 0, 0, QString::SectionSkipEmpty).trimmed().toStdString();
attributeNameList.push_back(attributeName);
if (it->indexOf("unique") != -1) {
uniqueAttribute.insert(attributeName);
it->remove(it->indexOf("unique"), sizeof("unique") - 1);
}
it->remove(it->indexOf(attributeName.c_str()), attributeName.size());
*it = it->trimmed();
if (*it == "int") {
dataTypeInfo.push_back(pair<int, size_t>(_INT, sizeof(int)));
}
else if (*it == "char") {
dataTypeInfo.push_back(pair<int, size_t>(_CHAR, sizeof(char)));
}
else if (*it == "float") {
dataTypeInfo.push_back(pair<int, size_t>(_FLOAT, sizeof(float)));
}
else { //一定是char(n,因为通过了前面正则表达式的匹配
it->remove("char").remove('(').remove(')'); //去除括号
int length = it->trimmed().toInt();
if (length < 1 || length > 255) {
throw QString("Synax Error: The length of string is overflow.");
}
dataTypeInfo.push_back(pair<int, size_t>(_STRING, sizeof(char) * length));
}
}
}
示例5: generateSelectAttribute
void synaxErrorJudger::generateSelectAttribute()
{
int begin = sqlExp.indexOf("select") + 6;
int end = sqlExp.indexOf("from") - 1;
QStringList selectAttrs = sqlExp.mid(begin, end - begin + 1).split(',');
QStringList::iterator it;
for (it = selectAttrs.begin(); it != selectAttrs.end(); ++it) {
*it = it->trimmed();
if (*it == "") {
throw QString("Synax Error: Select statement's format is incorrect.");
}
if (selectAttribute == 0) {
selectAttribute = new vector<string>;
}
selectAttribute->push_back(it->toStdString());
}
}
示例6: isAlldataTypeValid
bool synaxErrorJudger::isAlldataTypeValid(QStringList &data, vector<pair<int, size_t>> &dataTypeInfo)
{
QStringList::iterator it;
for (it = data.begin(); it != data.end(); ++it) {
*it = it->trimmed();
if (*it == "") {
return false;
}
bool ok;
if (it->indexOf('\'') != -1) { //引号'应该是字符或字符串
it->remove(0, 1).remove(QRegExp("'$"));
size_t len = it->size();
if (len < 1 || len > 255) {
return false;
}
else if (len == 1) {
dataTypeInfo.push_back(pair<int, size_t>(_CHAR, sizeof(char)));
}
else {
dataTypeInfo.push_back(pair<int, size_t>(_STRING, len * sizeof(char)));
}
}
else if (it->indexOf('.') != -1) { //有小数点且不是字符串,应该是float
it->toFloat(&ok);
if (!ok) {
return false;
}
else {
dataTypeInfo.push_back(pair<int, size_t>(_FLOAT, sizeof(float)));
}
}
else { //剩下的应该是int类型
it->toInt(&ok);
if (!ok) {
return false;
}
else {
dataTypeInfo.push_back(pair<int, size_t>(_INT, sizeof(int)));
}
}
}
return true;
}
示例7: accept
void PreferenceDialog::accept()
{
QSettings settings;
QAbstractButton *selected;
//>>>>> 起動と終了
// 起動時のサイズ
if (!ui->bootSize->isChecked()) {
settings.setValue(IniKey_BootSizeSpec, "");
}
else {
selected = ui->sizeOptions->checkedButton();
settings.setValue(IniKey_BootSizeSpec, selected->objectName());
QSize size;
// 絶対指定
size = QSize(ui->absoluteWidth->value(), ui->absoluteHeight->value());
settings.setValue(IniKey_BootSizeAbs, size);
// 相対指定
size = QSize(ui->relativeWidth->value(), ui->relativeHeight->value());
settings.setValue(IniKey_BootSizeRel, size);
}
// 起動時の位置
if (!ui->bootPos->isChecked()) {
settings.setValue(IniKey_BootPosSpec, "");
}
else {
selected = ui->posOptions->checkedButton();
settings.setValue(IniKey_BootPosSpec, selected->objectName());
// 絶対指定
QPoint pos;
pos = QPoint(ui->absoluteLeft->value(), ui->absoluteTop->value());
settings.setValue(IniKey_BootPosAbs, pos);
// 相対指定
pos = QPoint(ui->relativeLeft->value(), ui->relativeTop->value());
settings.setValue(IniKey_BootPosRel, pos);
}
// 起動時の設定削除
settings.setValue(IniKey_ResetOnBoot, ui->resetOnBoot->isChecked());
// 終了時の確認ダイアログ
settings.setValue(IniKey_ConfirmExit, ui->confirmExit->isChecked());
// アップデートのチェック
settings.setValue(IniKey_CheckUpdates, ui->checkUpdates->isChecked());
//>>>>> 色とフォント
saveAppearance(settings);
settings.setValue(IniKey_Darkness, ui->dark->value());
//>>>>> ファイル操作
settings.setValue(IniKey_ConfirmCopy, ui->confirmCopy->isChecked());
settings.setValue(IniKey_ConfirmDelete, ui->confirmDelete->isChecked());
settings.setValue(IniKey_ConfirmMove, ui->confirmMove->isChecked());
settings.setValue(IniKey_ConfirmRename, ui->confirmRename->isChecked());
settings.setValue(IniKey_AutoCloseCopy, ui->autoCloseCopy->isChecked());
settings.setValue(IniKey_AutoCloseDelete, ui->autoCloseDelete->isChecked());
settings.setValue(IniKey_AutoCloseMove, ui->autoCloseMove->isChecked());
settings.setValue(IniKey_AutoCloseRename, ui->autoCloseRename->isChecked());
selected = ui->overwriteOptions->checkedButton();
settings.setValue(IniKey_DefaultOnCopy, selected->objectName());
settings.setValue(IniKey_MoveAfterCreateFolder, ui->moveAfterCreate->isChecked());
settings.setValue(IniKey_OpenAfterCreateFile, ui->openAfterCreate->isChecked());
//>>>>> パス設定
settings.setValue(IniKey_PathEditor, ui->editorPath->text().trimmed());
settings.setValue(IniKey_PathTerminal, ui->terminalPath->text().trimmed());
settings.setValue(IniKey_PathArchiver, ui->archiverPath->text().trimmed());
//>>>>> テキストビューア
settings.setValue(IniKey_ViewerFont, ui->viewerSample->font());
settings.setValue(IniKey_ViewerColorBg, ui->viewerSample->palette().base().color());
settings.setValue(IniKey_ViewerColorFg, ui->viewerSample->palette().text().color());
settings.setValue(IniKey_ViewerInherit, ui->viewerInherit->isChecked());
settings.setValue(IniKey_ViewerForceOpen, !ui->enableViewerIgnoreExt->isChecked());
QStringList list = ui->viewerIgnoreExt->toPlainText().split(",", QString::SkipEmptyParts);
QStringList::iterator it;
for (it = list.begin(); it != list.end(); it++) {
*it = it->trimmed();
}
settings.setValue(IniKey_ViewerIgnoreExt, list.join(","));
QDialog::accept();
}
示例8: generateCondition
void synaxErrorJudger::generateCondition()
{
int begin = sqlExp.indexOf("where") + 5;
int end = sqlExp.indexOf(QRegExp(";$")) - 1;
QStringList conditions = sqlExp.mid(begin, end - begin + 1).split("and");
QStringList::iterator it;
pair<int, size_t> dataType;
int logicType;
string rightSide, leftSide;
for (it = conditions.begin(); it != conditions.end(); ++it) {
*it = it->trimmed();
if (*it == "") {
throw QString("Synax Error: Conditions' format is incorrect.");
}
int begin = 0;
int end = it->indexOf(QRegExp("[=><]"))-1;
rightSide = it->mid(begin, end - begin + 1).trimmed().toStdString();
begin = end + 1;
end = it->indexOf(QRegExp("[=><]"), begin + 1);
if (end - begin > 1 || end == -1) { //如果下一个"=",">","<"号出现在较远处
end = begin; //说明这个逻辑关系是"=",">","<"而非">=", "<=", "<>"
}
logicType = condition::getLogicTypeFromStr(it->mid(begin, end - begin + 1).toStdString());
if (logicType == _ERROR) {
throw QString("Synax Error: The logic arithemtic is invalid.");
}
bool ok;
*it = it->mid(end + 1).trimmed();
if (it->indexOf(QRegExp("^'")) != -1) { //引号'应该是字符或字符串
it->remove(0, 1).remove(QRegExp("'$"));
size_t len = it->size();
pair<int, size_t> dType;
Api::cManager.getAttributeDataType(*tblName, rightSide, dType);
if (len < 1 || len > 255 || len > dType.second) {
throw QString("Synax Error: The length of string is overflow.");
}
else if (len == 1) {
dataType = pair<int, size_t>(_CHAR, sizeof(char));
}
else {
dataType = pair<int, size_t>(_STRING, dType.second * sizeof(char));
}
}
else if (it->indexOf('.') != -1) { //有小数点且不是字符串,应该是float
it->toFloat(&ok);
if (!ok) {
;
}
else {
dataType = pair<int, size_t>(_FLOAT, sizeof(float));
}
}
else { //剩下的应该是int类型
it->toInt(&ok);
if (!ok) {
;
}
else {
dataType = pair<int, size_t>(_INT, sizeof(int));
}
}
leftSide = it->toStdString();
if (cond == 0) {
cond = new vector<condition>;
}
cond->push_back(condition(rightSide, logicType, dataType, leftSide));
}
}