• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ QRegExp函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中QRegExp函数的典型用法代码示例。如果您正苦于以下问题:C++ QRegExp函数的具体用法?C++ QRegExp怎么用?C++ QRegExp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: env

QStringList djvSystem::searchPath()
{
    //DJV_DEBUG("djvSystem::searchPath");

    QStringList out;

    // Add paths from environment variables.

    QString path = env(djvPathEnv());

    if (! path.isEmpty())
    {
        //DJV_DEBUG_PRINT("DJV_PATH = " << path);

        QString match;
        Q_FOREACH(QChar c, djvFileInfoUtil::listSeparators)
            match += c;
        
        out += path.split(
            QRegExp(QString("[%1]+").arg(match)),
            QString::SkipEmptyParts);
    }

    path = env(ldLibPathEnv());

    if (! path.isEmpty())
    {
        //DJV_DEBUG_PRINT("LD_LIBRARY_PATH = " << path);

        QString match;
        Q_FOREACH(QChar c, djvFileInfoUtil::listSeparators)
            match += c;
        
        //DJV_DEBUG_PRINT("match = " << match);

        out += path.split(
            QRegExp(QString("[%1]+").arg(match)),
            QString::SkipEmptyParts);
    }

    // Add the application path.
    
    //DJV_DEBUG_PRINT("qApp = " << qApp);
        
    const QString applicationPath = qApp->applicationDirPath();

    //DJV_DEBUG_PRINT("application path = " << applicationPath);

    out += applicationPath;
    
    // Add library and translation paths.

    out += QDir(applicationPath + "/../lib").absolutePath();
    out += QDir(applicationPath + "/../translations").absolutePath();

#if defined(DJV_WINDOWS) || defined(DJV_OSX)

    const QString dirName = QDir(qApp->applicationDirPath()).dirName();

    out += QDir(applicationPath + "/../../lib/" + dirName).absolutePath();
    out += QDir(applicationPath + "/../../translations/" + dirName).absolutePath();

#endif

    // Add the build directories.
    
    out += QDir("lib/djvCore").absolutePath();
    out += QDir("lib/djvGui").absolutePath();
    out += QDir("lib/djvViewLib").absolutePath();
    out += QDir("bin/djv_ls").absolutePath();
    out += QDir("bin/djv_info").absolutePath();
    out += QDir("bin/djv_convert").absolutePath();

    // Add the current directory.

    out += ".";

    //DJV_DEBUG_PRINT("out = " << out);

    QSet<QString> set;

    for (int i = 0; i < out.count(); ++i)
        set.insert(out[i]);

    QList<QString> list = set.toList();

    out.clear();
    Q_FOREACH(const QString & s, list)
        out += s;

    return out;
}
开发者ID:mottosso,项目名称:djv,代码行数:92,代码来源:djvSystem.cpp


示例2: QRegExp

