int main() { init(); initSentence( "the man washed the blue car" ); parseSentence(); emitFrame(); destroySentence(); initSentence( "a dog chased a dirty cat" ); parseSentence(); emitFrame(); destroySentence(); return 0; }
void V4LFrameSource::run() { RecursiveMutexLock runningLock(m_runningMutex); int64_t frameTS = -1; int64_t lastFrameTS = -1; while (m_isRunning) { runningLock.unlock(); try { FramePtr frame(new Frame()); readFrame(frame.get()); frameTS = frame->getTimestamp(); { RecursiveMutexLock framePtrLock(m_framePtrMutex); m_lastFrame = frame; } emitFrame(frame); lastFrameTS = frameTS; } catch (EOFException e) { break; } catch (IOException e) { std::cout << "ERROR: " << e.what() << std::endl; } runningLock.lock(); } }
void HtmlExporter::emitFrame( QTextFrame::Iterator frameIt ) { // kDebug() << "html" << html; if ( !frameIt.atEnd() ) { QTextFrame::Iterator next = frameIt; ++next; if ( next.atEnd() && frameIt.currentFrame() == 0 && frameIt.parentFrame() != doc->rootFrame() && frameIt.currentBlock().begin().atEnd() ) { return; } } for ( QTextFrame::Iterator it = frameIt; !it.atEnd(); ++it ) {; if ( QTextFrame *f = it.currentFrame() ) { // qDebug() << "Its a frame, not a block" << endl; if ( QTextTable * table = qobject_cast<QTextTable *>( f ) ) { emitTable( table ); } else { // qDebug() << "isn't table" << endl; html += QLatin1String( "\n<table" ); QTextFrameFormat format = f->frameFormat(); if ( format.hasProperty( QTextFormat::FrameBorder ) ) { emitAttribute( "border", QString::number( format.border() ) ); } html += QLatin1String( " style=\"-qt-table-type: frame;" ); emitFloatStyle( format.position(), OmitStyleTag ); if ( format.hasProperty( QTextFormat::FrameMargin ) ) { const QString margin = QString::number( format.margin() ); emitMargins( margin, margin, margin, margin ); } html += QLatin1Char( '\"' ); emitTextLength( "width", format.width() ); emitTextLength( "height", format.height() ); QBrush bg = format.background(); if ( bg != Qt::NoBrush ) { emitAttribute( "bgcolor", bg.color().name() ); } html += QLatin1Char( '>' ); html += QLatin1String( "\n<tr>\n<td style=\"border: none;\">" ); emitFrame( f->begin() ); html += QLatin1String( "</td></tr></table>" ); } } else if ( it.currentBlock().isValid() ) { // qDebug()<< "is valid" << endl; emitBlock( it.currentBlock() ); } } }
VPlayer::VPlayer(QObject *parent) : QObject(parent) { vlc=libvlc_new(0,NULL); m=NULL; mp=NULL; swsctx=NULL; state=Stop; valid=false; ratio=0; connect(this,SIGNAL(rendered(QImage)),this,SLOT(emitFrame(QImage))); }
void V4LFrameSource::reemitFrame() { if (!m_isOpen) return; FramePtr ptr; { RecursiveMutexLock lock(m_framePtrMutex); ptr = m_lastFrame; } if (ptr != NULL) emitFrame(ptr); }
void CGModule::emitModule(){ CGSymFinder vis(this); size_t k; for( k=0;k<frames.size();++k ){ CGFrame *f=frames[k]; CGSym *sym=f->fun->sym; if( sym->linkage==CG_EXPORT ) exportSyms.insert( sym->value ); CGAsm *as; for( as=f->assem.begin;as!=f->assem.end;as=as->succ ){ CGStm *t=as->stm; if( !t ) continue; t->visit( vis ); } } set<string>::iterator sym_it; //header emitHeader(); //imports for( sym_it=importSyms.begin();sym_it!=importSyms.end();++sym_it ){ emitImport( *sym_it ); } //exports for( sym_it=exportSyms.begin();sym_it!=exportSyms.end();++sym_it ){ emitExport( *sym_it ); } //frames for( k=0;k<frames.size();++k ){ emitFrame( frames[k] ); } //datas for( k=0;k<datas.size();++k ){ emitData( datas[k] ); } //footer emitFooter(); out.flush(); }
QString HtmlExporter::toHtml( const QTextDocument* document ) { //kDebug(); if ( document->isEmpty() ) { return html; } doc = document; // kDebug() << doc->blockCount() << endl; //const QFont defaultFont = doc->defaultFont(); //defaultCharFormat.setFont(defaultFont); emitFrame( doc->rootFrame()->begin() ); // emitBlock(doc->rootFrame()->begin().currentBlock()); //sanitizeHtml(); html.replace( QRegExp( "<br[\\s]*/>" ), "<br />\n" ); if ( html.endsWith( ">\n" ) ) { html.remove( html.length() - 1, 1 ); } return html; }
void CanReceiverFilter::processMessage(CanFrame frame) { foreach (auto receiver, receivers.values(frame.getId())) receiver->emitFrame(frame); }
void HtmlExporter::emitTable( const QTextTable *table ) { //qDebug() << "emitTable" << html; QTextTableFormat format = table->format(); html += QLatin1String( "\n<table" ); if ( format.hasProperty( QTextFormat::FrameBorder ) ) { emitAttribute( "border", QString::number( format.border() ) ); } emitFloatStyle( format.position() ); emitAlignment( format.alignment() ); emitTextLength( "width", format.width() ); if ( format.hasProperty( QTextFormat::TableCellSpacing ) ) { emitAttribute( "cellspacing", QString::number( format.cellSpacing() ) ); } if ( format.hasProperty( QTextFormat::TableCellPadding ) ) { emitAttribute( "cellpadding", QString::number( format.cellPadding() ) ); } QBrush bg = format.background(); if ( bg != Qt::NoBrush ) { emitAttribute( "bgcolor", bg.color().name() ); } html += QLatin1Char( '>' ); const int rows = table->rows(); const int columns = table->columns(); QVector<QTextLength> columnWidths = format.columnWidthConstraints(); if ( columnWidths.isEmpty() ) { columnWidths.resize( columns ); columnWidths.fill( QTextLength() ); } // Q_ASSERT(columnWidths.count() == columns); QVarLengthArray<bool> widthEmittedForColumn( columns ); for ( int i = 0; i < columns; ++i ) { widthEmittedForColumn[i] = false; } const int headerRowCount = qMin( format.headerRowCount(), rows ); if ( headerRowCount > 0 ) { html += QLatin1String( "<thead>" ); } for ( int row = 0; row < rows; ++row ) { html += QLatin1String( "\n<tr>" ); for ( int col = 0; col < columns; ++col ) { const QTextTableCell cell = table->cellAt( row, col ); // for col/rowspans if ( cell.row() != row ) { continue; } if ( cell.column() != col ) { continue; } html += QLatin1String( "\n<td" ); if ( !widthEmittedForColumn[col] ) { emitTextLength( "width", columnWidths.at( col ) ); widthEmittedForColumn[col] = true; } if ( cell.columnSpan() > 1 ) { emitAttribute( "colspan", QString::number( cell.columnSpan() ) ); } if ( cell.rowSpan() > 1 ) { emitAttribute( "rowspan", QString::number( cell.rowSpan() ) ); } const QTextCharFormat cellFormat = cell.format(); QBrush bg = cellFormat.background(); if ( bg != Qt::NoBrush ) { emitAttribute( "bgcolor", bg.color().name() ); } html += QLatin1Char( '>' ); emitFrame( cell.begin() ); html += QLatin1String( "</td>" ); } html += QLatin1String( "</tr>" ); if ( headerRowCount > 0 && row == headerRowCount - 1 ) { html += QLatin1String( "</thead>" ); } } html += QLatin1String( "</table>" ); }