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


C++ QDomElement::childNodes方法代码示例

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


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

示例1: requestEnded

void SearchView::requestEnded(QNetworkReply *e)
{
    for(int i=0; i<mWidgets.count(); i++)
        mWidgets.at(i)->hide();
    mWidgets.clear();

    QDomDocument xml;
    if (xml.setContent(e->readAll()))
    {
        QDomElement root = xml.documentElement();
        QDomNodeList topLevel = root.childNodes();

        /* Google search */
        if (topLevel.count() > 0)
        {
            SearchViewTitle *titleGoogleSearch = new SearchViewTitle("Google Search", mWidget);
            mWidgets.push_back(titleGoogleSearch);

            mGoogleSearch.clear();
        }

        for(int i=0; i<topLevel.count(); i++)
        {
            QDomElement suggestion = topLevel.at(i).toElement();
            QDomNodeList nodes = suggestion.childNodes();
            for(int j=0; j<nodes.count(); j++)
            {
                QDomElement s = nodes.at(j).toElement();
                if (s.tagName() == "suggestion")
                {
                    SearchViewItem *it = new SearchViewItem(s.attribute("data"), mWidget);
                    mWidgets.push_back(it);
                    mGoogleSearch.push_back(s.attribute("data"));
                }
            }
        }
    }

    if (mGoogleSearch.count() > 0)
    {
        SearchViewSeparator *sepGoogleSearch = new SearchViewSeparator(mWidget);
        mWidgets.push_back(sepGoogleSearch);
    }

    /* Service */
    SearchViewTitle *titleService = new SearchViewTitle("Services", mWidget);
    mWidgets.push_back(titleService);

    for(int i=0; i<mServices.keys().count(); i++)
    {
        QString s = "\"";
        s += mWord;
        s += "\" on ";
        s += mServices.keys().at(i);

        SearchViewItem *it = new SearchViewItem(s, mWidget);
        mWidgets.push_back(it);
    }

    if (mWord.isEmpty())
    {
        this->organize();
        return;
    }

    if (Application::getWindow()->getWebContainer()->getWebView()->url().isLocalFile())
    {
        SearchViewSeparator *sepService = new SearchViewSeparator(mWidget);
        mWidgets.push_back(sepService);

        /* On this page */
        SearchViewTitle *titleOnThisPage = new SearchViewTitle("On this page", mWidget);
        mWidgets.push_back(titleOnThisPage);

        QString oc = mWord;
        oc += " (";
        oc += QString::number(searchOccurrences());
        oc += " results)";
        SearchViewItem *it = new SearchViewItem(oc, mWidget);
        mWidgets.push_back(it);
    }

    /*Application::getWindow()->getWebContainer()->getWebView()->findText("", QWebPage::HighlightAllOccurrences);
    Application::getWindow()->getWebContainer()->getWebView()->findText(mWord, QWebPage::HighlightAllOccurrences);
    for(int i=0; i<mOnThisPage.count(); i++)
    {
        SearchViewItem *it = new SearchViewItem(mOnThisPage.at(i), mWidget);
        mWidgets.push_back(it);
    }*/
    this->organize();
}
开发者ID:s-faychatelard,项目名称:Helm,代码行数:91,代码来源:searchview.cpp

示例2: SignalHeadIcon

/**
 * Create a PositionableLabel, then add to a target JLayeredPane
 * @param element Top level QDomElement to unpack.
 * @param o  an Editor as an Object
 */
