Cuberite
A lightweight, fast and extensible game server for Minecraft
Classes | Public Member Functions | Public Attributes | List of all members
cEnvelopeParser Class Reference

#include <EnvelopeParser.h>

Collaboration diagram for cEnvelopeParser:
Collaboration graph
[legend]

Classes

class  cCallbacks
 

Public Member Functions

 cEnvelopeParser (cCallbacks &a_Callbacks)
 
bool IsInHeaders (void) const
 Returns true if more input is expected for the envelope header. More...
 
void NotifyLast (void)
 Notifies the callback of the key / value stored in m_LastKey / m_LastValue, then erases them. More...
 
size_t Parse (const char *a_Data, size_t a_Size)
 Parses the incoming data. More...
 
bool ParseLine (const char *a_Data, size_t a_Size)
 Parses one line of header data. More...
 
void Reset (void)
 Makes the parser forget everything parsed so far, so that it can be reused for parsing another datastream. More...
 
void SetIsInHeaders (bool a_IsInHeaders)
 Sets the IsInHeaders flag; used by cMultipartParser to simplify the parser initial conditions. More...
 

Public Attributes

cCallbacksm_Callbacks
 Callbacks to call for the various events. More...
 
AString m_IncomingData
 Buffer for the incoming data until it is parsed. More...
 
bool m_IsInHeaders
 Set to true while the parser is still parsing the envelope headers. More...
 
AString m_LastKey
 Holds the last parsed key; used for line-wrapped values. More...
 
AString m_LastValue
 Holds the last parsed value; used for line-wrapped values. More...
 

Detailed Description

Definition at line 16 of file EnvelopeParser.h.

Constructor & Destructor Documentation

◆ cEnvelopeParser()

cEnvelopeParser::cEnvelopeParser ( cCallbacks a_Callbacks)

Definition at line 13 of file EnvelopeParser.cpp.

Member Function Documentation

◆ IsInHeaders()

bool cEnvelopeParser::IsInHeaders ( void  ) const
inline

Returns true if more input is expected for the envelope header.

Definition at line 42 of file EnvelopeParser.h.

◆ NotifyLast()

void cEnvelopeParser::NotifyLast ( void  )

Notifies the callback of the key / value stored in m_LastKey / m_LastValue, then erases them.

Definition at line 85 of file EnvelopeParser.cpp.

◆ Parse()

size_t cEnvelopeParser::Parse ( const char *  a_Data,
size_t  a_Size 
)

Parses the incoming data.

Returns the number of bytes consumed from the input. The bytes not consumed are not part of the envelope header. Returns AString::npos on error

Definition at line 23 of file EnvelopeParser.cpp.

◆ ParseLine()

bool cEnvelopeParser::ParseLine ( const char *  a_Data,
size_t  a_Size 
)

Parses one line of header data.

Returns true if successful

Definition at line 99 of file EnvelopeParser.cpp.

◆ Reset()

void cEnvelopeParser::Reset ( void  )

Makes the parser forget everything parsed so far, so that it can be reused for parsing another datastream.

Definition at line 73 of file EnvelopeParser.cpp.

◆ SetIsInHeaders()

void cEnvelopeParser::SetIsInHeaders ( bool  a_IsInHeaders)
inline

Sets the IsInHeaders flag; used by cMultipartParser to simplify the parser initial conditions.

Definition at line 45 of file EnvelopeParser.h.

Member Data Documentation

◆ m_Callbacks

cCallbacks& cEnvelopeParser::m_Callbacks

Callbacks to call for the various events.

Definition at line 49 of file EnvelopeParser.h.

◆ m_IncomingData

AString cEnvelopeParser::m_IncomingData

Buffer for the incoming data until it is parsed.

Definition at line 55 of file EnvelopeParser.h.

◆ m_IsInHeaders

bool cEnvelopeParser::m_IsInHeaders

Set to true while the parser is still parsing the envelope headers.

Once set to true, the parser will not consume any more data.

Definition at line 52 of file EnvelopeParser.h.

◆ m_LastKey

AString cEnvelopeParser::m_LastKey

Holds the last parsed key; used for line-wrapped values.

Definition at line 58 of file EnvelopeParser.h.

◆ m_LastValue

AString cEnvelopeParser::m_LastValue

Holds the last parsed value; used for line-wrapped values.

Definition at line 61 of file EnvelopeParser.h.


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