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


C++ QXmlInputSource::setData方法代码示例

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


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

示例1: insertFragmentorFile

/* Append fragment or a real xml file QXmlInputSource source; */
QDomElement UnionXml::insertFragmentorFile(const QString fragment) {

    bool check;
    /* if is a file insert dom tree and convert to element */
    if (is_file(fragment)) {
        QFile ext_file(fragment);
        ext_file.open(QIODevice::ReadOnly);
        QXmlInputSource sxml;
        sxml.setData(ext_file.readAll());
        QDomElement eimport = fromdevice(sxml);
        ext_file.close();
        return eimport;
    } else {
        /* is not a file */
        /// make buffer null clear
        QXmlInputSource fxml;
        /// setBuffer setData
        const QString heads = fragment.mid(0, 100);
        if (heads.contains("encoding") || heads.contains("?xml")) {
            fxml.setData(fragment);
        } else {
            QString dd = QString("<?xml version=\"1.0\"?>\n<dummyroot>%1</dummyroot>").arg(fragment);
            fxml.setData(dd);
        }
        return fromdevice(fxml);
    }
}
开发者ID:FranciscoJavierPRamos,项目名称:wv2qt,代码行数:28,代码来源:fox_base.cpp

示例2: parse

bool VOCatalogDataParser::parse(const QByteArray &data, QList<VOCatalogHeader> &catalogs, QList<VOCooSys> &cooSys, QList<QStringList> &dataOut)
{
  QXmlInputSource   xmlInputStream;
  QXmlSimpleReader  xml;

  if (data.isEmpty())
  {
    return false;
  }

  xmlInputStream.setData(data);

  xml.setContentHandler(this);
  xml.setErrorHandler(this);

  if (xml.parse(&xmlInputStream))
  {
    catalogs = m_list;
    cooSys = m_cooSys;
    dataOut = m_data;
    return true;
  }

  return false;
}
开发者ID:PavelMr,项目名称:skytechx,代码行数:25,代码来源:vocatalogdataparser.cpp

示例3: ReadSensors

int CRobLink::ReadSensors()
{
    char xml[4096];
    int n = port.recv_info(xml, 4096);
    if (n == -1) return n;

    //cerr << "ReadSensors: " << "\"" << xml << "\"";
    
    /* set source of xml document */
    QXmlInputSource source;
    source.setData(QString(xml));

    /* set parser handler */
    StructureParser handler(simParam.nBeacons);

    //cerr << "ReadSensors: nBeacons=" << simParam.nBeacons << "\n";

    /* parse xml document with handler */
    QXmlSimpleReader reader;
    reader.setContentHandler(&handler);
    reader.parse(source);

    ///////////////////////////////////////////////////
    measures = *(handler.getMeasures());  
    //measures.showValues();
    ///////////////////////////////////////////////////
    
//    for(unsigned int i=0; i<5;i++)
//       if (measures.hearMessage[i]!=QString())
//           printf("ReadSensors: Message From %d: \"%s\"\n", i, measures.hearMessage[i].latin1());

    return n;
}
开发者ID:CiberRato,项目名称:pei2015-ciberrato,代码行数:33,代码来源:croblink.cpp

示例4: parseStyleFile

bool StyleParser::parseStyleFile()
{
  QXmlSimpleReader reader;

  QXmlInputSource source;
  source.setData( mDocument->styles() );

  QString errorMsg;
  int errorLine, errorCol;

  QDomDocument document;
  if ( !document.setContent( &source, &reader, &errorMsg, &errorLine, &errorCol ) ) {
    qDebug( "%s at (%d,%d)", qPrintable( errorMsg ), errorLine, errorCol );
    return false;
  }

  const QDomElement documentElement = document.documentElement();
  QDomElement element = documentElement.firstChildElement();
  while ( !element.isNull() ) {
    if ( element.tagName() == QLatin1String( "styles" ) ) {
      if ( !parseAutomaticStyles( element ) )
        return false;
    } else if ( element.tagName() == QLatin1String( "automatic-styles" ) ) {
      if ( !parseAutomaticStyles( element ) )
        return false;
    } else if ( element.tagName() == QLatin1String( "master-styles" ) ) {
      if ( !parseMasterStyles( element ) )
        return false;
    }

    element = element.nextSiblingElement();
  }

  return true;
}
开发者ID:Eidolian,项目名称:qt-gmail-access,代码行数:35,代码来源:styleparser.cpp

