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


C++ QXmlStreamWriter::writeCDATA方法代码示例

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


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

示例1: dumpGPX

void CRouteContainer::dumpGPX( QXmlStreamWriter & _rqXmlStreamWriter, bool bOnlySelected ) const
{
  // GPX format reference: see http://www.topografix.com/GPX/1/1/

  // Data
  _rqXmlStreamWriter.writeStartElement( "rte" );
  // ... name
  if( !qsName.isEmpty() )
  {
    _rqXmlStreamWriter.writeStartElement( "name" );
    _rqXmlStreamWriter.writeCharacters( qsName );
    _rqXmlStreamWriter.writeEndElement(); // name
  }
  // ... type
  if( !qsType.isEmpty() )
  {
    _rqXmlStreamWriter.writeStartElement( "type" );
    _rqXmlStreamWriter.writeCharacters( qsType );
    _rqXmlStreamWriter.writeEndElement(); // type
  }
  // ... description
  if( !qsDescription.isEmpty() )
  {
    _rqXmlStreamWriter.writeStartElement( "desc" );
    _rqXmlStreamWriter.writeCDATA( qsDescription );
    _rqXmlStreamWriter.writeEndElement(); // desc
  }
  // ... comment
  if( !qsComment.isEmpty() )
  {
    _rqXmlStreamWriter.writeStartElement( "cmt" );
    _rqXmlStreamWriter.writeCDATA( qsComment );
    _rqXmlStreamWriter.writeEndElement(); // cmt
  }
  // ... url
  if( !qsUrl.isEmpty() )
  {
    _rqXmlStreamWriter.writeStartElement( "link" );
    _rqXmlStreamWriter.writeAttribute( "href", qsUrl );
    _rqXmlStreamWriter.writeEndElement(); // link
  }
  // ... points
  int __iCount = QTreeWidgetItem::childCount();
  for( int __i = 0; __i < __iCount; __i++ )
  {
    CRoutePoint* __poRoutePoint = (CRoutePoint*)QTreeWidgetItem::child( __i );
    if( bOnlySelected && !__poRoutePoint->isMultiSelected() ) continue;
    __poRoutePoint->dumpGPX( _rqXmlStreamWriter );
  }
  // ... [end]
  _rqXmlStreamWriter.writeEndElement(); // rte
}
开发者ID:alex-spataru,项目名称:qvct,代码行数:52,代码来源:CRouteContainer.cpp

示例2: dumpQVCT

void CVesselContainer::dumpQVCT( QXmlStreamWriter & _rqXmlStreamWriter, bool bOnlySelected ) const
{
  // Data
  _rqXmlStreamWriter.writeStartElement( "Flotilla" );
  // ... name
  if( !qsName.isEmpty() ) _rqXmlStreamWriter.writeAttribute( "name", qsName );
  // ... visibility
  _rqXmlStreamWriter.writeAttribute( "visibility", QString::number( COverlayVisibility::getVisibility() ) );
  // ... type
  if( !qsType.isEmpty() ) _rqXmlStreamWriter.writeAttribute( "type", qsType );
  // ... url
  if( !qsUrl.isEmpty() ) _rqXmlStreamWriter.writeAttribute( "url", qsUrl );
  // ... description
  if( !qsDescription.isEmpty() )
  {
    _rqXmlStreamWriter.writeStartElement( "Description" );
    _rqXmlStreamWriter.writeCDATA( qsDescription );
    _rqXmlStreamWriter.writeEndElement(); // Description
  }
  // ... comment
  if( !qsComment.isEmpty() )
  {
    _rqXmlStreamWriter.writeStartElement( "Comment" );
    _rqXmlStreamWriter.writeCDATA( qsComment );
    _rqXmlStreamWriter.writeEndElement(); // Comment
  }
  // ... points
  if( !bDynamic )
  {
    int __iCount = QTreeWidgetItem::childCount();
    for( int __i = 0; __i < __iCount; __i++ )
    {
      CVesselPoint* __poVesselPoint = (CVesselPoint*)QTreeWidgetItem::child( __i );
      if( bOnlySelected && !__poVesselPoint->isMultiSelected() ) continue;
      __poVesselPoint->dumpQVCT( _rqXmlStreamWriter );
    }
  }
  else
  {
    CVesselContainerDevice* __poVesselContainerDevice = (CVesselContainerDevice*)QTreeWidgetItem::child( 0 );
    __poVesselContainerDevice->dumpQVCT( _rqXmlStreamWriter );
  }
  // ... [end]
  _rqXmlStreamWriter.writeEndElement(); // Flotilla
}
开发者ID:alex-spataru,项目名称:qvct,代码行数:45,代码来源:CVesselContainer.cpp

