コード例 #1
0
ファイル: data.cpp プロジェクト: aijagluk/optasm
QString GData::sourceCode(void){    
    QRegExp rxp("^\\s*(\\d*|\".*\"|\\'.*\\'|[a-zA-Z_\\[\\?\\$]+[\\[\\]\\-\\+\\/\\*\\$0-9a-zA-Z_\\s]*)\\s*$");

    for(int i = 0; i < m_pcbValues->count(); ++i){
        if(!(m_pcbValues->itemText(i).contains(rxp))){
            return(";кажется, транслятор треснул...\n;выражение провалило валидацию!");
        }
    }


    QString str;
    str.append(m_strDataName);
    str.append(" ");
    str.append(m_strDataType);
    str.append(" ");

    if(m_pstrlstValues->count() == 1){
        str.append(m_pstrlstValues->at(0));
    }
    else{
        for(int i = 0; i < m_pstrlstValues->count(); ++i){
            str.append(m_pstrlstValues->at(i));
            if(i != m_pstrlstValues->count() - 1){
                str.append(", ");
            }
        }
    }

    return(str);
}
コード例 #2
0
ファイル: http_ua.cpp プロジェクト: c3d/tao-3D
HttpUserAgent::HttpUserAgent()
// ----------------------------------------------------------------------------
//    Constructor
// ----------------------------------------------------------------------------
{
#ifdef TAO_PLAYER
    edition = "player";
#else
    edition = "unified";
#endif

#if defined(Q_OS_MACX)
   target = "MacOSX";
#elif defined(Q_OS_WIN)
   target = "Windows";
#else
   // Check if we are on Debian or Ubuntu distribution to get .deb package
   QString cmd("uname");
   QStringList args;
   args << "-a";
   Process cp(cmd, args);
   text errors, output;
   if(cp.done(&errors, &output))
   {
       // Check OS name
       if(output.find("Ubuntu") != output.npos ||
          output.find("Debian") != output.npos)
           target = "Linux .deb";
       else
           target = "Linux .tar.bz2";

       // Check architecture
       if(output.find("x86_64") != output.npos)
           target += " x86_64";
       else
           target += " x86";
   }
#endif

   // Get current version of Tao
   QString ver = GITREV_;
   QRegExp rxp("([0-9\\.]+)");
   rxp.indexIn(ver);
   version = rxp.cap(1).toDouble();
}
コード例 #3
0
ファイル: mmfexporter.cpp プロジェクト: eliovir/krecipes
QStringList MMFExporter::wrapText( const QString& str, int at ) const
{
	QStringList ret;
	QString copy( str );
	bool stop = false;
	while ( !stop ) {
		QString line( copy.left( at ) );
		if ( line.length() >= copy.length() )
			stop = true;
		else {
			QRegExp rxp( "(\\s\\S*)$", Qt::CaseInsensitive ); // last word in the new line
			rxp.setMinimal( true );    // one word, only one word, please
			line = line.remove( rxp ); // remove last word
		}
		copy = copy.remove( 0, line.length() );
		line = line.trimmed();
		line.prepend( ' ' );       // indent line by one char
		ret << line; // output of current line
	}

	return ret;
}