Exemple #1
0
/*!
* 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;
}
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::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(' ');
}
Exemple #4
0
/*!
* 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 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 << ']';
    }
}