示例5: parse_server_reply

/*!
 * Waits for server reply and parses status, simulation parameters and
 * assigns the new UDP port to this robot.
 */
void CRobLink::parse_server_reply(void)
{
    // get reply confirming or denying registration 
    char xml[MSGMAXSIZE];
    int recv_ret = port.recv_info(xml, MSGMAXSIZE);
    if(recv_ret == -1)
    {
        cerr << "Failed Init confirmation" << recv_ret << endl;
        Status = -1;
        return;
    }
    //cerr << "XML=\"" << xml <<"\"\nXMLEND\n";

    /* set source of xml document */
    QXmlInputSource source;
    source.setData(QString(xml));

    /* set parser handler */
    StructureParser handler(simParam.nBeacons);

    /* parse xml document with handler */
    QXmlSimpleReader reader;
    reader.setContentHandler(&handler);
    if( !reader.parse(source) ) {
       Status=-1;
       return;
    }


    simParam = *(handler.getSimParam());
    simParam.showValues();

    port.SetRemote(port.GetLastSender());
}
开发者ID:CiberRato,项目名称:pei2015-ciberrato,代码行数:38,代码来源:croblink.cpp

示例6: parseInfoText

void PatternParser::parseInfoText(QStringList& text,
        const QString& artist, const QString& title,
        const QString& date, const QString& genre,
        const quint32 discid, const qreal size, const int length, const int nooftracks) {

  SaxHandler handler;
  handler.setArtist(artist);
  handler.setTitle(title);
  handler.setDate(date);
  handler.setGenre(genre);
  handler.setDiscid(discid);
  handler.setSize(size);
  handler.setLength(length);
  handler.setNoOfTracks(nooftracks);
  handler.set2DigitsTrackNum(false);

  QXmlInputSource inputSource;
  inputSource.setData("<textpattern>"+p_xmlize_pattern(text.join("\n"))+"</textpattern>");
  QXmlSimpleReader reader;
  reader.setContentHandler(&handler);
  reader.setErrorHandler(&handler);
  reader.parse(inputSource);

  text = handler.text().split('\n');

}
开发者ID:berniyh,项目名称:audex,代码行数:26,代码来源:patternparser.cpp

示例7: parseSimplePattern

const QString PatternParser::parseSimplePattern(const QString& pattern,
        int cdno, const int nooftracks,
        const QString& artist, const QString& title,
        const QString& date, const QString& genre, const QString& suffix,
        bool fat32compatible) {

  SaxHandler handler;
  handler.setCDNo(cdno);
  handler.setNoOfTracks(nooftracks);
  handler.setArtist(artist);
  handler.setTitle(title);
  handler.setDate(date);
  handler.setGenre(genre);
  handler.setSuffix(suffix);
  handler.setFAT32Compatible(fat32compatible);
  handler.setReplaceSpacesWithUnderscores(false);
  handler.set2DigitsTrackNum(false);

  QXmlInputSource inputSource;
  inputSource.setData("<simplepattern>"+p_xmlize_pattern(pattern)+"</simplepattern>");
  QXmlSimpleReader reader;
  reader.setContentHandler(&handler);
  reader.setErrorHandler(&handler);
  reader.parse(inputSource);

  return handler.text();

}
开发者ID:berniyh,项目名称:audex,代码行数:28,代码来源:patternparser.cpp

示例8: parseFilenamePattern