示例3: dumpQVCT

void CLandmarkPoint::dumpQVCT( QXmlStreamWriter & _rqXmlStreamWriter ) const
{

  // Data
  _rqXmlStreamWriter.writeStartElement( "Point" );
  // ... name
  if( !qsName.isEmpty() ) _rqXmlStreamWriter.writeAttribute( "name", qsName );
  // ... visibility
  _rqXmlStreamWriter.writeAttribute( "visibility", QString::number( COverlayVisibility::getVisibility() ) );
  // ... position
  _rqXmlStreamWriter.writeAttribute( "longitude", QString::number( CDataPosition::getLongitude() ) );
  _rqXmlStreamWriter.writeAttribute( "latitude", QString::number( CDataPosition::getLatitude() ) );
  // ... elevation
  if( CDataPosition::getElevation() != CDataPosition::UNDEFINED_ELEVATION )
    _rqXmlStreamWriter.writeAttribute( "elevation", QString::number( CDataPosition::getElevation() ) );
  // ... type
  if( !qsType.isEmpty() ) _rqXmlStreamWriter.writeAttribute( "type", qsType );
  // ... symbol
  if( !qsSymbol.isEmpty() ) _rqXmlStreamWriter.writeAttribute( "symbol", qsSymbol );
  // ... url
  if( !qsUrl.isEmpty() ) _rqXmlStreamWriter.writeAttribute( "url", qsUrl );
  // ... description
  if( !qsDescription.isEmpty() )
  {
    _rqXmlStreamWriter.writeStartElement( "Description" );
    _rqXmlStreamWriter.writeCDATA( qsDescription );
    _rqXmlStreamWriter.writeEndElement(); // Description
  }
  // ... comment
  if( !qsComment.isEmpty() )
  {
    _rqXmlStreamWriter.writeStartElement( "Comment" );
    _rqXmlStreamWriter.writeCDATA( qsComment );
    _rqXmlStreamWriter.writeEndElement(); // Comment
  }
  // ... [end]
  _rqXmlStreamWriter.writeEndElement(); // Point
}
开发者ID:alex-spataru,项目名称:qvct,代码行数:38,代码来源:CLandmarkPoint.cpp

示例4: exportToXml

