当前位置: 首页>>代码示例>>C++>>正文


C++ QByteArray::simplified方法代码示例

本文整理汇总了C++中QByteArray::simplified方法的典型用法代码示例。如果您正苦于以下问题:C++ QByteArray::simplified方法的具体用法?C++ QByteArray::simplified怎么用?C++ QByteArray::simplified使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QByteArray的用法示例。


在下文中一共展示了QByteArray::simplified方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: printError

 void printError()
 {
     QByteArray errorOut = streamProcess.readAllStandardError();
     qDebug() << "Called the C++ slot and got following error:" << errorOut.simplified();
     errorMsg = errorOut.simplified();
     error(errorMsg);
 }
开发者ID:rafael-rojas,项目名称:videoPlayer,代码行数:7,代码来源:youtubedl-helper.hpp

示例2:

// ------------------------------------------------------------------
bool 
JcnModel::rmvEntry(const QByteArray & s, int itemRow)
{
	if (jcndbg)
		std::cout << "JcnModel::rmvEntry: " << s.simplified().toUpper() << std::endl;

	_entryMap.erase(s.simplified().toUpper());
	takeRow(itemRow);
	return true;
}
开发者ID:AwakenedOne,项目名称:qjcn,代码行数:11,代码来源:JcnModel.cpp

示例3: parseProperty

void RoomPropertySetter::parseProperty(const QByteArray &command, const Coordinate &roomPos)
{
    QList<QByteArray> words = command.simplified().split(' ');
    AbstractAction *action = 0;
    QByteArray property = words[1];
    uint pos = propPositions[property];
    if (words.size() == 4) {
        //change exit property
        ExitDirection dir = Mmapper2Exit::dirForChar(words[2][0]);
        switch (pos) {
        case E_FLAGS:
        case E_DOORFLAGS:
            action = new ModifyExitFlags(fieldValues[property], dir, pos, FMM_TOGGLE);
            break;
        case E_DOORNAME:
            action = new UpdateExitField(property, dir, pos);
            break;
        default:
            emit sendToUser("unknown property: " + property + "\r\n");
            return;
        }
    } else if (words.size() == 3) {
        //change room property
        switch (pos) {
        case R_TERRAINTYPE:
            action = new UpdatePartial(fieldValues[property], pos);
            break;
        case R_NAME:
        case R_DESC:
            action = new UpdatePartial(property, pos);
            break;
        case R_MOBFLAGS:
        case R_LOADFLAGS:
            action = new ModifyRoomFlags(fieldValues[property], pos, FMM_TOGGLE);
            break;
        case R_DYNAMICDESC:
        case R_NOTE:
            action = new UpdateRoomField(property, pos);
            break;
        case R_PORTABLETYPE:
        case R_LIGHTTYPE:
        case R_ALIGNTYPE:
        case R_RIDABLETYPE:
            action = new UpdateRoomField(fieldValues[property], pos);
            break;
        default:
            emit sendToUser("unknown property: " + property + "\r\n");
            return;
        }

        RoomPropertySetterSlave slave(action);
        emit lookingForRooms(&slave, roomPos);

        if (slave.getResult()) {
            emit sendToUser("OK\r\n");
        } else {
            emit sendToUser("setting " + property + " failed!\r\n");
        }
    }
}
开发者ID:midoc,项目名称:MMapper,代码行数:60,代码来源:roompropertysetter.cpp

示例4: convertData

void Tercon::convertData(QByteArray strData){
    TerconData data;
    bool convertIsOK=false;

    strData = strData.simplified();
    QString tempStr = strData;
    int indexSeparator = tempStr.indexOf(QRegExp("[tRU]"));
    QString unitAndNumberData = tempStr.left(indexSeparator+1);
    tempStr.remove(0,indexSeparator+1);
    if(indexSeparator==-1){
        emit message(tr("Ошибка чтения данных Теркона\n"
                        "(разделитель не обнаружен): ")+strData+".",Shared::warning);
        return;
    }

    data.value = tempStr.toDouble(&convertIsOK);
    if (!convertIsOK){
        emit message(tr("Ошибка чтения данных Теркона\n"
                        "(невозможно преобразовать строку в число): ")+strData+".",Shared::warning);
        return;
    }

    data.unit  = unitAndNumberData.at(unitAndNumberData.size()-1);
    unitAndNumberData.chop(1);

    data.channel = unitAndNumberData.toShort(&convertIsOK);
    if (!convertIsOK){
        emit message(tr("Ошибка чтения данных Теркона\n"
                        "(неверный номер канала): ")+strData+".",Shared::warning);
        return;
    }
    data.deviceNumber = deviceNumber;

    emit dataSend(data);
}
开发者ID:yatsuk,项目名称:Drop-Calorimeter,代码行数:35,代码来源:tercon.cpp

示例5: fileInfo

