void unwindMePlease() { withUnwindProtect signalWarning(); onUnwind fprintf(stderr, "It's good just to unwind sometimes.\n"); endUnwind; }
void Parser::parse() { bool stop( false ); while(!m_xml->atEnd() && !stop) { QXmlStreamReader::TokenType token = m_xml->readNext(); if ( token == QXmlStreamReader::StartElement ) { if( m_xml->name()=="MSG_Notification" ) { MSG_Notification obj( *m_xml ); if ( m_xml->name() != "MSG_Notification" ) m_xml->raiseError( "tag mismatch MSG_Notification" ); else { emit signalMSG_Notification( obj ); stop = true; } } } } if ( m_xml->hasError() ) { switch ( m_xml->error() ) { case QXmlStreamReader::CustomError: emit( signalValidationError( composeMessage( *m_xml ) ) ); break; case QXmlStreamReader::PrematureEndOfDocumentError: emit( signalWarning( composeMessage( *m_xml ) ) ); break; case QXmlStreamReader::NotWellFormedError: case QXmlStreamReader::UnexpectedElementError: emit( signalError( composeMessage( *m_xml ) ) ); break; case QXmlStreamReader::NoError: break; } } }
testqt::testqt( int & argc, char ** argv ) :QCoreApplication(argc, argv, false) { // connect to the events from the parser connect( &m_parser, SIGNAL( signalMSG_IVEF(ivef::MSG_IVEF)), this, SLOT( slotMSG_IVEF(ivef::MSG_IVEF) )); // Issue 24 connect( &m_parser, SIGNAL( signalError(QString)), this, SLOT( slotPrintError(QString) )); connect( &m_parser, SIGNAL( signalWarning(QString)), this, SLOT( slotPrintError(QString) )); connect( &m_parser, SIGNAL( signalValidationError(QString)), this, SLOT( slotPrintError(QString) )); // End Issue 24 // and keep reading from standard in std::cout << "TestApp ready for input" << std::endl; std::string input_line; while(!std::cin.fail()) { getline(std::cin, input_line); input_line += "\n"; // getline eats the new line //std::cout << input_line << std::endl; m_parser.parseXMLString(QString(input_line.c_str()), true); }; std::cout << "TestApp shutting down" << std::endl; // QCoreApplication::exit(0); }