Poco::OSP::Shell

class ResponseStreamBuf

File Information

Library: OSP/Shell
Package: Shell
Header: Poco/OSP/Shell/ResponseStream.h

Description

This stream wraps all lines sent through it in SMTP (RFC 2821) format.

Lines are grouped together in blocks, which every block having the format of an RFC 2821 server response message.

The block begins with a three-digit status code, followed by either a minus sign ('-') if more lines follow, or a space character (' '), if the line is the only line in this block. All lines but the last line in a block also start with a three-digit status code and a minus character. The last line starts with a three-digit status code, a space character and the line data.

Examples:

100-This is a multiline
100-message. The message
100 has three lines in total.

200 OK

Inheritance

Direct Base Classes: Poco::UnbufferedStreamBuf

All Base Classes: Poco::UnbufferedStreamBuf

Member Summary

Member Functions: flushLine, getStatus, setStatus, sync, writeToDevice

Constructors

ResponseStreamBuf

ResponseStreamBuf(
    std::ostream & ostr,
    int status
);

Creates the ResponseStreamBuf and connects it to the given output stream.

Destructor

~ResponseStreamBuf

~ResponseStreamBuf();

Destroys the ResponseStreamBuf.

Member Functions

getStatus inline

int getStatus() const;

Returns the status code that is prepended to response lines.

setStatus

void setStatus(
    int status
);

Sets the status code that is prepended to response lines.

sync

int sync();

Flushes the currently buffered line and ends the response block.

flushLine protected

void flushLine(
    bool more
);

writeToDevice protected

int writeToDevice(
    char c
);

Securely control IoT edge devices from anywhere   Connect a Device