/*public*/ void SignalHeadIconXml::load(QDomElement element, QObject* o) throw (Exception)
{
 // create the objects
 Editor* ed = (Editor*)o;
 l = new SignalHeadIcon(ed);
 QString name;

 QString attr = element.attribute("signalhead");
 if (attr == NULL) {
     log->error("incorrect information for signal head; must use signalhead name");
     ed->loadFailed();
     return;
 } else {
     name = attr;
 }

 SignalHead* sh = static_cast<SignalHeadManager*>(InstanceManager::getDefault("SignalHeadManager"))->getSignalHead(name);
 if (sh != NULL)
 {
  l->setSignalHead(new NamedBeanHandle<SignalHead*>(name, (SignalHead*)sh));
 }
 else
 {
  log->error("SignalHead named '"+attr+"' not found.");
 //    ed.loadFailed();
  return;
 }
 int rotation = 0;
 try
 {
  attr = element.attribute("rotate");
  rotation = attr.toInt();
 }
 catch (DataConversionException e)
 {
 }
 catch ( NullPointerException e)
 {  // considered normal if the attributes are not present
 }

 //@SuppressWarnings("unchecked")
 QDomNodeList aspects = element.childNodes();
 if (aspects.size()>0)
 {
  QDomElement icons = element.firstChildElement("icons");
  QDomElement elem = element;
  if (!icons.isNull())
  {
   // @SuppressWarnings("unchecked")
   QDomNodeList c = icons.childNodes();
   aspects = c;
   elem = icons;
  }
  for (int i=0; i<aspects.size(); i++)
  {
   QString aspect = aspects.at(i).toElement().tagName();
   NamedIcon* icon = loadIcon(l, aspect, elem, "SignalHead \""+name+"\": icon \""+aspect+"\" ", ed);
   if (icon!=NULL)
   {
    l->setIcon(_nameMap.value(aspect), icon);
   }
   else
   {
    log->info("SignalHead \""+name+"\": icon \""+aspect+"\" removed");
   }
  }
  log->debug(QString::number(aspects.size())+" icons loaded for "+l->getNameString());
 }
 else
 {
  // old style as attributes - somewhere around pre 2.5.4
  NamedIcon* icon = loadSignalIcon("red", rotation, l, element, name, ed);
  if (icon!=NULL)
  {
   l->setIcon(tr("Red"), icon);
  }
  icon = loadSignalIcon("yellow", rotation, l, element, name, ed);
  if (icon!=NULL)
  {
   l->setIcon(tr("Yellow"), icon);
  }
  icon = loadSignalIcon("green", rotation, l, element, name, ed);
  if (icon!=NULL)
  {
   l->setIcon(tr("Green"), icon);
  }
  icon = loadSignalIcon("lunar", rotation, l, element, name, ed);
  if (icon!=NULL)
  {
   l->setIcon(tr("Lunar"), icon);
  }
  icon = loadSignalIcon("held", rotation, l, element, name, ed);
  if (icon!=NULL)
  {
   l->setIcon(tr("Red"), icon);
//.........这里部分代码省略.........
开发者ID:allenck,项目名称:DecoderPro_app,代码行数:101,代码来源:signalheadiconxml.cpp

示例3: docElement

void
XSPFLoader::gotBody()
{
    QDomDocument xmldoc;
    bool namespaceProcessing = true;
    xmldoc.setContent( m_body, namespaceProcessing );
    QDomElement docElement( xmldoc.documentElement() );

    QString origTitle;
    QDomNodeList tracklist;
    QDomElement n = docElement.firstChildElement();
    for ( ; !n.isNull(); n = n.nextSiblingElement() )
    {
        if ( n.namespaceURI() == m_NS && n.localName() == "title" )
        {
            origTitle = n.text();
        }
        else if ( n.namespaceURI() == m_NS && n.localName() == "creator" )
        {
            m_creator = n.text();
        }
        else if ( n.namespaceURI() == m_NS && n.localName() == "info" )
        {
            m_info = n.text();
        }
        else if ( n.namespaceURI() == m_NS && n.localName() == "trackList" )
        {
            tracklist = n.childNodes();
        }
    }

    m_title = origTitle;
    if ( m_title.isEmpty() )
        m_title = tr( "New Playlist" );
    if ( !m_overrideTitle.isEmpty() )
        m_title = m_overrideTitle;

    bool shownError = false;
    for ( unsigned int i = 0; i < tracklist.length(); i++ )
    {
        QDomNode e = tracklist.at( i );

        QString artist, album, track, duration, annotation, url;
        QDomElement n = e.firstChildElement();
        for ( ; !n.isNull(); n = n.nextSiblingElement() )
        {
            if ( n.namespaceURI() == m_NS && n.localName() == "duration" )
            {
                duration = n.text();
            }
            else if ( n.namespaceURI() == m_NS && n.localName() == "annotation" )
            {
                annotation = n.text();
            }
            else if ( n.namespaceURI() == m_NS && n.localName() == "creator" )
            {
                artist = n.text();
            }
            else if ( n.namespaceURI() == m_NS && n.localName() == "album" )
            {
                album = n.text();
            }
            else if ( n.namespaceURI() == m_NS && n.localName() == "title" )
            {
                track = n.text();
            }
            else if ( n.namespaceURI() == m_NS && n.localName() == "url" )
            {
                url = n.text();
            }
        }

        if ( artist.isEmpty() || track.isEmpty() )
        {
            if ( !shownError )
            {
                emit error( InvalidTrackError );
                shownError = true;
            }
            continue;
        }

        query_ptr q = Tomahawk::Query::get( artist, track, album, uuid(), false );
        q->setDuration( duration.toInt() / 1000 );
        if ( !url.isEmpty() )
            q->setResultHint( url );

        m_entries << q;
    }

    if ( m_autoResolve )
    {
        for ( int i = m_entries.size() - 1; i >= 0; i-- )
            Pipeline::instance()->resolve( m_entries[ i ] );
    }

    if ( origTitle.isEmpty() && m_entries.isEmpty() )
    {
        emit error( ParseError );
        if ( m_autoCreate )
//.........这里部分代码省略.........
开发者ID:creichert,项目名称:tomahawk,代码行数:101,代码来源:XspfLoader.cpp

示例4: replaceElemParams

void QgsSvgCache::replaceElemParams( QDomElement& elem, const QColor& fill, const QColor& outline, double outlineWidth )
{
  if ( elem.isNull() )
  {
    return;
  }

  //go through attributes
  QDomNamedNodeMap attributes = elem.attributes();
  int nAttributes = attributes.count();
  for ( int i = 0; i < nAttributes; ++i )
  {
    QDomAttr attribute = attributes.item( i ).toAttr();
    //e.g. style="fill:param(fill);param(stroke)"
    if ( attribute.name().compare( "style", Qt::CaseInsensitive ) == 0 )
    {
      //entries separated by ';'
      QString newAttributeString;

      QStringList entryList = attribute.value().split( ';' );
      QStringList::const_iterator entryIt = entryList.constBegin();
      for ( ; entryIt != entryList.constEnd(); ++entryIt )
      {
        QStringList keyValueSplit = entryIt->split( ':' );
        if ( keyValueSplit.size() < 2 )
        {
          continue;
        }
        QString key = keyValueSplit.at( 0 );
        QString value = keyValueSplit.at( 1 );
        if ( value.startsWith( "param(fill" ) )
        {
          value = fill.name();
        }
        else if ( value.startsWith( "param(outline)" ) )
        {
          value = outline.name();
        }
        else if ( value.startsWith( "param(outline-width)" ) )
        {
          value = QString::number( outlineWidth );
        }

        if ( entryIt != entryList.constBegin() )
        {
          newAttributeString.append( ";" );
        }
        newAttributeString.append( key + ":" + value );
      }
      elem.setAttribute( attribute.name(), newAttributeString );
    }
    else
    {
      QString value = attribute.value();
      if ( value.startsWith( "param(fill)" ) )
      {
        elem.setAttribute( attribute.name(), fill.name() );
      }
      else if ( value.startsWith( "param(outline)" ) )
      {
        elem.setAttribute( attribute.name(), outline.name() );
      }
      else if ( value.startsWith( "param(outline-width)" ) )
      {
        elem.setAttribute( attribute.name(), QString::number( outlineWidth ) );
      }
    }
  }

  QDomNodeList childList = elem.childNodes();
  int nChildren = childList.count();
  for ( int i = 0; i < nChildren; ++i )
  {
    QDomElement childElem = childList.at( i ).toElement();
    replaceElemParams( childElem, fill, outline, outlineWidth );
  }
}
开发者ID:Nald,项目名称:Quantum-GIS,代码行数:77,代码来源:qgssvgcache.cpp

示例5: convertEditType

const QString QgsLegacyHelpers::convertEditType( QgsVectorLayer::EditType editType, QgsEditorWidgetConfig& cfg, QgsVectorLayer* vl, const QString& name, const QDomElement editTypeElement )
{
  QString widgetType = "TextEdit"; // Fallback

  switch ( editType )
  {
    case QgsVectorLayer::ValueMap:
    {
      widgetType = "ValueMap";
      QDomNodeList valueMapNodes = editTypeElement.childNodes();

      for ( int j = 0; j < valueMapNodes.size(); j++ )
      {
        QDomElement value = valueMapNodes.at( j ).toElement();
        cfg.insert( value.attribute( "key" ), value.attribute( "value" ) );
      }
      break;
    }

    case QgsVectorLayer::EditRange:
    {
      widgetType = "Range";
      cfg.insert( "Style", "Edit" );
      cfg.insert( "Min", editTypeElement.attribute( "min" ).toFloat() );
      cfg.insert( "Max", editTypeElement.attribute( "max" ).toFloat() );
      cfg.insert( "Step", editTypeElement.attribute( "step" ).toFloat() );
      break;
    }

    case QgsVectorLayer::SliderRange:
    {
      widgetType = "SliderRange";
      cfg.insert( "Style", "Slider" );
      cfg.insert( "Min", editTypeElement.attribute( "min" ).toFloat() );
      cfg.insert( "Max", editTypeElement.attribute( "max" ).toFloat() );
      cfg.insert( "Step", editTypeElement.attribute( "step" ).toFloat() );
      break;
    }

    case QgsVectorLayer::DialRange:
    {
      widgetType = "DialRange";
      cfg.insert( "Style", "Dial" );
      cfg.insert( "Min", editTypeElement.attribute( "min" ).toFloat() );
      cfg.insert( "Max", editTypeElement.attribute( "max" ).toFloat() );
      cfg.insert( "Step", editTypeElement.attribute( "step" ).toFloat() );
      break;
    }

    case QgsVectorLayer::CheckBox:
    {
      widgetType = "CheckBox";
      cfg.insert( "CheckedState", editTypeElement.attribute( "checked" ) );
      cfg.insert( "UncheckedState", editTypeElement.attribute( "unchecked" ) );
      break;
    }

    case QgsVectorLayer::ValueRelation:
    {
      widgetType = "ValueRelation";
      cfg.insert( "AllowNull", editTypeElement.attribute( "allowNull" ) == "true" );
      cfg.insert( "OrderByValue", editTypeElement.attribute( "orderByValue" ) == "true" );
      cfg.insert( "AllowMulti", editTypeElement.attribute( "allowMulti", "false" ) == "true" );
      QString filterExpression;
      if ( editTypeElement.hasAttribute( "filterAttributeColumn" ) &&
           editTypeElement.hasAttribute( "filterAttributeValue" ) )
      {
        filterExpression = QString( "\"%1\"='%2'" )
                           .arg( editTypeElement.attribute( "filterAttributeColumn" ) )
                           .arg( editTypeElement.attribute( "filterAttributeValue" ) );
      }
      else
      {
        filterExpression  = editTypeElement.attribute( "filterExpression", QString::null );
      }
      cfg.insert( "FilterExpression", filterExpression );
      cfg.insert( "Layer", editTypeElement.attribute( "layer" ) );
      cfg.insert( "Key", editTypeElement.attribute( "key" ) );
      cfg.insert( "Value", editTypeElement.attribute( "value" ) );

      break;
    }

    case QgsVectorLayer::Calendar:
    {
      widgetType = "DateTime";
      cfg.insert( "display_format", editTypeElement.attribute( "dateFormat" ) );
      cfg.insert( "field_format", "yyyy-MM-dd" );
      break;
    }

    case QgsVectorLayer::Photo:
    {
      widgetType = "Photo";
      cfg.insert( "Width", editTypeElement.attribute( "widgetWidth" ).toInt() );
      cfg.insert( "Height", editTypeElement.attribute( "widgetHeight" ).toInt() );
      break;
    }

    case QgsVectorLayer::WebView:
//.........这里部分代码省略.........
开发者ID:ACorradini,项目名称:QGIS,代码行数:101,代码来源:qgslegacyhelpers.cpp

示例6: loadORA

bool ParupaintPanvasInputOutput::loadORA(ParupaintPanvas * panvas, const QString & filename, QString & errorStr)
{
	Q_ASSERT(panvas);
	if(filename.isEmpty())
		return (errorStr = "Enter a filename to save to.").isEmpty();

#ifdef QT_XML_LIB

	KZip zip(filename);
	if(!zip.open(QIODevice::ReadOnly))
		return (errorStr = "Couldn't read ORA").isEmpty();

	const KArchiveDirectory * d = zip.directory();

	const auto * mte = d->entry("mimetype");
	if(!mte->isFile())
		return (errorStr = "Is not a file...").isEmpty();
	const KArchiveFile *mtf = static_cast<const KArchiveFile*>(mte);
	if(mtf->data() != "image/openraster")
		return (errorStr = "File is not ORA.").isEmpty();

	// okay, it's an ORA.
	const auto * stacke = d->entry("stack.xml");
	if(!stacke->isFile())
		return (errorStr = "Corrupted ORA?").isEmpty();
	const KArchiveFile *stf = static_cast<const KArchiveFile*>(stacke);
	
	QDomDocument doc;
	if(!doc.setContent(stf->data(), true))
		return (errorStr = "doc.setContent error").isEmpty();

	QDomElement element = doc.documentElement();
	QSize imagesize(element.attribute("w").toInt(),
			element.attribute("h").toInt());

	if(imagesize.isEmpty())
		return (errorStr = "Invalid size.").isEmpty();

	//okay, load the images
	
	// Oras can't be animation so we don't need
	// a special filtering thing
	panvas->setBackgroundColor(Qt::transparent);
	panvas->clearCanvas();
	panvas->resize(imagesize);

	const QDomElement stackroot = doc.documentElement().firstChildElement("stack");
	for(auto l = 0; l < stackroot.childNodes().count(); l++){
		QDomElement e = stackroot.childNodes().at(l).toElement();
		if(e.isNull()) continue;
		if(e.tagName() != "layer") continue;
		
		const QString name = e.attribute("name");
		const QString src = e.attribute("src");
		const qreal opacity = e.attribute("opacity").toDouble();
		const QString composite = e.attribute("composite-op");
		const bool visible = (e.attribute("visibility") == "visible");
		const qreal x = e.attribute("x").toDouble();
		const qreal y = e.attribute("y").toDouble();


		const auto * layer_entry = d->entry(src);
		if(!layer_entry->isFile()) continue;
		const KArchiveFile *layer_file = static_cast<const KArchiveFile*>(layer_entry);

		QByteArray byte_array = layer_file->data();

		QImage original_pic;
		original_pic.loadFromData(byte_array);

		QImage pic(imagesize, original_pic.format());
		pic.fill(0);
		QPainter paint(&pic);

		auto rp = original_pic.rect();
		auto rr = rp;
		rr.adjust(x, y, x, y);
		paint.drawImage(rr, original_pic, rp);
		
		paint.end();

		ParupaintLayer * layer = new ParupaintLayer(panvas);
		layer->setMode(composite);
		layer->setVisible(visible);
		layer->setName(name);

		layer->insertFrame(new ParupaintFrame(pic, layer, opacity));
		panvas->insertLayer(layer, 0);

	}
	if(true) return true;
#endif
	return (errorStr = "unable to load ora files").isEmpty();
}
开发者ID:parulina,项目名称:parupaint,代码行数:94,代码来源:parupaintPanvasInputOutput.cpp

示例7: docElement

void
XSPFLoader::gotBody()
{
    qDebug() << Q_FUNC_INFO;

    QDomDocument xmldoc;
    bool namespaceProcessing = true;
    xmldoc.setContent( m_body, namespaceProcessing );
    QDomElement docElement( xmldoc.documentElement() );

    QString origTitle;
    QDomNodeList tracklist;
    QDomElement n = docElement.firstChildElement();
    for ( ; !n.isNull(); n = n.nextSiblingElement() ) {
        if (n.namespaceURI() == m_NS && n.localName() == "title") {
            origTitle = n.text();
        } else if (n.namespaceURI() == m_NS && n.localName() == "creator") {
            m_creator = n.text();
        } else if (n.namespaceURI() == m_NS && n.localName() == "info") {
            m_info = n.text();
        } else if (n.namespaceURI() == m_NS && n.localName() == "trackList") {
            tracklist = n.childNodes();
        }
    }

    m_title = origTitle;
    if ( m_title.isEmpty() )
        m_title = tr( "New Playlist" );

    bool shownError = false;
    for ( unsigned int i = 0; i < tracklist.length(); i++ )
    {
        QDomNode e = tracklist.at( i );

        QString artist, album, track, duration, annotation;
        QDomElement n = e.firstChildElement();
        for ( ; !n.isNull(); n = n.nextSiblingElement() ) {
            if (n.namespaceURI() == m_NS && n.localName() == "duration") {
                duration = n.text();
            } else if (n.namespaceURI() == m_NS && n.localName() == "annotation") {
                annotation = n.text();
            } else if (n.namespaceURI() == m_NS && n.localName() == "creator") {
                artist = n.text();
            } else if (n.namespaceURI() == m_NS && n.localName() == "album") {
                album = n.text();
            } else if (n.namespaceURI() == m_NS && n.localName() == "title") {
                track = n.text();
            }
        }
        
        if( artist.isEmpty() || track.isEmpty() ) {
            if( !shownError ) {
                QMessageBox::warning( 0, tr( "Failed to save tracks" ), tr( "Some tracks in the playlist do not contain an artist and a title. They will be ignored." ), QMessageBox::Ok );
                shownError = true;
            }
            continue;
        }

        plentry_ptr p( new PlaylistEntry );
        p->setGuid( uuid() );
        p->setDuration( duration.toInt() / 1000 );
        p->setLastmodified( 0 );
        p->setAnnotation( annotation );

        p->setQuery( Tomahawk::Query::get( artist, track, album, uuid() ) );
        p->query()->setDuration( duration.toInt() / 1000 );
        m_entries << p;
    }

    if ( origTitle.isEmpty() && m_entries.isEmpty() )
    {
        if ( m_autoCreate )
        {
            QMessageBox::critical( 0, tr( "XSPF Error" ), tr( "This is not a valid XSPF playlist." ) );
            deleteLater();
            return;
        }
        else
        {
            emit failed();
            return;
        }
    }

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

        m_playlist->createNewRevision( uuid(), m_playlist->currentrevision(), m_entries );
        deleteLater();
    }

    emit ok( m_playlist );
}
开发者ID:LittleForker,项目名称:tomahawk,代码行数:99,代码来源:xspfloader.cpp

示例8: f

bool
NetworkObject::loadGraphML(QString flnm)
{
  m_fileName = flnm;

  QDomDocument doc;
  QFile f(flnm.toLatin1().data());
  if (f.open(QIODevice::ReadOnly))
    {
      doc.setContent(&f);
      f.close();
    }

  QDomElement main = doc.documentElement();
  getKey(main);

//  m_log->insertPlainText("Node Attributes \n");
//  for(int i=0; i<m_nodeAtt.count(); i++)
//    m_log->insertPlainText("     "+m_nodeAtt[i]+"\n");
//  m_log->insertPlainText("\n");
//  m_log->insertPlainText("Edge Attributes \n");
//  for(int i=0; i<m_edgeAtt.count(); i++)
//    m_log->insertPlainText("     "+m_edgeAtt[i]+"\n");
//  m_log->insertPlainText("\n");
 
  QDomNodeList dlist = main.childNodes();
  for(int i=0; i<dlist.count(); i++)
    {
      if (dlist.at(i).isElement())
	{
	  QDomElement ele = dlist.at(i).toElement();
	  QString str = ele.nodeName();
	  if (str == "graph")
	    {
	      QDomNodeList nnodes = ele.elementsByTagName("node");
	      loadNodeInfo(nnodes);

	      QDomNodeList nedges = ele.elementsByTagName("edge");
	      loadEdgeInfo(nedges);
	    }
	}
    }

  //---------------------
  Vec bmin = m_vertexCenters[0];
  Vec bmax = m_vertexCenters[0];
  for(int i=0; i<m_vertexCenters.count(); i++)
    {
      bmin = StaticFunctions::minVec(bmin, m_vertexCenters[i]);
      bmax = StaticFunctions::maxVec(bmax, m_vertexCenters[i]);
    }
  m_centroid = (bmin + bmax)/2;
  
  m_enclosingBox[0] = Vec(bmin.x, bmin.y, bmin.z);
  m_enclosingBox[1] = Vec(bmax.x, bmin.y, bmin.z);
  m_enclosingBox[2] = Vec(bmax.x, bmax.y, bmin.z);
  m_enclosingBox[3] = Vec(bmin.x, bmax.y, bmin.z);
  m_enclosingBox[4] = Vec(bmin.x, bmin.y, bmax.z);
  m_enclosingBox[5] = Vec(bmax.x, bmin.y, bmax.z);
  m_enclosingBox[6] = Vec(bmax.x, bmax.y, bmax.z);
  m_enclosingBox[7] = Vec(bmin.x, bmax.y, bmax.z);


//  m_nX = (bmax.x - bmin.x) + 1;
//  m_nY = (bmax.y - bmin.y) + 1;
//  m_nZ = (bmax.z - bmin.z) + 1;
  m_nX = bmax.x;
  m_nY = bmax.y;
  m_nZ = bmax.z;

  if (!Global::batchMode())
    {
      QString str;
      str = QString("Grid Size : %1 %2 %3\n").arg(m_nX).arg(m_nY).arg(m_nZ);
      str += QString("Vertices : %1\n").arg(m_vertexCenters.count());
      str += QString("Edges : %1\n").arg(m_edgeNeighbours.count());
      str += QString("\n");
      str += QString("Vertex Attributes : %1\n").arg(m_vertexAttribute.count());
      for(int i=0; i<m_vertexAttribute.count(); i++)
	str += QString(" %1\n").arg(m_vertexAttribute[i].first);
      str += QString("\n");
      str += QString("Edge Attributes : %1\n").arg(m_edgeAttribute.count());
      for(int i=0; i<m_edgeAttribute.count(); i++)
	str += QString(" %1\n").arg(m_edgeAttribute[i].first);
      
      QMessageBox::information(0, "Network loaded", str);
    }

  m_Vatt = 0;
  m_Eatt = 0;
  m_Vminmax.clear();
  m_Eminmax.clear();
  m_userVminmax.clear();
  m_userEminmax.clear();

  for(int i=0; i<m_vertexAttribute.count(); i++)
    {
      float vmin = m_vertexAttribute[i].second[0];
      float vmax = m_vertexAttribute[i].second[0];
      for(int j=1; j<m_vertexAttribute[i].second.count(); j++)
//.........这里部分代码省略.........
开发者ID:Elavina6,项目名称:drishti,代码行数:101,代码来源:networkobject.cpp

示例9: parseReportDetailSection

bool parseReportDetailSection(const QDomElement & elemSource, ORDetailSectionData & sectionTarget)
{
  if(elemSource.tagName() != "section")
    return FALSE;

  bool have_name = FALSE;
  bool have_detail = FALSE;
  bool have_key = FALSE;

  ORSectionData * old_head = 0;
  ORSectionData * old_foot = 0;

  QDomNodeList section = elemSource.childNodes();
  for(int nodeCounter = 0; nodeCounter < section.count(); nodeCounter++)
  {
    QDomElement elemThis = section.item(nodeCounter).toElement();
    if(elemThis.tagName() == "name")
    {
      sectionTarget.name = elemThis.text();
      have_name = TRUE;
    }
    else if(elemThis.tagName() == "pagebreak")
    {
      if(elemThis.attribute("when") == "at end")
        sectionTarget.pagebreak = ORDetailSectionData::BreakAtEnd;
    }
    else if(elemThis.tagName() == "grouphead")
    {
      ORSectionData * sd = new ORSectionData();
      if(parseReportSection(elemThis, *sd) == TRUE)
      {
        old_head = sd;
        sectionTarget.trackTotal += sd->trackTotal;
      }
      else
        delete sd;
    }
    else if(elemThis.tagName() == "groupfoot")
    {
      ORSectionData * sd = new ORSectionData();
      if(parseReportSection(elemThis, *sd) == TRUE)
      {
        old_foot = sd;
        sectionTarget.trackTotal += sd->trackTotal;
      }
      else
        delete sd;
    }
    else if(elemThis.tagName() == "group")
    {
      QDomNodeList nl = elemThis.childNodes();
      QDomNode node;
      ORDetailGroupSectionData * dgsd = new ORDetailGroupSectionData();
      for(int i = 0; i < nl.count(); i++)
      {
        node = nl.item(i);
        if(node.nodeName() == "name")
          dgsd->name = node.firstChild().nodeValue();
        else if(node.nodeName() == "column")
          dgsd->column = node.firstChild().nodeValue();
        else if(node.nodeName() == "pagebreak")
        {
          QDomElement elemThis = node.toElement();
          QString n = elemThis.attribute("when");
          if("after foot" == n)
            dgsd->pagebreak = ORDetailGroupSectionData::BreakAfterGroupFoot;
        }
        else if(node.nodeName() == "head")
        {
          ORSectionData * sd = new ORSectionData();
          if(parseReportSection(node.toElement(), *sd) == TRUE)
          {
            dgsd->head = sd;
            sectionTarget.trackTotal += sd->trackTotal;
            for(Q3ValueListIterator<ORDataData> it = sd->trackTotal.begin(); it != sd->trackTotal.end(); ++it)
              dgsd->_subtotCheckPoints[*it] = 0.0;
          }
          else
            delete sd;
        }
        else if(node.nodeName() == "foot")
        {
          ORSectionData * sd = new ORSectionData();
          if(parseReportSection(node.toElement(), *sd) == TRUE)
          {
            dgsd->foot = sd;
            sectionTarget.trackTotal += sd->trackTotal;
            for(Q3ValueListIterator<ORDataData> it = sd->trackTotal.begin(); it != sd->trackTotal.end(); ++it)
              dgsd->_subtotCheckPoints[*it] = 0.0;
          }
          else
            delete sd;
        }
        else
          qDebug("While parsing group section encountered an unknown element: %s", node.nodeName().latin1());
      }
      sectionTarget.groupList.append(dgsd);
    }
    else if(elemThis.tagName() == "detail")
    {
//.........这里部分代码省略.........
开发者ID:Wushaowei001,项目名称:xtuple,代码行数:101,代码来源:parsexmlutils.cpp

示例10: readXml

void QgsEditFormConfig::readXml( const QDomNode& node )
{
  QDomNode editFormNode = node.namedItem( "editform" );
  if ( !editFormNode.isNull() )
  {
    QDomElement e = editFormNode.toElement();
    mUiFormPath = QgsProject::instance()->readPath( e.text() );
  }

  QDomNode editFormInitNode = node.namedItem( "editforminit" );
  if ( !editFormInitNode.isNull() )
  {
    mInitFunction = editFormInitNode.toElement().text();
  }

  QDomNode editFormInitCodeSourceNode = node.namedItem( "editforminitcodesource" );
  if ( !editFormInitCodeSourceNode.isNull() || ( !editFormInitCodeSourceNode.isNull() && !editFormInitCodeSourceNode.toElement().text().isEmpty() ) )
  {
    setInitCodeSource( static_cast< QgsEditFormConfig::PythonInitCodeSource >( editFormInitCodeSourceNode.toElement().text().toInt() ) );
  }

  QDomNode editFormInitCodeNode = node.namedItem( "editforminitcode" );
  if ( !editFormInitCodeNode.isNull() )
  {
    setInitCode( editFormInitCodeNode.toElement().text() );
  }

  // Temporary < 2.12 b/w compatibility "dot" support patch
  // @see: https://github.com/qgis/QGIS/pull/2498
  // For b/w compatibility, check if there's a dot in the function name
  // and if yes, transform it in an import statement for the module
  // and set the PythonInitCodeSource to CodeSourceDialog
  int dotPos = mInitFunction.lastIndexOf( '.' );
  if ( dotPos >= 0 ) // It's a module
  {
    setInitCodeSource( QgsEditFormConfig::CodeSourceDialog );
    setInitCode( QString( "from %1 import %2\n" ).arg( mInitFunction.left( dotPos ), mInitFunction.mid( dotPos + 1 ) ) );
    setInitFunction( mInitFunction.mid( dotPos + 1 ) );
  }

  QDomNode editFormInitFilePathNode = node.namedItem( "editforminitfilepath" );
  if ( !editFormInitFilePathNode.isNull() || ( !editFormInitFilePathNode.isNull() && !editFormInitFilePathNode.toElement().text().isEmpty() ) )
  {
    setInitFilePath( QgsProject::instance()->readPath( editFormInitFilePathNode.toElement().text() ) );
  }

  QDomNode fFSuppNode = node.namedItem( "featformsuppress" );
  if ( fFSuppNode.isNull() )
  {
    mSuppressForm = QgsEditFormConfig::SuppressDefault;
  }
  else
  {
    QDomElement e = fFSuppNode.toElement();
    mSuppressForm = static_cast< QgsEditFormConfig::FeatureFormSuppress >( e.text().toInt() );
  }

  // tab display
  QDomNode editorLayoutNode = node.namedItem( "editorlayout" );
  if ( editorLayoutNode.isNull() )
  {
    mEditorLayout = QgsEditFormConfig::GeneratedLayout;
  }
  else
  {
    if ( editorLayoutNode.toElement().text() == "uifilelayout" )
    {
      mEditorLayout = QgsEditFormConfig::UiFileLayout;
    }
    else if ( editorLayoutNode.toElement().text() == "tablayout" )
    {
      mEditorLayout = QgsEditFormConfig::TabLayout;
    }
    else
    {
      mEditorLayout = QgsEditFormConfig::GeneratedLayout;
    }
  }

  // tabs and groups display info
  clearTabs();
  QDomNode attributeEditorFormNode = node.namedItem( "attributeEditorForm" );
  QDomNodeList attributeEditorFormNodeList = attributeEditorFormNode.toElement().childNodes();

  for ( int i = 0; i < attributeEditorFormNodeList.size(); i++ )
  {
    QDomElement elem = attributeEditorFormNodeList.at( i ).toElement();

    QgsAttributeEditorElement *attributeEditorWidget = attributeEditorElementFromDomElement( elem, this );
    addTab( attributeEditorWidget );
  }


  //// TODO: MAKE THIS MORE GENERIC, SO INDIVIDUALL WIDGETS CAN NOT ONLY SAVE STRINGS
  /// SEE QgsEditorWidgetFactory::writeConfig

  QDomElement widgetsElem = node.namedItem( "widgets" ).toElement();

  QDomNodeList widgetConfigsElems = widgetsElem.childNodes();

//.........这里部分代码省略.........
开发者ID:Antoviscomi,项目名称:QGIS,代码行数:101,代码来源:qgseditformconfig.cpp

示例11:

void
NetworkObject::getKey(QDomElement main)
{
  m_nodeAtt.clear();
  m_edgeAtt.clear();

  QDomNodeList dlist = main.childNodes();
  for(int i=0; i<dlist.count(); i++)
    {
      if (dlist.at(i).isElement())
	{
	  QDomElement ele = dlist.at(i).toElement();
	  QString str = ele.nodeName();
	  if (str == "key")
	    {
	      QDomNamedNodeMap attr = ele.attributes();
	      int nattr = attr.count();
	      bool isnode = false;
	      bool isedge = false;
	      for(int na=0; na<nattr; na++)
		{
		  QDomNode node = attr.item(na);
		  QString name = node.nodeName();
		  QString val = node.nodeValue();
		  if (val == "node") { isnode = true; break; }
		  if (val == "edge") { isedge = true; break; }
		}
	      for(int na=0; na<nattr; na++)
		{
		  QDomNode node = attr.item(na);
		  QString name = node.nodeName();
		  QString val = node.nodeValue();
		  if (isnode && name == "id")
		    {
		      if (val != "x" &&
			  val != "y" &&
			  val != "z")
			m_nodeAtt << val;
		    }
		  if (isedge && name == "id")
		    m_edgeAtt << val;
		}
	    }
	}
    }

  m_vertexRadiusAttribute = -1;
  m_edgeRadiusAttribute = -1;

  for(int i=0; i<m_nodeAtt.count(); i++)
    {
      if (m_nodeAtt[i].contains("radius", Qt::CaseInsensitive) ||
	  m_nodeAtt[i].contains("diameter", Qt::CaseInsensitive))
	{
	  m_vertexRadiusAttribute = i;
	  break;
	}
    }
  for(int i=0; i<m_edgeAtt.count(); i++)
    {
      if (m_edgeAtt[i].contains("radius", Qt::CaseInsensitive) ||
	  m_edgeAtt[i].contains("diameter", Qt::CaseInsensitive))
	{
	  m_edgeRadiusAttribute = i;
	  break;
	}
    }
}
开发者ID:Elavina6,项目名称:drishti,代码行数:68,代码来源:networkobject.cpp

示例12: QObject

KReportDetailSectionData::KReportDetailSectionData(const QDomElement &elemSource, KReportDocument *report)
 : QObject(report)
{
    m_pageBreak = BreakNone;
    m_detailSection = 0;
    m_valid = false;
    //kreportDebug() << elemSource.tagName();
    if (elemSource.tagName() != QLatin1String("report:detail")) {
        return;
    }

    QDomNodeList sections = elemSource.childNodes();

    for (int nodeCounter = 0; nodeCounter < sections.count(); nodeCounter++) {
        QDomElement elemThis = sections.item(nodeCounter).toElement();

        if (elemThis.tagName() == QLatin1String("report:group")) {
            KReportDetailGroupSectionData * dgsd = new KReportDetailGroupSectionData();

            if ( elemThis.hasAttribute( QLatin1String("report:group-column") ) ) {
                dgsd->m_column = elemThis.attribute( QLatin1String("report:group-column") );
            }

            if ( elemThis.hasAttribute( QLatin1String("report:group-page-break") ) ) {
                QString s = elemThis.attribute( QLatin1String("report:group-page-break") );
                if ( s == QLatin1String("after-footer") ) {
                    dgsd->m_pagebreak = KReportDetailGroupSectionData::BreakAfterGroupFooter;
                } else if ( s == QLatin1String("before-header") ) {
                    dgsd->m_pagebreak = KReportDetailGroupSectionData::BreakBeforeGroupHeader;
                } else {
                    dgsd->m_pagebreak = KReportDetailGroupSectionData::BreakNone;
                }
            }

            if (elemThis.attribute(QLatin1String("report:group-sort"), QLatin1String("ascending")) == QLatin1String("ascending")) {
                dgsd->m_sort = Qt::AscendingOrder;
            } else {
                dgsd->m_sort = Qt::DescendingOrder;
            }
            
            for ( QDomElement e = elemThis.firstChildElement( QLatin1String("report:section") ); ! e.isNull(); e = e.nextSiblingElement( QLatin1String("report:section") ) ) {
                QString s = e.attribute( QLatin1String("report:section-type") );
                if ( s == QLatin1String("group-header") ) {
                    KReportSectionData * sd = new KReportSectionData(e, report);
                    if (sd->isValid()) {
                        dgsd->m_groupHeader = sd;
                    } else {
                        delete sd;
                    }
                } else if ( s == QLatin1String("group-footer") ) {
                    KReportSectionData * sd = new KReportSectionData(e, report);
                    if (sd->isValid()) {
                        dgsd->m_groupFooter = sd;
                    } else {
                        delete sd;
                    }
                }
            }
            m_groupList.append(dgsd);
            KReportData::SortedField s;
            s.field = dgsd->m_column;
            s.order = dgsd->m_sort;
            m_sortedFields.append(s);
	    
        } else if (elemThis.tagName() == QLatin1String("report:section") && elemThis.attribute(QLatin1String("report:section-type")) == QLatin1String("detail")) {
            KReportSectionData * sd = new KReportSectionData(elemThis, report);
            if (sd->isValid()) {
                m_detailSection = sd;
            } else
                delete sd;
        } else {
            kreportWarning() << "While parsing detail section encountered an unknown element: " << elemThis.tagName();
        }
    }
    
    m_valid = true;
}
开发者ID:nimxor,项目名称:kreport,代码行数:77,代码来源:KReportDetailSectionData.cpp

示例13: readFile

int XmlGspInterface::readFile(const QString &fileName)
{
	QFile* file = new QFile(fileName);
	QFileInfo fi(fileName);
	QString path = (fi.path().length() > 3) ? QString(fi.path() + "/") : fi.path();

	QFileInfo si(QString::fromStdString(_schemaName));
	QString schemaPath(si.absolutePath() + "/");

	if (!file->open(QIODevice::ReadOnly | QIODevice::Text))
	{
		std::cout << "XmlGspInterface::readFile() - Can't open xml-file " <<
		fileName.toStdString() << "." << std::endl;
		delete file;
		return 0;
	}
	if (!checkHash(fileName))
	{
		delete file;
		return 0;
	}

	QDomDocument doc("OGS-PROJECT-DOM");
	doc.setContent(file);
	QDomElement docElement = doc.documentElement(); //OpenGeoSysProject
	if (docElement.nodeName().compare("OpenGeoSysProject"))
	{
		std::cout << "XmlGspInterface::readFile() - Unexpected XML root." << std::endl;
		delete file;
		return 0;
	}

	QDomNodeList fileList = docElement.childNodes();

	for(int i = 0; i < fileList.count(); i++)
	{
		const QString file_node(fileList.at(i).nodeName());
		if (file_node.compare("geo") == 0)
		{
			XmlGmlInterface gml(_project, schemaPath.toStdString() + "OpenGeoSysGLI.xsd");
			const QDomNodeList childList = fileList.at(i).childNodes();
			for(int j = 0; j < childList.count(); j++)
			{
				const QDomNode child_node (childList.at(j));
				if (child_node.nodeName().compare("file") == 0)
				{
					std::cout << "path: " << path.toStdString() << "#" << std::endl;
					std::cout << "file name: " << (child_node.toElement().text()).toStdString() << "#" << std::endl;
					gml.readFile(QString(path + child_node.toElement().text()));
				}
			}
		}
		else if (file_node.compare("stn") == 0)
		{
			XmlStnInterface stn(_project, schemaPath.toStdString() + "OpenGeoSysSTN.xsd");
			const QDomNodeList childList = fileList.at(i).childNodes();
			for(int j = 0; j < childList.count(); j++)
				if (childList.at(j).nodeName().compare("file") == 0)
					stn.readFile(QString(path + childList.at(j).toElement().text()));
		}
		else if (file_node.compare("msh") == 0)
		{
			const std::string msh_name = path.toStdString() +
			                       fileList.at(i).toElement().text().toStdString();
			FileIO::MeshIO meshIO;
			MeshLib::Mesh* msh = meshIO.loadMeshFromFile(msh_name);
			_project->addMesh(msh);
		}
	}

	return 1;
}
开发者ID:JobstM,项目名称:ogs,代码行数:72,代码来源:XmlGspInterface.cpp

示例14: convertTable

bool Converter::convertTable( const QDomElement &element )
{
  /**
   * Find out dimension of the table
   */
  int rowCounter = 0;
  int columnCounter = 0;

  QQueue<QDomNode> nodeQueue;
  enqueueNodeList( nodeQueue, element.childNodes() );
  while ( !nodeQueue.isEmpty() ) {
    QDomElement el = nodeQueue.dequeue().toElement();
    if ( el.isNull() )
      continue;

    if ( el.tagName() == QLatin1String( "table-row" ) ) {
      rowCounter++;

      int counter = 0;
      QDomElement columnElement = el.firstChildElement();
      while ( !columnElement.isNull() ) {
        if ( columnElement.tagName() == QLatin1String( "table-cell" ) ) {
          counter++;
        }
        columnElement = columnElement.nextSiblingElement();
      }

      columnCounter = qMax( columnCounter, counter );
    } else if ( el.tagName() == QLatin1String( "table-header-rows" ) ) {
      enqueueNodeList( nodeQueue, el.childNodes() );
    }
  }

  /**
   * Create table
   */
  QTextTable *table = mCursor->insertTable( rowCounter, columnCounter );
  mCursor->movePosition( QTextCursor::End );

  /**
   * Fill table
   */
  nodeQueue.clear();
  enqueueNodeList( nodeQueue, element.childNodes() );

  QTextTableFormat tableFormat;

  rowCounter = 0;
  while ( !nodeQueue.isEmpty() ) {
    QDomElement el = nodeQueue.dequeue().toElement();
    if ( el.isNull() )
      continue;

    if ( el.tagName() == QLatin1String( "table-row" ) ) {

      int columnCounter = 0;
      QDomElement columnElement = el.firstChildElement();
      while ( !columnElement.isNull() ) {
        if ( columnElement.tagName() == QLatin1String( "table-cell" ) ) {
          const StyleFormatProperty property = mStyleInformation->styleProperty( columnElement.attribute( QStringLiteral("style-name") ) );

          QTextBlockFormat format;
          property.applyTableCell( &format );

          QDomElement paragraphElement = columnElement.firstChildElement();
          while ( !paragraphElement.isNull() ) {
            if ( paragraphElement.tagName() == QLatin1String( "p" ) ) {
              QTextTableCell cell = table->cellAt( rowCounter, columnCounter );
              // Insert a frame into the cell and work on that, so we can handle
              // different parts of the cell having different block formatting
              QTextCursor cellCursor = cell.lastCursorPosition();
              QTextFrameFormat frameFormat;
              frameFormat.setMargin( 1 ); // TODO: this shouldn't be hard coded
              QTextFrame *frame = cellCursor.insertFrame( frameFormat );
              QTextCursor frameCursor = frame->firstCursorPosition();
              frameCursor.setBlockFormat( format );

              if ( !convertParagraph( &frameCursor, paragraphElement, format ) )
                return false;
            } else if ( paragraphElement.tagName() == QLatin1String( "list" ) ) {
              QTextTableCell cell = table->cellAt( rowCounter, columnCounter );
              // insert a list into the cell
              QTextCursor cellCursor = cell.lastCursorPosition();
              if ( !convertList( &cellCursor, paragraphElement ) ) {
                return false;
              }
            }

            paragraphElement = paragraphElement.nextSiblingElement();
          }
          columnCounter++;
        }
        columnElement = columnElement.nextSiblingElement();
      }

      rowCounter++;
    } else if ( el.tagName() == QLatin1String( "table-column" ) ) {
      const StyleFormatProperty property = mStyleInformation->styleProperty( el.attribute( QStringLiteral("style-name") ) );
      const QString tableColumnNumColumnsRepeated = el.attribute( QStringLiteral("number-columns-repeated"), QStringLiteral("1") );
      int numColumnsToApplyTo = tableColumnNumColumnsRepeated.toInt();
//.........这里部分代码省略.........
开发者ID:KDE,项目名称:okular,代码行数:101,代码来源:converter.cpp

示例15: if


//.........这里部分代码省略.........
    }

    // connect validator, if we have one
    if (v) {
      QObject * p = _parent;
      while (p != NULL) {
	if (dynamic_cast<ParameterDialog *>(p) != NULL) {
	  connect(v, SIGNAL(acceptable(bool)), p, SLOT(accept(bool)));
	  break;
	}
	p = p->parent();
      }
    }

    // add default as tooltip
    if (!parameter_.default_.isEmpty()) {
      QToolTip::add(lineEdit_, QString("default: ") + parameter_.default_);
    }

    // set current value
    if (!node_.isNull()) {
      QDomElement e = node_.toElement();
      if (!e.isNull() && e.hasAttribute("value")) {
	lineEdit_->setText(e.attribute("value"));
      }
    }

    // set lineEdit to unedited
    lineEdit_->setEdited(false);
  }
  else if (textEdit_ != NULL) {
    QDomElement e = node_.toElement();
    if (!e.isNull()) {
      QDomNodeList l = e.childNodes();
      unsigned int i;
      for (i = 0; i < l.length(); ++i) {
	if (l.item(i).isText()) {
	  QDomText t = l.item(i).toText();
	  textEditText_ = t.data();
	  textEdit_->setPlainText(textEditText_);
	  break;
	}
      }
    }
  }
  else if (typeBox_ != NULL) {
    vector<string> stringvec;
    switch (_type) {

    case SimpleParameter::ENUMERATION:
      // init combo box
      typeBox_->setEditable(FALSE);
      stringvec = fullDef2StringVector(parameter_.fullDefault_);
      for (vector<string>::const_iterator i= stringvec.begin(); i!=stringvec.end(); ++i)
	typeBox_->insertItem(i->c_str());

      // set current value
      if (!node_.isNull()) {
	QDomElement e = node_.toElement();
	if (!e.isNull() && e.hasAttribute("value")) {
	  typeBox_->setCurrentText(e.attribute("value"));
	}
      } else {
	typeBox_->setCurrentText(parameter_.default_);
      }
开发者ID:BackupTheBerlios,项目名称:miro-middleware-svn,代码行数:66,代码来源:SimpleParameterEdit.cpp


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