void QPlaceContentReplyImpl::replyFinished() { if (m_reply->isOpen()) { QJsonDocument document = QJsonDocument::fromJson(m_reply->readAll()); if (!document.isObject()) { setError(ParseError, QCoreApplication::translate(NOKIA_PLUGIN_CONTEXT_NAME, PARSE_ERROR)); return; } QJsonObject object = document.object(); QPlaceContent::Collection collection; int totalCount; QPlaceContentRequest previous; QPlaceContentRequest next; parseCollection(request().contentType(), object, &collection, &totalCount, &previous, &next, m_engine); setTotalCount(totalCount); setContent(collection); setPreviousPageRequest(previous); setNextPageRequest(next); } m_reply->deleteLater(); m_reply = 0; setFinished(true); emit finished(); }
SgfCollection * Parser::parseFile(const QString & infile) { QFile game_file(infile); if (game_file.open(QIODevice::ReadOnly | QIODevice::Text)) { return parseCollection(game_file); /* char c; while (!game_file.atEnd()) { game_file.getChar(&c); std::cout << c; game_file.ungetChar(c); game_file.getChar(&c); std::cout << c; } std::cout << std::endl;*/ } else { // throw exception("Unable to read file"); } return new SgfCollection(); }
// ------------------------------------------------------------------------------- CInformationCollection* XMLPersister::createInformationCollection( QDomDocument& doc ) // ------------------------------------------------------------------------------- { // create the collection CInformationCollection* collection = new CInformationCollection(); CTreeInformationElement* e = new CTreeInformationElement(); collection->registerAsListenerOf( e ); if ( !doc.documentElement().isNull() ) { QDomElement* pDomElem = parseCollection(collection, doc.documentElement() ); if ( NULLPTR != pDomElem ) { parseElementAttributes(*pDomElem, *e); parseChildrenOf(*pDomElem, *e); } } collection->setRootElement( e ); return collection; }