Into

Modules

Documentation

classPiiMultipartStreamBuffer

#include <PiiMultipartStreamBuffer.h>

An output filter that buffers data into itself until #flush() is called.

Inherits PiiStreamBuffer

Description

It sends a MIME header before the actual data.

 void MyHandler::handleRequest(const QString& uri,
                               PiiHttpDevice* h,
                               PiiProgressController* controller)
 {
   QString strBoundary("243F6A8885A308D31319");
   h->setHeader("Content-Type", "multipart/mixed; boundary=\"" + strBoundary + "\"");

   QStringList lstResponses = QStringList() << "Response1" << "Response2";
   for (int i=0; i<lstResponses.size(); ++i)
     {
        PiiMultipartStreamBuffer* bfr = new PiiMultipartStreamBuffer(strBoundary);
        bfr->setHeader("Content-Type", "text/plain");
        h->startOutputFiltering(bfr);
        h->print(lstResponses[i]);
        h->endOutputFiltering();
     }
   h->print("\r
--" + strBoundary + "--\r
");
 }

Constructors and destructor

( )

Create a new multipart stream buffer.

Public member functions

virtual qint64

Returns the number of bytes currently in the buffer, including header information.

virtual qint64

Sends all buffered data to the output device.

void
( )

Set a header field.

Function details

  • PiiMultipartStreamBuffer

    ( )

    Create a new multipart stream buffer.

  • ~PiiMultipartStreamBuffer

    ()
  • virtual qint64 bufferedSize

    ()
    [virtual]

    Returns the number of bytes currently in the buffer, including header information.

    Reimplemented from PiiStreamBuffer.

  • virtual qint64 flushFilter

    ()
    [virtual]

    Sends all buffered data to the output device.

    Reimplemented from PiiStreamBuffer.

  • void setHeader

    ( )

    Set a header field.

Notes (0)

Add a note

Not a single note added yet. Be the first, add yours.