bool Deck::exportToXml(QString fileName)
{
    QXmlStreamWriter xml;
    QFile file(fileName);

    file.open(QIODevice::WriteOnly | QIODevice::Text);

    if(!file.isOpen())
        return false;

    xml.setAutoFormatting(true);
    xml.setCodec("UTF-8");

    xml.setDevice(&file);

    xml.writeStartDocument();

    /// --<dana>
    xml.writeStartElement(XML_TAG_ROOT);

    xml.writeStartElement(XML_TAG_VERSION);
    xml.writeCharacters(appVersionToString());
    xml.writeEndElement();

    /// --<deck>
    xml.writeStartElement(XML_TAG_DECK);

    xml.writeStartElement(XML_TAG_NAME);
    xml.writeCharacters(name);
    xml.writeEndElement();

    xml.writeStartElement(XML_TAG_DESC);
    xml.writeCharacters(desc);
    xml.writeEndElement();

    xml.writeStartElement(XML_TAG_ICON);
    xml.writeCharacters("icon.png");
    xml.writeEndElement();

    xml.writeStartElement(XML_TAG_GUID);
    xml.writeCharacters(guid.toString());
    xml.writeEndElement();

    xml.writeStartElement(XML_TAG_CREATED);
    xml.writeCharacters(createdTime.toString());
    xml.writeEndElement();

    xml.writeStartElement(XML_TAG_UPDATED);
    xml.writeCharacters(updatedTime.toString());
    xml.writeEndElement();

    xml.writeStartElement(XML_TAG_AUTHOR);
    xml.writeCharacters(author);
    xml.writeEndElement();

    xml.writeStartElement(XML_TAG_TAGS);
    xml.writeCharacters(tags);
    xml.writeEndElement();

    xml.writeStartElement(XML_TAG_FLAGS);
    xml.writeCharacters(QString::number(flags));
    xml.writeEndElement();

    xml.writeStartElement(XML_TAG_INHAND);
    xml.writeCharacters(QString::number(inhand));
    xml.writeEndElement();

    xml.writeDTD(format.toString());

    xml.writeEndElement();
    /// --</deck>

    /// --<cards>
    xml.writeStartElement(XML_TAG_CARDS);

    Card *card = 0;
    int count = cards.count();
    for(int index = 0; index < count; index++) {
        card = cards.at(index);

        xml.writeStartElement(XML_TAG_CARD);
        // ---------------------------------
        xml.writeStartElement(XML_TAG_FRONT);
        xml.writeCDATA(card->getFront());
        xml.writeEndElement();

        xml.writeStartElement(XML_TAG_BACK);
        xml.writeCDATA(card->getBack());
        xml.writeEndElement();

        xml.writeStartElement(XML_TAG_FLAGS);
        xml.writeCDATA(QString::number(card->getFlags()));
        xml.writeEndElement();

        /*
        xml.writeStartElement("level");
        xml.writeDTD(QString::number(card->getLevel()));
        xml.writeEndElement();
        */
        // ---------------------------------
//.........这里部分代码省略.........
开发者ID:m-o-s-t-a-f-a,项目名称:dana,代码行数:101,代码来源:deck.cpp

示例5: dumpGPX

void CLandmarkPoint::dumpGPX( QXmlStreamWriter & _rqXmlStreamWriter ) const
{
  // GPX format reference: see http://www.topografix.com/GPX/1/1/

  // Data
  _rqXmlStreamWriter.writeStartElement( "wpt" );
  // ... position
  _rqXmlStreamWriter.writeAttribute( "lon", QString::number( CDataPosition::getLongitude() ) );
  _rqXmlStreamWriter.writeAttribute( "lat", QString::number( CDataPosition::getLatitude() ) );
  // ... name
  if( !qsName.isEmpty() )
  {
    _rqXmlStreamWriter.writeStartElement( "name" );
    _rqXmlStreamWriter.writeCharacters( qsName );
    _rqXmlStreamWriter.writeEndElement(); // name
  }
  // ... elevation
  if( CDataPosition::getElevation() != CDataPosition::UNDEFINED_ELEVATION )
  {
    _rqXmlStreamWriter.writeStartElement( "ele" );
    _rqXmlStreamWriter.writeCharacters( QString::number( CDataPosition::getElevation() ) );
    _rqXmlStreamWriter.writeEndElement(); // ele
  }
  // ... type
  if( !qsType.isEmpty() )
  {
    _rqXmlStreamWriter.writeStartElement( "type" );
    _rqXmlStreamWriter.writeCharacters( qsType );
    _rqXmlStreamWriter.writeEndElement(); // type
  }
  // ... description
  if( !qsDescription.isEmpty() )
  {
    _rqXmlStreamWriter.writeStartElement( "desc" );
    _rqXmlStreamWriter.writeCDATA( qsDescription );
    _rqXmlStreamWriter.writeEndElement(); // desc
  }
  // ... comment
  if( !qsComment.isEmpty() )
  {
    _rqXmlStreamWriter.writeStartElement( "cmt" );
    _rqXmlStreamWriter.writeCDATA( qsComment );
    _rqXmlStreamWriter.writeEndElement(); // cmt
  }
  // ... symbol
  if( !qsSymbol.isEmpty() )
  {
    _rqXmlStreamWriter.writeStartElement( "sym" );
    _rqXmlStreamWriter.writeCharacters( qsSymbol );
    _rqXmlStreamWriter.writeEndElement(); // sym
  }
  // ... url
  if( !qsUrl.isEmpty() )
  {
    _rqXmlStreamWriter.writeStartElement( "link" );
    _rqXmlStreamWriter.writeAttribute( "href", qsUrl );
    _rqXmlStreamWriter.writeEndElement(); // link
  }
  // ... [end]
  _rqXmlStreamWriter.writeEndElement(); // wpt
}
开发者ID:alex-spataru,项目名称:qvct,代码行数:61,代码来源:CLandmarkPoint.cpp

示例6: writeXml

void LapTimerThread::writeXml()
{
    QXmlStreamReader xmlReader;
    coordTmpFile.open(QIODevice::ReadOnly | QIODevice::Text);
    xmlReader.setDevice(&coordTmpFile);
    xmlReader.readNext();
    int lapNum=0;
    //Reading from the file
    xmlReader.readNext();
    while (!xmlReader.isEndDocument())
    {
        if (xmlReader.isStartElement())
        {
            QString name = xmlReader.name().toString();
            if (name == "lap")
            {
                lapNum++;
            }

        }
        else if (xmlReader.isEndElement())
        {

        }
        xmlReader.readNext();
    }
    coordTmpFile.close();
    for (int i=0;i<lapNum-1;i++)// loop to generate kml file for each lap
    {

    QFile xmlKmlFile;
    QXmlStreamWriter bufferKml;

    xmlKmlFile.setFileName("data/"+dirName+"/"+dirName+"-"+QString::number(i+1)+".kml");
    xmlKmlFile.open(QIODevice::WriteOnly | QIODevice::Text);
    bufferKml.setDevice(&xmlKmlFile);
    bufferKml.setAutoFormatting(true);
    bufferKml.writeStartDocument();

    bufferKml.writeStartElement("kml");
    QXmlStreamAttributes atrr;
    atrr.append("xmlns","http://www.opengis.net/kml/2.2");
    atrr.append("xmlns:gx","http://www.google.com/kml/ext/2.2");
    atrr.append("xmlns:atom","http://www.w3.org/2005/Atom");
    bufferKml.writeAttributes(atrr);
    bufferKml.writeStartElement("Document");
    bufferKml.writeTextElement("open","1");
    bufferKml.writeTextElement("visibility","1");
    bufferKml.writeStartElement("name");
    bufferKml.writeCDATA("GPS Lap Timer - KML Log - "+QDate::currentDate().toString("yyyyMMdd")+QTime::currentTime().toString("hhmmss"));
    bufferKml.writeEndElement();
    //style - track
    bufferKml.writeStartElement("Style");
    bufferKml.writeAttribute(QXmlStreamAttribute("id","track"));
    bufferKml.writeStartElement("LineStyle");
    bufferKml.writeTextElement("color","7f0000ff");
    bufferKml.writeTextElement("width","4");
    bufferKml.writeEndElement();
    bufferKml.writeStartElement("IconStyle");
    bufferKml.writeTextElement("scale","1.3");
    bufferKml.writeStartElement("Icon");
    bufferKml.writeTextElement("href","http://earth.google.com/images/kml-icons/track-directional/track-0.png");
    bufferKml.writeEndElement();
    bufferKml.writeEndElement();
    bufferKml.writeEndElement();
    //style - start
    bufferKml.writeStartElement("Style");
    bufferKml.writeAttribute(QXmlStreamAttribute("id","start"));
    bufferKml.writeStartElement("IconStyle");
    bufferKml.writeTextElement("scale","1.3");
    bufferKml.writeStartElement("Icon");
    bufferKml.writeTextElement("href","http://maps.google.com/mapfiles/kml/paddle/grn-circle.png");
    bufferKml.writeEndElement();
    bufferKml.writeEmptyElement("hotSpot");
    atrr.clear();
    atrr.append("x","32");
    atrr.append("y","1");
    atrr.append("xunits","pixels");
    atrr.append("yunits","pixels");
    bufferKml.writeAttributes(atrr);
    bufferKml.writeEndElement();
    bufferKml.writeEndElement();
    // style - end
    bufferKml.writeStartElement("Style");
    bufferKml.writeAttribute(QXmlStreamAttribute("id","end"));
    bufferKml.writeStartElement("IconStyle");
    bufferKml.writeTextElement("scale","1.3");
    bufferKml.writeStartElement("Icon");
    bufferKml.writeTextElement("href","http://maps.google.com/mapfiles/kml/paddle/red-circle.png");
    bufferKml.writeEndElement();
    bufferKml.writeEmptyElement("hotSpot");
    bufferKml.writeAttributes(atrr);
    bufferKml.writeEndElement();
    bufferKml.writeEndElement();
    // style - statistics
    bufferKml.writeStartElement("Style");
    bufferKml.writeAttribute(QXmlStreamAttribute("id","statistics"));
    bufferKml.writeStartElement("IconStyle");
    bufferKml.writeTextElement("scale","1.3");
    bufferKml.writeStartElement("Icon");
//.........这里部分代码省略.........
开发者ID:qhr1993,项目名称:GPSLapTimer,代码行数:101,代码来源:laptimerthread.cpp


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