const QString PatternParser::parseFilenamePattern(const QString& pattern,
        int trackno, int cdno, int trackoffset, int nooftracks,
        const QString& artist, const QString& title,
        const QString& tartist, const QString& ttitle,
        const QString& date, const QString& genre, const QString& suffix,
        bool fat32compatible, bool replacespaceswithunderscores, bool _2digitstracknum) {

  SaxHandler handler;
  handler.setTrackNo(trackno);
  handler.setCDNo(cdno);
  handler.setTrackOffset(trackoffset);
  handler.setNoOfTracks(nooftracks);
  handler.setArtist(artist);
  handler.setTitle(title);
  handler.setTrackArtist(tartist);
  handler.setTrackTitle(ttitle);
  handler.setDate(date);
  handler.setGenre(genre);
  handler.setSuffix(suffix);
  handler.setFAT32Compatible(fat32compatible);
  handler.setReplaceSpacesWithUnderscores(replacespaceswithunderscores);
  handler.set2DigitsTrackNum(_2digitstracknum);

  QXmlInputSource inputSource;
  inputSource.setData("<filenamepattern>"+p_xmlize_pattern(pattern)+"</filenamepattern>");
  QXmlSimpleReader reader;
  reader.setContentHandler(&handler);
  reader.setErrorHandler(&handler);
  reader.parse(inputSource);

  return handler.text();

}
开发者ID:berniyh,项目名称:audex,代码行数:33,代码来源:patternparser.cpp

示例9: applyTheme

bool ThemeManager::applyTheme(const ThemeDocument &kd)
{
    // tDebug() << "Applying theme" << endl;

    bool ok = false;
    QXmlSimpleReader reader;
    reader.setContentHandler(this);
    reader.setErrorHandler(this);
    QXmlInputSource xmlsource;
    xmlsource.setData(kd.toString());

    if (reader.parse(&xmlsource)) {
        ok = true;
    } else {
        #ifdef K_DEBUG
            QString msg = "ThemeManager::applyTheme() - Fatal Error: Can't process theme document";
            #ifdef Q_OS_WIN
                qDebug() << msg;
            #else
                tError() << msg;
            #endif
        #endif

        ok = false;
    }
    
    return ok;
}
开发者ID:bedna-KU,项目名称:tupi,代码行数:28,代码来源:thememanager.cpp

示例10: setDefaultParameters

void cbSimulator::setDefaultParameters(void)
{
	QXmlInputSource *source;

	source = new QXmlInputSource;
    source->setData(QByteArray(SIMPARAM));

    QXmlSimpleReader xmlParser;

	cbParamHandler *paramHandler = new cbParamHandler(param);
	xmlParser.setContentHandler(paramHandler);

    cbParameters *param;
    if(xmlParser.parse(*source))
        param = paramHandler->parsedParameters();
	else {
        cerr << "Error parsing DEFAULT parameters\n";
        gui->appendMessage(QString("Error parsing DEFAULT parameters"), true);
		assert(0);
	}

    setParameters(param);
	delete paramHandler;
	delete source;

	//cout << " done.\n";
}
开发者ID:bluemoon93,项目名称:CiberMouse,代码行数:27,代码来源:cbsimulator.cpp

示例11: setDefaultGrid

void cbSimulator::setDefaultGrid(void)
{
	QXmlInputSource *source;

    source = new QXmlInputSource;
        source->setData(QByteArray(GRID));

        QXmlSimpleReader xmlParser;

	cbGridHandler *gridHandler = new cbGridHandler;
	xmlParser.setContentHandler(gridHandler);

    cbGrid *grid;
	if(xmlParser.parse(*source))
        grid = gridHandler->parsedGrid();
	else {
        cerr << "Error parsing DEFAULT grid\n";
        gui->appendMessage(QString("Error parsing DEFAULT grid"), true);
		assert(0);
	}

    setGrid(grid);
	delete gridHandler;
	delete source;

	//rebuild graph
	if(lab!=0) {
        buildGraph();
        setDistMaxFromGridToTarget();
	}

    // update parameters
    //param->gridFilename = "";
}
开发者ID:bluemoon93,项目名称:CiberMouse,代码行数:34,代码来源:cbsimulator.cpp