void TelemetrySimulator::LogPlaybackController::loadLogFile()
{
  // reset the playback ui
  ui->play->setEnabled(false);
  ui->rewind->setEnabled(false);
  ui->stepBack->setEnabled(false);
  ui->stepForward->setEnabled(false);
  ui->stop->setEnabled(false);
  ui->positionIndicator->setEnabled(false);
  ui->replayRate->setEnabled(false);
  ui->positionLabel->setText("Row #\nTimestamp");

  // clear existing data
  csvRecords.clear();

  QString logFileNameAndPath = QFileDialog::getOpenFileName(NULL, tr("Log File"), ".", tr("LOG Files (*.csv)"));
  QFileInfo fileInfo(logFileNameAndPath);
  QFile file(logFileNameAndPath);
  if (!file.open(QIODevice::ReadOnly)) {
    ui->logFileLabel->setText(tr("ERROR - invalid file"));
    return;
  }
  while (!file.atEnd()) {
    QByteArray line = file.readLine();
    csvRecords.append(line.simplified());
  }
  if (csvRecords.count() > 1) {
    columnNames.clear();
    QStringList keys = csvRecords[0].split(',');
    // override the first two column names
    keys[0] = "LogDate";
    keys[1] = "LogTime";
    Q_FOREACH(QString key, keys) {
      columnNames.append(key.simplified());
    }
开发者ID:Jasonsiu,项目名称:opentx,代码行数:35,代码来源:telemetrysimu.cpp

示例6: processText

void NoSpacesProcessor::processText()
{
    QFile file(m_filename);
    if(!file.open(QIODevice::ReadOnly)) {
        emit error(tr("Could not open file %1").arg(m_filename));
        return;
    }

    const int totalLineCount = detectLineCount();
    int lineNumber(1);

    while(!file.atEnd()) {
        emit progress(lineNumber,totalLineCount,tr("Parsing text with no spaces"));
        QByteArray line = file.readLine();

        emit lineFound(line, lineNumber);

        line = line.simplified();
        if(line.isEmpty()) {
            ++lineNumber;
            continue;
        }

        for(int pos=0;pos<line.count();++pos) {
            emit progress(pos,line.count(),tr("Line %1 of %2").arg(lineNumber).arg(totalLineCount));
            for(int len=1;len<14;++len) {
                emit combinationFound(processorName(),line.mid(pos,len),lineNumber);
            }
        }
        //emit combinationFound(processorName(), word,lineNumber);
        ++lineNumber;
    }
    file.close();

}
开发者ID:katrinaniolet,项目名称:ulp,代码行数:35,代码来源:nospacesprocessor.cpp

示例7: readSettings

/*!
    \internal
    Reads the configuration out from a io device.
*/
void dtkLoggingPrivate::readSettings(QIODevice &device)
{
    QMutexLocker locker(&_mutexRegisteredCategory);
    {
        _logConfigItemList.clear();

        if (device.open(QIODevice::ReadOnly)) {
            QByteArray truearray("true");
            QByteArray line;
            while (!device.atEnd()) {
                line = device.readLine().replace(" ", "");
                line = line.simplified();
                const QList<QByteArray> pair = line.split('=');
                if (pair.count() == 2)
                    _logConfigItemList.append(dtkLogConfigFilterItem(QString::fromLatin1(pair.at(0))
                                                     , (pair.at(1).toLower() == truearray)));
            }
        }

        foreach (dtkLoggingCategory *category, _registeredCategories) {
            updateCategory(category);
        }

        _registerCategories = true;
    }
开发者ID:papadop,项目名称:dtk,代码行数:29,代码来源:dtkLogger.cpp

示例8: xmlWrite

QByteArray Variant::toUtf8() const
{
  QDomDocument doc;
  xmlWrite(doc, doc);
  QByteArray result = doc.toByteArray(0);
  return result.simplified();
}
开发者ID:ruphy,项目名称:speedcrunch,代码行数:7,代码来源:variant.cpp

示例9: runComparison

//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
bool RiaImageFileCompare::runComparison(QString imgFileName, QString refFileName, QString diffFileName)
{
    reset();

    if (m_compareExecutable.isEmpty())
    {
        m_lastError = SEVERE_ERROR;
        m_errorMsg = "Cannot compare images, no compare executable set";
        return false;
    }


    //QString args = QString("-fuzz 2% -lowlight-color white -metric ae \"%1\" \"%2\" \"%3\"").arg(imgFileName).arg(refFileName).arg((diffFileName));
    // The ImageMagick compare tool on RedHat 5 does not support the lowlight-color options
    // Use GCC version as a crude mechanism for disabling use of this option on RedHat5
#if (__GNUC__ == 4 && __GNUC_MINOR__ <= 1)
    QString args = QString("-fuzz 0.4% -metric ae \"%1\" \"%2\" \"%3\"").arg(imgFileName).arg(refFileName).arg((diffFileName));
#else
    QString args = QString("-fuzz 0.4% -lowlight-color white -metric ae \"%1\" \"%2\" \"%3\"").arg(imgFileName).arg(refFileName).arg((diffFileName));
#endif
    QString completeCommand = QString("\"%1\" %2").arg(m_compareExecutable).arg(args);

    // Launch process and wait
    QProcess proc;
    proc.start(completeCommand);
    proc.waitForFinished(30000);

    QProcess::ProcessError procError = proc.error();
    if (procError != QProcess::UnknownError)
    {
        m_lastError = SEVERE_ERROR;
        m_errorMsg = "Error running compare tool process";
        m_errorDetails = completeCommand;
        return false;
    }

    QByteArray stdErr = proc.readAllStandardError();
    int procExitCode = proc.exitCode();
    if (procExitCode == 0)
    {
        // Strip out whitespace and look for 0 (as in zero pixel differences)
        stdErr = stdErr.simplified();
        if (!stdErr.isEmpty() && stdErr[0] == '0')
        {
            m_imagesEqual = true;
        }

        return true;
    }
    else
    {
        // Report non-severe error
        m_lastError = IC_ERROR;
        m_errorMsg = "Error running compare tool process";
        m_errorDetails = stdErr;

        return false;
    }
}
开发者ID:OPM,项目名称:ResInsight,代码行数:62,代码来源:RiaImageFileCompare.cpp

示例10: fileInfo

void
M3uLoader::parseM3u( const QString& fileLink )
{
    QFileInfo fileInfo( fileLink );
    QFile file( QUrl::fromUserInput( fileLink ).toLocalFile() );

    if ( !file.open( QIODevice::ReadOnly | QIODevice::Text ) )
    {
        tDebug() << "Error opening m3u:" << file.errorString();
        return;
    }

    m_title = fileInfo.baseName();
    while ( !file.atEnd() )
    {
         QByteArray line = file.readLine();
         /// If anyone wants to take on the regex for parsing EXT, go ahead
         /// But the notion that users does not tag by a common rule. that seems hard
         /// So ignore that for now
         if ( line.contains( "EXT" ) )
             continue;

         QFileInfo tmpFile( QUrl::fromUserInput( QString( line.simplified() ) ).toLocalFile() );

         if( tmpFile.exists() )
             getTags( tmpFile );
         else
         {
             QUrl fileUrl = QUrl::fromUserInput( QString( QFileInfo(file).canonicalPath() + "/" + line.simplified() ) );
             QFileInfo tmpFile( fileUrl.toLocalFile() );
             if ( tmpFile.exists() )
                getTags( tmpFile );
         }
    }

    if ( m_tracks.isEmpty() )
    {
        tDebug() << Q_FUNC_INFO << "Could not parse M3U!";
        return;
    }

    if ( m_createNewPlaylist )
    {
        m_playlist = Playlist::create( SourceList::instance()->getLocal(),
                                       uuid(),
                                       m_title,
                                       m_info,
                                       m_creator,
                                       false,
                                       m_tracks );

        connect( m_playlist.data(), SIGNAL( revisionLoaded( Tomahawk::PlaylistRevision ) ), this, SLOT( playlistCreated() ) );
    }
    else
        emit tracks( m_tracks );

    m_tracks.clear();
}
开发者ID:demelziraptor,项目名称:tomahawk,代码行数:58,代码来源:M3uLoader.cpp

示例11: runComparison

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaTextFileCompare::runComparison(const QString& baseFolder, const QString& generatedFolder)
{
    reset();

    QString fullFilePath = "diff";
    if (!m_pathToDiffTool.isEmpty())
    {
        fullFilePath = m_pathToDiffTool + "/" + fullFilePath;
    }

    // Command line arguments used when invoking 'diff'
    // See https://docs.freebsd.org/info/diff/diff.info.diff_Options.html
    QString args = "-r -u --strip-trailing-cr";

    QString completeCommand = QString("\"%1\" %2 %3 %4").arg(fullFilePath).arg(baseFolder).arg(generatedFolder).arg(args);

    // Launch process and wait
    QProcess proc;
    proc.start(completeCommand);
    proc.waitForFinished(30000);

    QProcess::ProcessError procError = proc.error();
    if (procError != QProcess::UnknownError)
    {
        m_lastError    = SEVERE_ERROR;
        m_errorMsg     = "Error running 'diff' tool process";
        m_errorDetails = completeCommand;
        return false;
    }

    QByteArray stdErr       = proc.readAllStandardError();
    int        procExitCode = proc.exitCode();

    if (procExitCode == 0)
    {
        return true;
    }
    else if (procExitCode == 1)
    {
        QByteArray stdOut = proc.readAllStandardOutput();
        m_diffOutput      = stdOut;

        return false;
    }
    else
    {
        stdErr = stdErr.simplified();

        // Report non-severe error
        m_lastError    = IC_ERROR;
        m_errorMsg     = "Error running 'diff' tool process";
        m_errorDetails = stdErr;

        return false;
    }
}
开发者ID:OPM,项目名称:ResInsight,代码行数:59,代码来源:RiaTextFileCompare.cpp

示例12: CheckingReceivedPacket

/*Checksum of the received packet*/
ANWR_PROTOCOL::RETURN_ANSWER ftdiChip::CheckingReceivedPacket(const QByteArray &bS)
{
if(bS.isEmpty())return ANWR_PROTOCOL::retNoAnsError;
QByteArray cmd = bS.simplified();
if(cmd.contains("#")){
    if(cmd[1]=='>')return ANWR_PROTOCOL::retOK;
    if(cmd[1]=='?')return ANWR_PROTOCOL::retIncorData;
    }
return ANWR_PROTOCOL::retError;
}
开发者ID:tuzhikov,项目名称:testCountDown,代码行数:11,代码来源:ftdichip.cpp

示例13: populateAfterRegInfo

int populateAfterRegInfo(QTextStream& t) 
{
	t << endl << endl;
	t << "RESOURCE SERVICE_CONFIGURATION_ARRAY r_service_configuration_reg" << endl;
	t << "\t{" << endl;
	t << "\t\tservice_configuration_array=" << endl;
	t << "\t\t\t{" << endl;

    QFile cf(configurationFile);	

	int err = 0;
	
	QByteArray escapedQuotationMark = QByteArray("\\\"");
	
	if (cf.open(QIODevice::ReadOnly | QIODevice::Text)) {
		QByteArray xmlConf;

		xmlConf = cf.readAll();
		xmlConf = xmlConf.replace("\"","\\\"");
		if (xmlConf.count()) {
			QByteArray xml = xmlConf.simplified();
			for (int n=0;;n++) {
				int splitCount = 255;
				if (xml.size() > 255 && (xml.mid(254, 2) == escapedQuotationMark)) {
					splitCount = 254;
				}
				QByteArray split = xml.left(splitCount);
				if (!split.count()) {
					break;
				}
				if (n) {
					t << "\t\t\t\t,"  << endl;
				}
				t << "\t\t\t\tSERVICE_CONFIGURATION"  << endl;
				t << "\t\t\t\t{" <<  endl;
				t << "\t\t\t\txmldata = \"" << split <<"\";" <<  endl;
				t << "\t\t\t\t}" <<  endl;

				xml = xml.mid(splitCount);
			}
		}	
	} else {
		fprintf(stderr, "Error: Cannot open %s file for reading.", qPrintable(configurationFile));
		err = 1;
	}
	
	t << endl;
	t << "\t\t\t};" << endl;
	t << "\t}" << endl;
	
	return err;
}
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:52,代码来源:main.cpp

示例14: forceStop

void AndroidRunnerWorkerBase::forceStop()
{
    runAdb({"shell", "am", "force-stop", m_androidRunnable.packageName}, 30);

    // try killing it via kill -9
    const QByteArray out = Utils::SynchronousProcess()
            .runBlocking(m_adb, selector() << QStringLiteral("shell") << pidScriptPreNougat)
            .allRawOutput();

    qint64 pid = extractPID(out.simplified(), m_androidRunnable.packageName);
    if (pid != -1) {
        adbKill(pid);
    }
}
开发者ID:choenig,项目名称:qt-creator,代码行数:14,代码来源:androidrunnerworker.cpp

示例15:

MainWindow::MainWindow(QWidget *parent) :
	QMainWindow(parent),
	ui(new Ui::MainWindow)
{
	ui->setupUi(this);

	QByteArray test;

	test.append(49);
	test.append(46);
	test.append(49);
	test.append(56);
	test.append(48);
	test.append(48);
	test.append('\n');
	test.append((char)0);
	test.append(char(0));
	test.append(char(0));
	test.append(char(0));
	test.append(char(0));


	qDebug("org [%s], size %d", test.constData(), test.size());

	QByteArray test3 = test.simplified();

	qDebug("simplified [%s] size %d", test3.constData(), test3.size());


	QByteArray test4 = test.trimmed();

	qDebug("trimmed [%s] size %d", test4.constData(), test4.size());

	float val = test3.toFloat();

	qDebug("value = %f", val);

	if ( test.contains('\n'))

	{
		QByteArray test2 = test.left( test.indexOf('\n'));



		qDebug("%d test2 [%s]", test.indexOf(char(0)), test2.constData());
	}

}
开发者ID:cero2k6,项目名称:qt,代码行数:48,代码来源:mainwindow.cpp


注:本文中的QByteArray::simplified方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。