Cuberite
A lightweight, fast and extensible game server for Minecraft
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
cTransferEncodingParser Class Referenceabstract

Used as both the interface that all the parsers share and the (static) factory creating such parsers. More...

#include <TransferEncodingParser.h>

Inheritance diagram for cTransferEncodingParser:
Inheritance graph
[legend]
Collaboration diagram for cTransferEncodingParser:
Collaboration graph
[legend]

Classes

class  cCallbacks
 

Public Member Functions

virtual void Finish (void)=0
 To be called when the stream is terminated from the source (connection closed). More...
 
virtual size_t Parse (const char *a_Data, size_t a_Size)=0
 Parses the incoming data and calls the appropriate callbacks. More...
 
virtual ~cTransferEncodingParser ()
 

Static Public Member Functions

static cTransferEncodingParserPtr Create (cCallbacks &a_Callbacks, const AString &a_TransferEncoding, size_t a_ContentLength)
 Creates a new parser for the specified encoding. More...
 

Protected Member Functions

 cTransferEncodingParser (cCallbacks &a_Callbacks)
 

Protected Attributes

cCallbacksm_Callbacks
 The callbacks used to report progress. More...
 

Detailed Description

Used as both the interface that all the parsers share and the (static) factory creating such parsers.

Definition at line 21 of file TransferEncodingParser.h.

Constructor & Destructor Documentation

◆ ~cTransferEncodingParser()

virtual cTransferEncodingParser::~cTransferEncodingParser ( )
inlinevirtual

Definition at line 42 of file TransferEncodingParser.h.

◆ cTransferEncodingParser()

cTransferEncodingParser::cTransferEncodingParser ( cCallbacks a_Callbacks)
inlineprotected

Definition at line 68 of file TransferEncodingParser.h.

Member Function Documentation

◆ Create()

cTransferEncodingParserPtr cTransferEncodingParser::Create ( cCallbacks a_Callbacks,
const AString a_TransferEncoding,
size_t  a_ContentLength 
)
static

Creates a new parser for the specified encoding.

If the encoding is not known, returns a nullptr. a_ContentLength is the length of the content, received in a Content-Length header. It is used for the Identity encoding, it is ignored for the Chunked encoding.

Definition at line 373 of file TransferEncodingParser.cpp.

◆ Finish()

virtual void cTransferEncodingParser::Finish ( void  )
pure virtual

To be called when the stream is terminated from the source (connection closed).

Flushes any buffers and calls appropriate callbacks.

Implemented in cIdentityTEParser, and cChunkedTEParser.

◆ Parse()

virtual size_t cTransferEncodingParser::Parse ( const char *  a_Data,
size_t  a_Size 
)
pure virtual

Parses the incoming data and calls the appropriate callbacks.

Returns the number of bytes from the end of a_Data that is already not part of this message (if the parser can detect it). Returns AString::npos on an error.

Implemented in cIdentityTEParser, and cChunkedTEParser.

Member Data Documentation

◆ m_Callbacks

cCallbacks& cTransferEncodingParser::m_Callbacks
protected

The callbacks used to report progress.

Definition at line 65 of file TransferEncodingParser.h.


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