Logo Search packages:      
Sourcecode: inkscape version File versions

void Inkscape::IO::Base64OutputStream::close (  )  [virtual]

Closes this output stream and releases any system resources associated with this stream.

Reimplemented from Inkscape::IO::BasicOutputStream.

Definition at line 196 of file base64stream.cpp.

References Inkscape::IO::OutputStream::close(), Inkscape::IO::OutputStream::put(), and putc().

{
    if (closed)
        return;

    //get any last bytes (1 or 2) out of the buffer
    if (bitCount == 16)
        {
        outBuf <<= 2;  //pad to make 18 bits

        int indx  = (int)((outBuf & 0x0003f000L) >> 12);
        int obyte = (int)base64encode[indx & 63];
        putc(obyte);

        indx      = (int)((outBuf & 0x00000fc0L) >>  6);
        obyte     = (int)base64encode[indx & 63];
        putc(obyte);

        indx      = (int)((outBuf & 0x0000003fL)      );
        obyte     = (int)base64encode[indx & 63];
        putc(obyte);

        putc('=');
        }
    else if (bitCount == 8)
        {
        outBuf <<= 4; //pad to make 12 bits

        int indx  = (int)((outBuf & 0x00000fc0L) >>  6);
        int obyte = (int)base64encode[indx & 63];
        putc(obyte);

        indx      = (int)((outBuf & 0x0000003fL)      );
        obyte     = (int)base64encode[indx & 63];
        putc(obyte);

        putc('=');
        putc('=');
        }

    if (columnWidth > 0) //if <=0, no newlines
        destination.put('\n');

    destination.close();
    closed = true;
}


Generated by  Doxygen 1.6.0   Back to index