示例12: processReadData

void RemoteController::processReadData(const QByteArray &data) {
	QXmlSimpleReader reader;
	RemoteController::XmlHandler *xmlHandler = new RemoteController::XmlHandler();

	reader.setContentHandler(xmlHandler);
	QXmlInputSource buffer;
	buffer.setData(data);
	reader.parse(&buffer);

	isStarted = xmlHandler->my_started;
	isGameOver = xmlHandler->my_gameover;

	if (isStarted == 1) {
		myLeftBtn->setEnabled(true);
		myRightBtn->setEnabled(true);
		myStartBtn->setEnabled(false);
	}
	if (isGameOver == 1) {
		myLeftBtn->setEnabled(false);
		myRightBtn->setEnabled(false);
		--myLostBalls;
		if (myLostBalls > 0) {
			myLostBallsLbl->setText(QString::number(myLostBalls));
			myStartBtn->setEnabled(true);
		} else {
			myLostBallsLbl->setText("The game is over :(");
			myStartBtn->setEnabled(false);
		}
	}
}
开发者ID:bondarevts,项目名称:amse-qt,代码行数:30,代码来源:RemoteController.cpp

示例13: setParameters

bool CTConfToyRing::setParameters(QString xml)
{
//    qDebug() << xml;

    int num_stimuli = NUM_LIGHTS + NUM_SPEAKERS;
    int num_actions = NUM_LIGHTS + NUM_SPEAKERS;

    QXmlSimpleReader xmlReader;
    QXmlInputSource *source = new QXmlInputSource();
    source->setData(xml);

    CTXmlHandler *handler = new CTXmlHandler;
    /*
     *Passing pointer of the class to the xml parser handler,
     *in order to set the parsed values into it's input fields
     */
    handler->setWidget(2, this, num_stimuli, num_actions);
    QList<CTLight*> empty1;
    QList<CTScreen*> empty2;
    QList<CTBigLight*> empty3;
    QList<CTButton*> empty4;
    handler->setStimuli(light_stimuli, speaker_stimuli, empty1, empty2,empty3,empty4);
    handler->setActions(light_actions, speaker_actions, empty2,empty3,empty4, empty1);
    xmlReader.setContentHandler(handler);
    xmlReader.setErrorHandler(handler);

    bool ok = xmlReader.parse(source);
    qDebug() << "The parsing went ok? " << ok;
    block_duration = handler->getBlockDuration();
    if(ok)
    {
        updateBlockRuntime(1.0);
    }
    return true;
}
开发者ID:luizamici,项目名称:caretoy,代码行数:35,代码来源:ct_conftoyring.cpp

示例14: mtableNode

/// converting <mtable> ... </mtable>
void CMathMLToTeX::mtableNode(QString &text)
{
  int sumCols = 0;

  if (text.contains("<mtr>"))
    {
      int posA = text.indexOf("<mtr>");
      int posB = text.indexOf("</mtr>");
      QString mtrText = text.mid(posA, posB - posA + 6);

      sumCols = mtrText.count("<mtd");
    }

  CStructureParser xmlParser(sumCols);
  QXmlSimpleReader xmlReader;

  xmlReader.setContentHandler(&xmlParser);

  QXmlInputSource xmlSource;
  xmlSource.setData(text);

  xmlReader.parse(xmlSource);

  text = xmlParser.getTeX();
}
开发者ID:mgaldzic,项目名称:copasi_api,代码行数:26,代码来源:CMathMLToTeX.cpp

示例15: updateStats

void StatCrewScanner::updateStats(QNetworkReply * reply) {
//    QFile file(statFile);
    QXmlSimpleReader r;
    r.setContentHandler(statCrew);
    r.setErrorHandler(statCrew);
    QXmlInputSource src;
    src.setData(reply->readAll());
    r.parse(src);
}
开发者ID:db4soundman,项目名称:HockeyQt,代码行数:9,代码来源:StatCrewScanner.cpp


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