/*! * Rem: "field001size" is field size including Terminator (FT) * Writes the recId and the FT (Field Terminator) * Returns pointer to first Byte after leader ***************************************************************************** */ void ISO8211::write0001fieldASC(QTextStream & iso8211strm, unsigned int iso8211rcid, unsigned int field001size) { iso8211strm.setFieldWidth(field001size -1); iso8211strm.setPadChar(QChar('0')); iso8211strm << iso8211rcid; iso8211strm.setFieldWidth(0); iso8211strm.setPadChar(QChar(' ')); iso8211strm << ISO8211::FT; }
static void printOptions(QTextStream& s, const QMap<QString, QString>& options) { QMap<QString, QString>::const_iterator it = options.constBegin(); s.setFieldAlignment(QTextStream::AlignLeft); for (; it != options.constEnd(); ++it) { s << " --"; s.setFieldWidth(38); s << it.key() << it.value(); s.setFieldWidth(0); s << endl; } }
void ConsoleOutput::startComment(QTextStream &out,AnsiColor color){ out.setFieldWidth(indent); out.setFieldAlignment(QTextStream::AlignRight); out << " "; out.setFieldWidth(0); #ifndef _WIN32 out << "\033[0;" << color << "m"; #endif out.setFieldAlignment(QTextStream::AlignLeft); out.setFieldWidth(20); out.setPadChar(' '); }
void QWSHexDump::hexDump() { *outstrm << '(' << dataSize << " bytes):\n" << prefix; sprintf(sideviewLayout, " [%%-%us]", wrap); dataWidth = (2 * wrap) + (wrap / clustering); dirty = false; uint wrapIndex = 0; for (uint i = 0; i < dataSize; i++) { uint c = static_cast<uchar>(data[i]); sideview[wrapIndex = i%wrap] = isprint(c) ? c : '.'; if (wrapIndex && (wrapIndex % clustering == 0)) *outstrm << ' '; outstrm->setFieldWidth(2); outstrm->setPadChar('0'); outstrm->setNumberFlags( QTextStream::ShowBase ); *outstrm << hex << c; dirty = true; if (wrapIndex == wrap-1) { sideviewDump(wrapIndex); wrapIndex = 0; if (i+1 < dataSize) *outstrm << endl << prefix; } } sideviewDump(wrapIndex); }
void ConsoleOutput::endComment(QTextStream &out){ out.setFieldWidth(1); #ifndef _WIN32 out << "\033[0m" ; #endif out << endl; }
// Write data + helpers void FormattedTouchstone::WriteData(FormattedNetworkData &network, QTextStream &snpFile) { // Choose data format GetWriteFormat(network); snpFile.setRealNumberPrecision(PRECISION); for (uint currentFreq = 0; currentFreq < network.points(); currentFreq++) { snpFile.setFieldAlignment(QTextStream::AlignLeft); snpFile.setFieldWidth(COLUMNWIDTH); snpFile << network.x()[currentFreq]; FormattedComplexMatrix2D::iterator row_iter = network.y()[currentFreq].begin(); WriteRow(network, snpFile, *row_iter); row_iter++; for (; row_iter != network.y()[currentFreq].end(); row_iter++) { snpFile.setFieldAlignment(QTextStream::AlignLeft); snpFile.setFieldWidth(COLUMNWIDTH); snpFile << " "; // tab past frequency column for subsequent rows WriteRow(network, snpFile, *row_iter); } } }
/*! * Write the direcory of a S-57 Catalog-Entry to TextStream * A Catalog-Record-Dir has only 2 entries: "0001" and "CADT" ***************************************************************************** */ void ISO8211::writeRecDir4CatS57(QTextStream & iso8211strm, unsigned int recLen0001, unsigned int recLenCATD, unsigned int sizeofFLenF, unsigned int sizeofFPosF) { //** "0001" entry ** iso8211strm.setPadChar(QChar('0')); iso8211strm << "0001"; iso8211strm.setFieldWidth(sizeofFLenF); iso8211strm << recLen0001; iso8211strm.setFieldWidth(sizeofFPosF); iso8211strm << 0; //** CATD entry ** iso8211strm << "CATD"; iso8211strm.setFieldWidth(sizeofFLenF); iso8211strm << recLenCATD; iso8211strm.setFieldWidth(sizeofFPosF); iso8211strm << recLen0001; //the record length of "0001" field is at the same time the start-pos. of CATD field iso8211strm.setFieldWidth(0); iso8211strm.setPadChar(QChar(' ')); iso8211strm << FT; }
void FormattedTouchstone::WriteRow(FormattedNetworkData &network, QTextStream &snpFile, FormattedComplexRowVector &row) { uint columnsWritten = 1; uint const COLUMNSPERLINE = 4; FormattedComplexRowVector::iterator column_iter = row.begin(); for (; column_iter != row.end(); column_iter++) { (*WriteDatum)(snpFile, *column_iter); // add delimiter if (columnsWritten == network.numberOfPorts()) { snpFile.setFieldWidth(0); snpFile << endl; snpFile.setFieldWidth(COLUMNWIDTH); } else if (columnsWritten % COLUMNSPERLINE == 0) { snpFile.setFieldWidth(0); snpFile << endl; snpFile.setFieldAlignment(QTextStream::AlignLeft); snpFile.setFieldWidth(COLUMNWIDTH); snpFile << " "; } columnsWritten++; } }
void QWSHexDump::sideviewDump(int at) { if (dirty) { dirty = false; ++at; sideview[at] = '\0'; int currentWidth = (2 * at) + (at / clustering) - (at%clustering?0:1); int missing = qMax(dataWidth - currentWidth, 0); while (missing--) *outstrm << ' '; *outstrm << " ["; outstrm->setPadChar(' '); outstrm->setFieldWidth(wrap); outstrm->setFieldAlignment( QTextStream::AlignLeft ); *outstrm << sideview; *outstrm << ']'; } }
void FormattedTouchstone::WriteDB(QTextStream &snpFile, FormattedComplex &datum) { snpFile.setFieldAlignment(QTextStream::AlignLeft); snpFile.setFieldWidth(COLUMNWIDTH); snpFile << datum.dB(); snpFile << datum.angle_deg(); }
void FormattedTouchstone::WriteRI(QTextStream &snpFile, FormattedComplex &datum) { snpFile.setFieldAlignment(QTextStream::AlignLeft); snpFile.setFieldWidth(COLUMNWIDTH); snpFile << datum.real(); snpFile << datum.imaginary(); }