void QgsWFSServer::startGetFeature( QgsRequestHandler& request, const QString& format, QgsCoordinateReferenceSystem& crs, QgsRectangle* rect )
{
  QByteArray result;
  QString fcString;
  if ( format == "GeoJSON" )
  {
    fcString = "{\"type\": \"FeatureCollection\",\n";
    fcString += " \"bbox\": [ " + QString::number( rect->xMinimum(), 'f', 6 ).remove( QRegExp( "[0]{1,5}$" ) ) + ", " + QString::number( rect->yMinimum(), 'f', 6 ).remove( QRegExp( "[0]{1,5}$" ) ) + ", " + QString::number( rect->xMaximum(), 'f', 6 ).remove( QRegExp( "[0]{1,5}$" ) ) + ", " + QString::number( rect->yMaximum(), 'f', 6 ).remove( QRegExp( "[0]{1,5}$" ) ) + "],\n";
    fcString += " \"features\": [\n";
    result = fcString.toUtf8();
    request.startGetFeatureResponse( &result, format );
  }
  else
  {
    //Prepare url
    //Some client requests already have http://<SERVER_NAME> in the REQUEST_URI variable
    QString hrefString;
    QString requestUrl = getenv( "REQUEST_URI" );
    QUrl mapUrl( requestUrl );
    mapUrl.setHost( QString( getenv( "SERVER_NAME" ) ) );

    //Add non-default ports to url
    QString portString = getenv( "SERVER_PORT" );
    if ( !portString.isEmpty() )
    {
      bool portOk;
      int portNumber = portString.toInt( &portOk );
      if ( portOk )
      {
        if ( portNumber != 80 )
        {
          mapUrl.setPort( portNumber );
        }
      }
    }

    if ( QString( getenv( "HTTPS" ) ).compare( "on", Qt::CaseInsensitive ) == 0 )
    {
      mapUrl.setScheme( "https" );
    }
    else
    {
      mapUrl.setScheme( "http" );
    }

    QList<QPair<QString, QString> > queryItems = mapUrl.queryItems();
    QList<QPair<QString, QString> >::const_iterator queryIt = queryItems.constBegin();
    for ( ; queryIt != queryItems.constEnd(); ++queryIt )
    {
      if ( queryIt->first.compare( "REQUEST", Qt::CaseInsensitive ) == 0 )
      {
        mapUrl.removeQueryItem( queryIt->first );
        mapUrl.addQueryItem( queryIt->first, "DescribeFeatureType" );
      }
      else if ( queryIt->first.compare( "FORMAT", Qt::CaseInsensitive ) == 0 )
      {
        mapUrl.removeQueryItem( queryIt->first );
      }
      else if ( queryIt->first.compare( "OUTPUTFORMAT", Qt::CaseInsensitive ) == 0 )
      {
        mapUrl.removeQueryItem( queryIt->first );
      }
      else if ( queryIt->first.compare( "BBOX", Qt::CaseInsensitive ) == 0 )
      {
        mapUrl.removeQueryItem( queryIt->first );
      }
      else if ( queryIt->first.compare( "FEATUREID", Qt::CaseInsensitive ) == 0 )
      {
        mapUrl.removeQueryItem( queryIt->first );
      }
      else if ( queryIt->first.compare( "FILTER", Qt::CaseInsensitive ) == 0 )
      {
        mapUrl.removeQueryItem( queryIt->first );
      }
      else if ( queryIt->first.compare( "MAXFEATURES", Qt::CaseInsensitive ) == 0 )
      {
        mapUrl.removeQueryItem( queryIt->first );
      }
      else if ( queryIt->first.compare( "PROPERTYNAME", Qt::CaseInsensitive ) == 0 )
      {
        mapUrl.removeQueryItem( queryIt->first );
      }
      else if ( queryIt->first.compare( "_DC", Qt::CaseInsensitive ) == 0 )
      {
        mapUrl.removeQueryItem( queryIt->first );
      }
    }
    mapUrl.addQueryItem( "OUTPUTFORMAT", "XMLSCHEMA" );
    hrefString = mapUrl.toString();

    //wfs:FeatureCollection
    fcString = "<wfs:FeatureCollection";
    fcString += " xmlns:wfs=\"http://www.opengis.net/wfs\"";
    fcString += " xmlns:ogc=\"http://www.opengis.net/ogc\"";
    fcString += " xmlns:gml=\"http://www.opengis.net/gml\"";
    fcString += " xmlns:ows=\"http://www.opengis.net/ows\"";
    fcString += " xmlns:xlink=\"http://www.w3.org/1999/xlink\"";
    fcString += " xmlns:qgs=\"http://www.qgis.org/gml\"";
    fcString += " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"";
    fcString += " xsi:schemaLocation=\"http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/wfs.xsd http://www.qgis.org/gml " + hrefString.replace( "&", "&amp;" ) + "\"";
//.........这里部分代码省略.........
开发者ID:mola,项目名称:Quantum-GIS,代码行数:101,代码来源:qgswfsserver.cpp


示例3: update

/**
  * Обнавляет модель монитора в соответствии с установленными
  * параметрами фильтрации.
  */
void Monitor::update()
{
    monitor_model_proxy->setFilterRegExp(QRegExp(""));
}
开发者ID:bsv,项目名称:r245,代码行数:8,代码来源:monitor.cpp


示例4: tr

void TableDialog::apply()
{
	if (colName->text().contains("_")){
		QMessageBox::warning(this, tr("QtiPlot - Warning"),
		tr("For internal consistency reasons the underscore character is replaced with a minus sign."));
	}

	QString name = colName->text().replace("-", "_").remove(QRegExp("\n"));

	int sc = d_table->selectedColumn();
	d_table->setColumnWidth(colWidth->value(), applyToAllBox->isChecked());
	d_table->setColComment(sc, comments->text().replace("\n", " ").replace("\t", " "));
	d_table->setColName(sc, name.replace("_", "-"), enumerateAllBox->isChecked());

	bool rightColumns = applyToRightCols->isChecked();
	int format = formatBox->currentIndex();
	int colType = displayBox->currentIndex();
	switch(colType){
		case 0:
			setNumericFormat(formatBox->currentIndex(), precisionBox->value(), rightColumns);
		break;

		case 1:
			setTextFormat(rightColumns);
		break;

		case 2:
			 setDateTimeFormat(colType, formatBox->currentText(), rightColumns);
		break;

		case 3:
			setDateTimeFormat(colType, formatBox->currentText(), rightColumns);
		break;

		case 4:
			if(format == 0)
				setMonthFormat("MMM", rightColumns);
			else if(format == 1)
				setMonthFormat("MMMM", rightColumns);
			else if(format == 2)
				setMonthFormat("M", rightColumns);
		break;

		case 5:
			if(format == 0)
				setDayFormat("ddd", rightColumns);
			else if(format == 1)
				setDayFormat("dddd", rightColumns);
			else if(format == 2)
				setDayFormat("d", rightColumns);
		break;
	}

	if (rightColumns){
		bool readOnly = boxReadOnly->isChecked();
		for (int i = sc; i<d_table->numCols(); i++){
			d_table->setReadOnlyColumn(i, readOnly);
			d_table->hideColumn(i, boxHideColumn->isChecked());
		}
	} else {
		d_table->setReadOnlyColumn(sc, boxReadOnly->isChecked());
		d_table->hideColumn(sc, boxHideColumn->isChecked());
	}
}
开发者ID:BackupTheBerlios,项目名称:qtiplot-svn,代码行数:64,代码来源:TableDialog.cpp


示例5: versionIsAtLeast320

static bool versionIsAtLeast320(const QString &version)
{
    return QRegExp("\\d.\\d\\.\\d").exactMatch(version)
            && (version[0] > '3' || (version[0] == '3' && version[2] >= '2'));
}
开发者ID:AtlantisCD9,项目名称:Qt,代码行数:5,代码来源:adpreader.cpp


示例6: if

QString Serveur::parseCommande(QString comm,bool serveur)
{
    if(comm.startsWith("/"))
    {
        comm.remove(0,1);
        QString pref=comm.split(" ").first();
        QStringList args=comm.split(" ");
        args.removeFirst();
        QString destChan=tab->tabText(tab->currentIndex());
        QString msg=args.join(" ");

        if(pref=="me")
            return "PRIVMSG "+destChan+" ACTION " + msg + "";
        else if(pref=="msg")
            return "MSG "+destChan+" ACTION " + msg + "";
        else if(pref=="join")
        {
            join(msg);
            return " ";
        }
        else if(pref=="quit")
        {
            if(msg == "")
                return "QUIT "+msgQuit;
            else
                return "QUIT "+msg;
        }
        else if(pref=="part")
        {
            tab->removeTab(tab->currentIndex());

            if(msg == "")
            {
                if(msg.startsWith("#"))
                    destChan=msg.split(" ").first();

                if(msgQuit=="")
                    return "PART "+destChan+" using IrcLightClient";
                else
                    return "PART "+destChan+" "+msgQuit;
            }
            else
                return "PART "+destChan+" "+msg;

            conversations.remove(destChan);
        }
        else if(pref=="kick")
        {
            QStringList tableau=msg.split(" ");
            QString c1,c2,c3;
            if(tableau.count() > 0) c1=" "+tableau.first();
            else c1="";
            if(tableau.count() > 1) c2=" "+tableau.at(1);
            else c2="";
            if(tableau.count() > 2) c3=" "+tableau.at(2);
            else c3="";

            if(c1.startsWith("#"))
                return "KICK"+c1+c2+c3;
            else
                return "KICK "+destChan+c1+c2;
        }
        else if(pref=="update")
        {
            updateUsers=true;
            return "WHO "+destChan;
        }
        else if(pref=="ns")
        {
            return "NICKSERV "+msg;
        }
        else if(pref=="nick")
        {
            emit pseudoChanged(msg);
                        ecrire("-> Nickname changed to "+msg);
            return "NICK "+msg;
        }
        else if(pref=="msg")
        {
            return "MSG "+msg;
        }

        else
            return pref+" "+msg;
    }
    else if(!serveur)
	{
        QString destChan=tab->tabText(tab->currentIndex());
                if(comm.endsWith("<br />"))
                    comm=comm.remove(QRegExp("<br />$"));
                ecrire("<b>&lt;"+pseudo+"&gt;</b> "+comm,destChan);

        if(comm.startsWith(":"))
            comm.insert(0,":");

        return "PRIVMSG "+destChan+" "+comm.replace(" ","\t");
    }
	else
	{
		return "";
//.........这里部分代码省略.........
开发者ID:Danz0r77,项目名称:OpalCoin,代码行数:101,代码来源:serveur.cpp


示例7: parseStmtUsing


//.........这里部分代码省略.........
        QString ppdKeyword = advance();
        uDebug() << "found preprocessor directive " << ppdKeyword;
        //:TODO: anything to do here?
        return true;
    }

//     if (keyword == "@") {   // annotation
//         advance();
//         if (m_source[m_srcIndex + 1] == "(") {
//             advance();
//             skipToClosing('(');
//         }
//         return true;
//     }

    if (keyword == "[") {   // ...
        advance();
        skipToClosing('[');
        return true;
    }

    if (keyword == "}") {
        if (m_scopeIndex)
            m_klass = dynamic_cast<UMLClassifier*>(m_scope[--m_scopeIndex]);
        else
            uError() << "too many }";
        return true;
    }

    // At this point, we expect `keyword' to be a type name
    // (of a member of class or interface, or return type
    // of an operation.) Up next is the name of the attribute
    // or operation.
    if (! keyword.contains(QRegExp("^\\w"))) {
        uError() << "ignoring " << keyword <<
                 " at " << m_srcIndex << ", " << m_source.count() << " in " << m_klass;  //:TODO: ->name();
        return false;
    }

    QString typeName = m_source[m_srcIndex];
    typeName = joinTypename(typeName);
    // At this point we need a class.
    if (m_klass == NULL) {
        uError() << "no class set for " << typeName;
        return false;
    }
    QString name = advance();
    QString nextToken;
    if (typeName == m_klass->name() && name == "(") {
        // Constructor.
        nextToken = name;
        name = typeName;
        typeName.clear();
    } else {
        nextToken = advance();
    }
    if (name.contains(QRegExp("\\W"))) {
        uError() << "expecting name in " << name;
        return false;
    }
    if (nextToken == "(") {
        // operation
        UMLOperation *op = Import_Utils::makeOperation(m_klass, name);
        m_srcIndex++;
        while (m_srcIndex < srcLength && m_source[m_srcIndex] != ")") {
            QString typeName = m_source[m_srcIndex];
开发者ID:ShermanHuang,项目名称:kdesdk,代码行数:67,代码来源:csharpimport.cpp


示例8: getElementName

void XMLSchemaWriter::writeAssociationRoleDecl( UMLClassifier *c, const QString &multi, QTextStream &XMLschema)
{

    bool isAbstract = c->getAbstract();
    bool isInterface = c->isInterface();

    QString elementName = getElementName(c);
    QString doc = c->getDoc();

    if (!doc.isEmpty())
        writeComment(doc, XMLschema);


    // Min/Max Occurs is based on whether it is this a single element
    // or a List (maxoccurs>1). One day this will be done correctly with special
    // multiplicity object that we don't have to figure out what it means via regex.
    QString minOccurs = "0";
    QString maxOccurs = "unbounded";
    if (multi.isEmpty())
    {
        // in this case, association will only specify ONE element can exist
        // as a child
        minOccurs = "1";
        maxOccurs = "1";
    }
    else
    {
        QStringList values = QStringList::split( QRegExp("[^\\d{1,}|\\*]"), multi);

        // could use some improvement here.. for sequences like "0..1,3..5,10" we
        // don't capture the whole "richness" of the multi. Instead we translate it
        // now to minOccurs="0" maxOccurs="10"
        if (values.count() > 0)
        {
            // populate both with the actual value as long as our value isnt an asterix
            // In that case, use special value (from above)
            if(values[0].contains(QRegExp("\\d{1,}")))
                minOccurs = values[0]; // use first number in sequence

            if(values[values.count()-1].contains(QRegExp("\\d{1,}")))
                maxOccurs = values[values.count()-1]; // use only last number in sequence
        }
    }

    // Now declare the class in the association as an element or group.
    //
    // In a semi-arbitrary way, we have decided to make abstract classes into
    // "groups" and concrete classes into "complexTypes".
    //
    // This is because about the only thing you can do with an abstract
    // class (err. node) is inherit from it with a "concrete" element. Therefore,
    // in this manner, we need a group node for abstract classes to lay out the child
    // element choices so that the child, concrete class may be plugged into whatever spot
    // it parent could go. The tradeoff is that "group" nodes may not be extended, so the
    // choices that you lay out here are it (e.g. no more nodes may inherit" from this group)
    //
    // The flipside for concrete classes is that we want to use them as elements in our document.
    // Unfortunately, about all you can do with complexTypes in terms of inheritance, is to
    // use these as the basis for a new node type. This is NOT full inheritence because the new
    // class (err. element node) wont be able to go into the document where it parent went without
    // you heavily editing the schema.
    //
    // Therefore, IF a group is abstract, but has no inheriting sub-classes, there are no choices, and its nigh
    // on pointless to declare it as a group, in this special case, abstract classes get declared
    // as complexTypes.
    //
    // Of course, in OO methodology, you should be able to inherit from
    // any class, but schema just don't allow use to have full inheritence using either groups
    // or complexTypes. Thus we have taken a middle rode. If someone wants to key me into a
    // better way to represent this, I'd be happy to listen. =b.t.
    //
    // UPDATE: partial solution to the above: as of 13-Mar-2003 we now write BOTH a complexType
    //         AND a group declaration for interfaces AND classes which are inherited from.
    //
    if ((isAbstract || isInterface ) && c->findSubClassConcepts().count() > 0)
        XMLschema<<getIndent()<<"<"<<makeSchemaTag("group")
        <<" ref=\""<<makePackageTag(getElementGroupTypeName(c))<<"\"";
    else
        XMLschema<<getIndent()<<"<"<<makeSchemaTag("element")
        <<" name=\""<<getElementName(c)<<"\""
        <<" type=\""<<makePackageTag(getElementTypeName(c))<<"\"";

    // min/max occurs
    if (minOccurs != "1")
        XMLschema<<" minOccurs=\""<<minOccurs<<"\"";

    if (maxOccurs != "1")
        XMLschema<<" maxOccurs=\""<<maxOccurs<<"\"";

    // tidy up the node
    XMLschema<<"/>"<<m_endl;

}
开发者ID:serghei,项目名称:kde-kdesdk,代码行数:93,代码来源:xmlschemawriter.cpp


示例9: advance

/**
 * Parsing the statement 'class' or 'interface'.
 * @return   success status of parsing
 */
bool CSharpImport::parseStmtClass(const QString& keyword)
{
    const QString& name = advance();
    const UMLObject::ObjectType t = (keyword == "class" ? UMLObject::ot_Class : UMLObject::ot_Interface);
    log(keyword + ' ' + name);
    UMLObject *ns = Import_Utils::createUMLObject(t, name, m_scope[m_scopeIndex], m_comment);
    m_scope[++m_scopeIndex] = m_klass = static_cast<UMLClassifier*>(ns);
    m_klass->setAbstract(m_isAbstract);
    m_klass->setStatic(m_isStatic);
    m_klass->setVisibility(m_currentAccess);
    // The UMLObject found by createUMLObject might originally have been created as a
    // placeholder with a type of class but if is really an interface, then we need to
    // change it.
    UMLObject::ObjectType ot = (keyword == "interface" ? UMLObject::ot_Interface : UMLObject::ot_Class);
    m_klass->setBaseType(ot);
    m_isAbstract = m_isStatic = false;
    // if no modifier is specified in an interface, then it means public
    if (m_klass->isInterface()) {
        m_defaultCurrentAccess =  Uml::Visibility::Public;
    }

    if (advance() == ";")    // forward declaration
        return true;

    if (m_source[m_srcIndex] == "<") {
        // template args - preliminary, rudimentary implementation
        // @todo implement all template arg syntax
        uint start = m_srcIndex;
        if (! skipToClosing('<')) {
            uError() << "import C# (" << name << "): template syntax error";
            return false;
        }
        while(1) {
            const QString arg = m_source[++start];
            if (! arg.contains(QRegExp("^[A-Za-z_]"))) {
                uDebug() << "import C# (" << name << "): cannot handle template syntax ("
                            << arg << ")";
                break;
            }
            /* UMLTemplate *tmpl = */ m_klass->addTemplate(arg);
            const QString next = m_source[++start];
            if (next == ">")
                break;
            if (next != ",") {
                uDebug() << "import C# (" << name << "): cannot handle template syntax ("
                            << next << ")";
                break;
            }
        }
        advance();  // skip over ">"
    }

    if (m_source[m_srcIndex] == ":") {   // derivation
        while (m_srcIndex < m_source.count() - 1 && advance() != "{") {
            const QString& baseName = m_source[m_srcIndex];
            // try to resolve the interface we are implementing, if this fails
            // create a placeholder
            UMLObject *interface = resolveClass(baseName);
            if (interface) {
                Import_Utils::createGeneralization(m_klass, static_cast<UMLClassifier*>(interface));
            } else {
                uDebug() << "implementing interface " << baseName
                            << " is not resolvable. Creating placeholder";
                Import_Utils::createGeneralization(m_klass, baseName);
            }
            if (advance() != ",")
                break;
        }
    }

    if (m_source[m_srcIndex] != "{") {
        uError() << "ignoring excess chars at " << name
                    << " (" << m_source[m_srcIndex] << ")";
        skipStmt("{");
    }
    return true;
}
开发者ID:ShermanHuang,项目名称:kdesdk,代码行数:81,代码来源:csharpimport.cpp


示例10: kDebug

// main method for invoking..
void XMLSchemaWriter::writeClass(UMLClassifier *c)
{

    if (!c) {
        kDebug()<<"Cannot write class of NULL classifier!\n";
        return;
    }

    // find an appropriate name for our file
    QString fileName = findFileName(c,".xsd");

    if (fileName.isEmpty()) {
        emit codeGenerated(c, false);
        return;
    }

    // check that we may open that file for writing
    QFile file;
    if ( !openFile(file, fileName) ) {
        emit codeGenerated(c, false);
        return;
    }

    QTextStream XMLschema(&file);

    // set package namespace tag appropriately
    if(!c->getPackage().isEmpty())
        packageNamespaceTag = c->getPackage();

    // START WRITING

    // 0. FIRST THING: open the xml processing instruction. This MUST be
    // the first thing in the file
    XMLschema<<"<?xml version=\"1.0\"?>"<<m_endl;

    // 1. create the header
    QString headerText = getHeadingFile(".xsd");
    if(!headerText.isEmpty()) {
        headerText.replace(QRegExp("%filename%"),fileName);
        headerText.replace(QRegExp("%filepath%"),file.name());
    }
    if(!headerText.isEmpty())
        XMLschema<<headerText<<m_endl;

    // 2. Open schema element node with appropriate namespace decl
    XMLschema<<"<"<<makeSchemaTag("schema");
    // common namespaces we know will be in the file..
    XMLschema<<" targetNamespace=\""<<packageNamespaceURI+packageNamespaceTag<<"\""<<m_endl;
    XMLschema<<" xmlns:"<<schemaNamespaceTag<<"=\""<<schemaNamespaceURI<<"\"";
    XMLschema<<" xmlns:"<<packageNamespaceTag<<"=\""<<packageNamespaceURI+packageNamespaceTag<<"\"";

    XMLschema<<">"<<m_endl; // close opening declaration

    m_indentLevel++;

    // 3? IMPORT statements -- do we need to do anything here? I suppose if
    // our document has more than one package, which is possible, we are missing
    // the correct import statements. Leave that for later at this time.
    /*
    //only import classes in a different package as this class
    UMLPackageList imports;
    findObjectsRelated(c,imports);
    for(UMLPackage *con = imports.first(); con ; con = imports.next())
        if(con->getPackage() != c->getPackage())
                XMLschema<<"import "<<con->getPackage()<<"."<<cleanName(con->getName())<<";"<<m_endl;
    */

    // 4. BODY of the schema.
    // start the writing by sending this classifier, the "root" for this particular
    // schema, to writeClassifier method, which will subsequently call itself on all
    // related classifiers and thus populate the schema.
    writeClassifier(c, XMLschema);

    // 5. What remains is to make the root node declaration
    XMLschema<<m_endl;
    writeElementDecl(getElementName(c), getElementTypeName(c), XMLschema);

    // 6. Finished: now we may close schema decl
    m_indentLevel--;
    XMLschema<<getIndent()<<"</"<<makeSchemaTag("schema")<<">"<<m_endl; // finished.. close schema node

    // bookeeping for code generation
    emit codeGenerated(c, true);

    // tidy up. no dangling open files please..
    file.close();

    // need to clear HERE, NOT in the destructor because we want each
    // schema that we write to have all related classes.
    writtenClassifiers.clear();
}
开发者ID:serghei,项目名称:kde-kdesdk,代码行数:92,代码来源:xmlschemawriter.cpp


示例11: QWidget

MainOptionsPage::MainOptionsPage(QWidget *parent):
        QWidget(parent)
{
    QVBoxLayout *layout = new QVBoxLayout();

    bitcoin_at_startup = new QCheckBox(tr("&Start Ponycoin on window system startup"));
    bitcoin_at_startup->setToolTip(tr("Automatically start Ponycoin after the computer is turned on"));
    layout->addWidget(bitcoin_at_startup);

#ifndef Q_WS_MAC
    minimize_to_tray = new QCheckBox(tr("&Minimize to the tray instead of the taskbar"));
    minimize_to_tray->setToolTip(tr("Show only a tray icon after minimizing the window"));
    layout->addWidget(minimize_to_tray);
#endif

    map_port_upnp = new QCheckBox(tr("Map port using &UPnP"));
    map_port_upnp->setToolTip(tr("Automatically open the Ponycoin client port on the router. This only works when your router supports UPnP and it is enabled."));
    layout->addWidget(map_port_upnp);

#ifndef Q_WS_MAC
    minimize_on_close = new QCheckBox(tr("M&inimize on close"));
    minimize_on_close->setToolTip(tr("Minimize instead of exit the application when the window is closed. When this option is enabled, the application will be closed only after selecting Quit in the menu."));
    layout->addWidget(minimize_on_close);
#endif

    connect_socks4 = new QCheckBox(tr("&Connect through SOCKS4 proxy:"));
    connect_socks4->setToolTip(tr("Connect to the Ponycoin network through a SOCKS4 proxy (e.g. when connecting through Tor)"));
    layout->addWidget(connect_socks4);

    QHBoxLayout *proxy_hbox = new QHBoxLayout();
    proxy_hbox->addSpacing(18);
    QLabel *proxy_ip_label = new QLabel(tr("Proxy &IP: "));
    proxy_hbox->addWidget(proxy_ip_label);
    proxy_ip = new QLineEdit();
    proxy_ip->setMaximumWidth(140);
    proxy_ip->setEnabled(false);
    proxy_ip->setValidator(new QRegExpValidator(QRegExp("[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}"), this));
    proxy_ip->setToolTip(tr("IP address of the proxy (e.g. 127.0.0.1)"));
    proxy_ip_label->setBuddy(proxy_ip);
    proxy_hbox->addWidget(proxy_ip);
    QLabel *proxy_port_label = new QLabel(tr("&Port: "));
    proxy_hbox->addWidget(proxy_port_label);
    proxy_port = new QLineEdit();
    proxy_port->setMaximumWidth(55);
    proxy_port->setValidator(new QIntValidator(0, 65535, this));
    proxy_port->setEnabled(false);
    proxy_port->setToolTip(tr("Port of the proxy (e.g. 1234)"));
    proxy_port_label->setBuddy(proxy_port);
    proxy_hbox->addWidget(proxy_port);
    proxy_hbox->addStretch(1);

    layout->addLayout(proxy_hbox);
    QLabel *fee_help = new QLabel(tr("Optional transaction fee per kB that helps make sure your transactions are processed quickly.  Most transactions are 1 kB.  Fee 0.01 recommended."));
    fee_help->setWordWrap(true);
    layout->addWidget(fee_help);

    QHBoxLayout *fee_hbox = new QHBoxLayout();
    fee_hbox->addSpacing(18);
    QLabel *fee_label = new QLabel(tr("Pay transaction &fee"));
    fee_hbox->addWidget(fee_label);
    fee_edit = new BitcoinAmountField();
    fee_edit->setToolTip(tr("Optional transaction fee per kB that helps make sure your transactions are processed quickly. Most transactions are 1 kB. Fee 0.01 recommended."));

    fee_label->setBuddy(fee_edit);
    fee_hbox->addWidget(fee_edit);
    fee_hbox->addStretch(1);

    layout->addLayout(fee_hbox);

    layout->addStretch(1); // Extra space at bottom

    setLayout(layout);

    connect(connect_socks4, SIGNAL(toggled(bool)), proxy_ip, SLOT(setEnabled(bool)));
    connect(connect_socks4, SIGNAL(toggled(bool)), proxy_port, SLOT(setEnabled(bool)));

#ifndef USE_UPNP
    map_port_upnp->setDisabled(true);
#endif
}
开发者ID:GeekBrony,项目名称:ponycoin-old,代码行数:80,代码来源:optionsdialog.cpp


示例12: Q_Q

    void SessionPrivate::processLine(const QByteArray& line)
    {
        Q_Q(Session);
        QString process = readString(line);
        QString prefix, command;
        QStringList params;

        // From RFC 1459:
        //  <message>  ::= [':' <prefix> <SPACE> ] <command> <params> <crlf>
        //  <prefix>   ::= <servername> | <nick> [ '!' <user> ] [ '@' <host> ]
        //  <command>  ::= <letter> { <letter> } | <number> <number> <number>
        //  <SPACE>    ::= ' ' { ' ' }
        //  <params>   ::= <SPACE> [ ':' <trailing> | <middle> <params> ]
        //  <middle>   ::= <Any *non-empty* sequence of octets not including SPACE
        //                 or NUL or CR or LF, the first of which may not be ':'>
        //  <trailing> ::= <Any, possibly *empty*, sequence of octets not including
        //                   NUL or CR or LF>

        // parse <prefix>
        if (process.startsWith(QLatin1Char(':')))
        {
            prefix = process.mid(1, process.indexOf(QLatin1Char(' ')) - 1);
            process.remove(0, prefix.length() + 2);

            if (options & Session::StripNicks)
            {
                int index = prefix.indexOf(QRegExp(QLatin1String("[@!]")));
                if (index != -1)
                    prefix.truncate(index);
            }
        }

        // parse <command>
        command = process.mid(0, process.indexOf(QLatin1Char(' ')));
        process.remove(0, command.length() + 1);
        bool isNumeric = false;
        uint code = command.toInt(&isNumeric);

        // parse middle/params
        while (!process.isEmpty())
        {
            if (process.startsWith(QLatin1Char(':')))
            {
                process.remove(0, 1);
                params << process;
                process.clear();
            }
            else
            {
                QString param = process.mid(0, process.indexOf(QLatin1Char(' ')));
                process.remove(0, param.length() + 1);
                params << param;
            }
        }

        // handle PING/PONG
        if (command == QLatin1String("PING"))
        {
            QString arg = params.value(0);
            q->raw(QString(QLatin1String("PONG %1")).arg(arg));
            return;
        }

        // and dump
        if (isNumeric)
        {
            switch (code)
            {
                case Irc::Rfc::RPL_WELCOME:
                {
                    Buffer* buffer = createBuffer(host);
                    buffer->d_func()->setReceiver(prefix);
                    break;
                }

                case Irc::Rfc::RPL_TOPIC:
                {
                    QString topic = params.value(1);
                    QString target = resolveTarget(QString(), topic);
                    Buffer* buffer = createBuffer(target);
                    buffer->d_func()->topic = topic;
                    break;
                }

                case Irc::Rfc::RPL_NAMREPLY:
                {
                    QStringList list = params;
                    list.removeAll(QLatin1String("="));
                    list.removeAll(QLatin1String("@"));
                    list.removeAll(QLatin1String("*"));

                    QString target = resolveTarget(QString(), list.value(1));
                    Buffer* buffer = createBuffer(target);
                    QStringList names = list.value(2).split(QLatin1String(" "), QString::SkipEmptyParts);
                    foreach (const QString& name, names)
                        buffer->d_func()->addName(name);
                    break;
                }

                case Irc::Rfc::RPL_MOTDSTART:
//.........这里部分代码省略.........
开发者ID:geekt,项目名称:quazaa,代码行数:101,代码来源:ircsession.cpp


示例13: QString

QString QgsDataItem::pathComponent( const QString &string )
{
  return QString( string ).replace( QRegExp( "[\\\\/]" ), "|" );
}
开发者ID:HeatherHillers,项目名称:QGIS,代码行数:4,代码来源:qgsdataitem.cpp


示例14: get_expr

QString get_expr(QString expr, QString &token, const QString &upto, QChar *ch)
{
    return get_expr(expr, token, QRegExp(upto), ch);
}
开发者ID:Maldela,项目名称:Macrodyn-Qt,代码行数:4,代码来源:get_expr.cpp


示例15: parseToMessage

/*
  Message type
"C2ACamion"
"0-02:06:18.040"
"EngSpeed 898,500 rpm"
"Accel    0,0 %"
"TCO      114,30 km/h MD:0  OS:0  DI:0  TP:0  HI:0  EV:0  D1:0/0/0 D2:0/0/0"
"Speed    114,30 km/h CC:0 BR:0 CS:0 PB:0"
"Distance 0,000 km"
"EngHours 1,90 h"
"FuelC    0,0 L"
"EngTemp  +61 degr"
"FuelLev  36,8 %"
"VehID    azerty"
"FMS      02.51 Diag:0 Requ:0"
"Gear     S:* C:*"
"DoorCtr1 P:* R:* S:*"
"DC2 loe  1:* 2:* 3:* 4:* 5:* 6:* 7:* 8:* 9:* 10:*"
"BellowPr FAL:* kPa FAR:* kPa RAL:* kPa RAR:* kPa"
"BrakePr  1:* kPa 2:* kPa"
"Alternat 1:* 2:* 3:* 4:*"
"DateTime *"
"AmbTemp  * degr" */
void CPluginCANGine::parseToMessage ()
{
    QStringList list = m_message.split('\n');

    if (2 < list.count())
    {
        QStringList list_engspeed = list[2].split(QRegExp("\\s+"));
        if (1 < list_engspeed.count())
        {
            m_list_data_plugin[INFORMATIONS_DATA].setValueData("PCAN_ENGSPEED"  , list_engspeed[1]);
        }
    }

    if (3 < list.count())
    {
        QStringList list_accel = list[3].split(QRegExp("\\s+"));
        if (1 < list_accel.count() )
        {
            m_list_data_plugin[INFORMATIONS_DATA].setValueData("PCAN_ACCEL"     , list_accel[1]);
        }
    }

    if (4 < list.count())
    {
        QStringList list_tco = list[4].split(QRegExp("\\s+"));
        if (1 < list_tco.count())
        {
            m_list_data_plugin[INFORMATIONS_DATA].setValueData("PCAN_TCO"       , list_tco[1]);
        }

        if (3 < list_tco.count())
        {
            QStringList list_tco_md = list_tco[3].split(":");
            if (1 < list_tco_md.count())
            {
                m_list_data_plugin[INFORMATIONS_DATA].setValueData("PCAN_TCO_MD"    , list_tco_md [1]);
            }
        }

        if (4 < list_tco.count())
        {
            QStringList list_tco_os =  list_tco[4].split(":");
            if (1 < list_tco_os.count())
            {
                m_list_data_plugin[INFORMATIONS_DATA].setValueData("PCAN_TCO_OS"    ,list_tco_os[1]);
            }
        }

        if (5 < list_tco.count())
        {
            QStringList list_tco_di = list_tco[5].split(":");
            if (1 < list_tco_di.count())
            {
                m_list_data_plugin[INFORMATIONS_DATA].setValueData("PCAN_TCO_DI"    , list_tco_di[1]);
            }
        }

        if (6 < list_tco.count())
        {
            QStringList list_tco_tp = list_tco[6].split(":");
            if (1 < list_tco_tp.count())
            {
                m_list_data_plugin[INFORMATIONS_DATA].setValueData("PCAN_TCO_TP"    , list_tco_tp[1]);
            }
        }

        if (7 < list_tco.count())
        {
            QStringList list_tco_hi =  list_tco[7].split(":");
            if (1 < list_tco_hi.count())
            {
                m_list_data_plugin[INFORMATIONS_DATA].setValueData("PCAN_TCO_HI"    ,list_tco_hi[1]);
            }
        }

        if (8 < list_tco.count())
        {
//.........这里部分代码省略.........
开发者ID:Mohtadi,项目名称:projet_c2a,代码行数:101,代码来源:plugin_cangine.cpp


示例16: on_InviteSearch__textChanged

	void ChannelConfigWidget::on_InviteSearch__textChanged (const QString& text)
	{
		InviteFilterModel_->setFilterRegExp (QRegExp (text, Qt::CaseInsensitive,
				QRegExp::FixedString));
		InviteFilterModel_->setFilterKeyColumn (1);
	}
开发者ID:Akon32,项目名称:leechcraft,代码行数:6,代码来源:channelconfigwidget.cpp


示例17: QString

// read zone file, allowing for zones with or without end dates
bool Zones::read(QFile &file)
{
    defaults_from_user = false;
    scheme.zone_default.clear();
    scheme.zone_default_is_pct.clear();
    scheme.zone_default_name.clear();
    scheme.zone_default_desc.clear();
    scheme.nzones_default = 0;
    ranges.clear();

    // set up possible warning dialog
    warning = QString();
    int warning_lines = 0;
    const int max_warning_lines = 100;

    // macro to append lines to the warning
    #define append_to_warning(s) \
        if (warning_lines < max_warning_lines) \
	    warning.append(s);  \
        else if (warning_lines == max_warning_lines) \
	    warning.append("...\n"); \
        warning_lines ++;

    // read using text mode takes care of end-lines
    if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
        err = "can't open file";
        return false;
    }
    QTextStream fileStream(&file);

    QRegExp commentrx("\\s*#.*$");
    QRegExp blankrx("^[ \t]*$");
    QRegExp rangerx[] = {
        QRegExp("^\\s*(?:from\\s+)?"   

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ QRegularExpression函数代码示例发布时间:2022-05-30
下一篇:
C++ QRect函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap