Torc  0.1
Public Member Functions | Protected Member Functions | Friends | List of all members
TorcHTTPReader Class Reference

A convenience class to read HTTP requests from a QTcpSocket. More...

#include <torchttpreader.h>

Public Member Functions

 TorcHTTPReader ()
 
 ~TorcHTTPReader ()=default
 
void TakeRequest (QByteArray &Content, QMap< QString, QString > &Headers)
 Take ownership of the contents and headers. New owner is responsible for deleting. More...
 
QString GetMethod (void) const
 
bool Read (QTcpSocket *Socket)
 Read and parse data from the given socket. More...
 
bool IsReady (void) const
 
bool HeadersComplete (void) const
 

Protected Member Functions

void Reset (void)
 Reset the read state. More...
 

Friends

class TorcWebSocket
 

Detailed Description

A convenience class to read HTTP requests from a QTcpSocket.

Note
Both m_content and m_headers MAY be transferred to new parents for processing. It is the new owner's responsibility to delete them.

Definition at line 8 of file torchttpreader.h.

Constructor & Destructor Documentation

TorcHTTPReader::TorcHTTPReader ( )

Definition at line 33 of file torchttpreader.cpp.

TorcHTTPReader::~TorcHTTPReader ( )
default

Member Function Documentation

QString TorcHTTPReader::GetMethod ( void  ) const

Definition at line 60 of file torchttpreader.cpp.

bool TorcHTTPReader::HeadersComplete ( void  ) const

Definition at line 65 of file torchttpreader.cpp.

bool TorcHTTPReader::IsReady ( void  ) const

Definition at line 55 of file torchttpreader.cpp.

bool TorcHTTPReader::Read ( QTcpSocket *  Socket)

Read and parse data from the given socket.

The HTTP method (e.g. GET / 200 OK), headers and content will be split out for further processing.

Definition at line 89 of file torchttpreader.cpp.

void TorcHTTPReader::Reset ( void  )
protected

Reset the read state.

Definition at line 71 of file torchttpreader.cpp.

void TorcHTTPReader::TakeRequest ( QByteArray &  Content,
QMap< QString, QString > &  Headers 
)

Take ownership of the contents and headers. New owner is responsible for deleting.

Definition at line 47 of file torchttpreader.cpp.

Friends And Related Function Documentation

friend class TorcWebSocket
friend

Definition at line 10 of file torchttpreader.h.


The documentation for this class was generated from the following files: