Zappy GUI
C++ graphic client: renderer, camera, network
Loading...
Searching...
No Matches
ProtocolParser Class Reference

Parses server messages into Event objects. Static class that provides a method to parse raw input strings from the server and convert them into structured Event variants. More...

#include <ProtocolParser.hpp>

+ Collaboration diagram for ProtocolParser:

Static Public Member Functions

static std::optional< Eventparse (std::string_view input)
 Parses a raw input string from the server and converts it into an Event variant. This method stops at the first '
' character. It does not provide mass transformation of multiple lines.
 

Static Private Member Functions

static std::vector< std::string_view > _split (std::string_view str, char delimiter, char stopAt='\n')
 
static std::string _joinTokens (const std::vector< std::string_view > &tokens, size_t start)
 
static std::optional< Event_parseWelcome (const std::vector< std::string_view > &tokens)
 
static std::optional< Event_parseMSZ (const std::vector< std::string_view > &tokens)
 
static std::optional< Event_parseBCT (const std::vector< std::string_view > &tokens)
 
static std::optional< Event_parseTNA (const std::vector< std::string_view > &tokens)
 
static std::optional< Event_parsePNW (const std::vector< std::string_view > &tokens)
 
static std::optional< Event_parsePPO (const std::vector< std::string_view > &tokens)
 
static std::optional< Event_parsePLV (const std::vector< std::string_view > &tokens)
 
static std::optional< Event_parsePIN (const std::vector< std::string_view > &tokens)
 
static std::optional< Event_parsePEX (const std::vector< std::string_view > &tokens)
 
static std::optional< Event_parsePBC (const std::vector< std::string_view > &tokens)
 
static std::optional< Event_parsePIC (const std::vector< std::string_view > &tokens)
 
static std::optional< Event_parsePIE (const std::vector< std::string_view > &tokens)
 
static std::optional< Event_parsePFK (const std::vector< std::string_view > &tokens)
 
static std::optional< Event_parsePDR (const std::vector< std::string_view > &tokens)
 
static std::optional< Event_parsePGT (const std::vector< std::string_view > &tokens)
 
static std::optional< Event_parsePDI (const std::vector< std::string_view > &tokens)
 
static std::optional< Event_parseENW (const std::vector< std::string_view > &tokens)
 
static std::optional< Event_parseEBO (const std::vector< std::string_view > &tokens)
 
static std::optional< Event_parseEDI (const std::vector< std::string_view > &tokens)
 
static std::optional< Event_parseSGT (const std::vector< std::string_view > &tokens)
 
static std::optional< Event_parseSST (const std::vector< std::string_view > &tokens)
 
static std::optional< Event_parseSEG (const std::vector< std::string_view > &tokens)
 
static std::optional< Event_parseSMG (const std::vector< std::string_view > &tokens)
 
static std::optional< Event_parseSUC (const std::vector< std::string_view > &tokens)
 
static std::optional< Event_parseSBP (const std::vector< std::string_view > &tokens)
 
static std::optional< Event_parseSTU (const std::vector< std::string_view > &tokens)
 
static std::optional< Event_parseSSE (const std::vector< std::string_view > &tokens)
 
static std::optional< Event_parseGWT (const std::vector< std::string_view > &tokens)
 

Detailed Description

Parses server messages into Event objects. Static class that provides a method to parse raw input strings from the server and convert them into structured Event variants.

Design pattern: FACTORY

Definition at line 16 of file ProtocolParser.hpp.

Member Function Documentation

◆ _joinTokens()

std::string ProtocolParser::_joinTokens ( const std::vector< std::string_view > &  tokens,
size_t  start 
)
staticprivate

Definition at line 63 of file ProtocolParser.cpp.

Referenced by _parsePBC(), _parseSEG(), _parseSMG(), and _parseTNA().

+ Here is the caller graph for this function:

◆ _parseBCT()

std::optional< Event > ProtocolParser::_parseBCT ( const std::vector< std::string_view > &  tokens)
staticprivate

Definition at line 95 of file ProtocolParser.cpp.

Referenced by parse().

+ Here is the caller graph for this function:

◆ _parseEBO()

std::optional< Event > ProtocolParser::_parseEBO ( const std::vector< std::string_view > &  tokens)
staticprivate

Definition at line 352 of file ProtocolParser.cpp.

Referenced by parse().

+ Here is the caller graph for this function:

◆ _parseEDI()

std::optional< Event > ProtocolParser::_parseEDI ( const std::vector< std::string_view > &  tokens)
staticprivate

Definition at line 366 of file ProtocolParser.cpp.

Referenced by parse().

+ Here is the caller graph for this function:

◆ _parseENW()

std::optional< Event > ProtocolParser::_parseENW ( const std::vector< std::string_view > &  tokens)
staticprivate

Definition at line 334 of file ProtocolParser.cpp.

Referenced by parse().

+ Here is the caller graph for this function:

◆ _parseGWT()

std::optional< Event > ProtocolParser::_parseGWT ( const std::vector< std::string_view > &  tokens)
staticprivate

Definition at line 477 of file ProtocolParser.cpp.

Referenced by parse().

+ Here is the caller graph for this function:

◆ _parseMSZ()

std::optional< Event > ProtocolParser::_parseMSZ ( const std::vector< std::string_view > &  tokens)
staticprivate

Definition at line 80 of file ProtocolParser.cpp.

Referenced by parse().

+ Here is the caller graph for this function:

◆ _parsePBC()

std::optional< Event > ProtocolParser::_parsePBC ( const std::vector< std::string_view > &  tokens)
staticprivate

Definition at line 221 of file ProtocolParser.cpp.

References _joinTokens().

Referenced by parse().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _parsePDI()

std::optional< Event > ProtocolParser::_parsePDI ( const std::vector< std::string_view > &  tokens)
staticprivate

Definition at line 320 of file ProtocolParser.cpp.

Referenced by parse().

+ Here is the caller graph for this function:

◆ _parsePDR()

std::optional< Event > ProtocolParser::_parsePDR ( const std::vector< std::string_view > &  tokens)
staticprivate

Definition at line 290 of file ProtocolParser.cpp.

Referenced by parse().

+ Here is the caller graph for this function:

◆ _parsePEX()

std::optional< Event > ProtocolParser::_parsePEX ( const std::vector< std::string_view > &  tokens)
staticprivate

Definition at line 207 of file ProtocolParser.cpp.

Referenced by parse().

+ Here is the caller graph for this function:

◆ _parsePFK()

std::optional< Event > ProtocolParser::_parsePFK ( const std::vector< std::string_view > &  tokens)
staticprivate

Definition at line 276 of file ProtocolParser.cpp.

Referenced by parse().

+ Here is the caller graph for this function:

◆ _parsePGT()

std::optional< Event > ProtocolParser::_parsePGT ( const std::vector< std::string_view > &  tokens)
staticprivate

Definition at line 305 of file ProtocolParser.cpp.

Referenced by parse().

+ Here is the caller graph for this function:

◆ _parsePIC()

std::optional< Event > ProtocolParser::_parsePIC ( const std::vector< std::string_view > &  tokens)
staticprivate

Definition at line 235 of file ProtocolParser.cpp.

Referenced by parse().

+ Here is the caller graph for this function:

◆ _parsePIE()

std::optional< Event > ProtocolParser::_parsePIE ( const std::vector< std::string_view > &  tokens)
staticprivate

Definition at line 257 of file ProtocolParser.cpp.

Referenced by parse().

+ Here is the caller graph for this function:

◆ _parsePIN()

std::optional< Event > ProtocolParser::_parsePIN ( const std::vector< std::string_view > &  tokens)
staticprivate

Definition at line 185 of file ProtocolParser.cpp.

Referenced by parse().

+ Here is the caller graph for this function:

◆ _parsePLV()

std::optional< Event > ProtocolParser::_parsePLV ( const std::vector< std::string_view > &  tokens)
staticprivate

Definition at line 169 of file ProtocolParser.cpp.

Referenced by parse().

+ Here is the caller graph for this function:

◆ _parsePNW()

std::optional< Event > ProtocolParser::_parsePNW ( const std::vector< std::string_view > &  tokens)
staticprivate

Definition at line 125 of file ProtocolParser.cpp.

Referenced by parse().

+ Here is the caller graph for this function:

◆ _parsePPO()

std::optional< Event > ProtocolParser::_parsePPO ( const std::vector< std::string_view > &  tokens)
staticprivate

Definition at line 148 of file ProtocolParser.cpp.

Referenced by parse().

+ Here is the caller graph for this function:

◆ _parseSBP()

std::optional< Event > ProtocolParser::_parseSBP ( const std::vector< std::string_view > &  tokens)
staticprivate

Definition at line 435 of file ProtocolParser.cpp.

Referenced by parse().

+ Here is the caller graph for this function:

◆ _parseSEG()

std::optional< Event > ProtocolParser::_parseSEG ( const std::vector< std::string_view > &  tokens)
staticprivate

Definition at line 408 of file ProtocolParser.cpp.

References _joinTokens().

Referenced by parse().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _parseSGT()

std::optional< Event > ProtocolParser::_parseSGT ( const std::vector< std::string_view > &  tokens)
staticprivate

Definition at line 380 of file ProtocolParser.cpp.

Referenced by parse().

+ Here is the caller graph for this function:

◆ _parseSMG()

std::optional< Event > ProtocolParser::_parseSMG ( const std::vector< std::string_view > &  tokens)
staticprivate

Definition at line 417 of file ProtocolParser.cpp.

References _joinTokens().

Referenced by parse().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _parseSSE()

std::optional< Event > ProtocolParser::_parseSSE ( const std::vector< std::string_view > &  tokens)
staticprivate

Definition at line 459 of file ProtocolParser.cpp.

Referenced by parse().

+ Here is the caller graph for this function:

◆ _parseSST()

std::optional< Event > ProtocolParser::_parseSST ( const std::vector< std::string_view > &  tokens)
staticprivate

Definition at line 394 of file ProtocolParser.cpp.

Referenced by parse().

+ Here is the caller graph for this function:

◆ _parseSTU()

std::optional< Event > ProtocolParser::_parseSTU ( const std::vector< std::string_view > &  tokens)
staticprivate

Definition at line 444 of file ProtocolParser.cpp.

Referenced by parse().

+ Here is the caller graph for this function:

◆ _parseSUC()

std::optional< Event > ProtocolParser::_parseSUC ( const std::vector< std::string_view > &  tokens)
staticprivate

Definition at line 426 of file ProtocolParser.cpp.

Referenced by parse().

+ Here is the caller graph for this function:

◆ _parseTNA()

std::optional< Event > ProtocolParser::_parseTNA ( const std::vector< std::string_view > &  tokens)
staticprivate

Definition at line 116 of file ProtocolParser.cpp.

References _joinTokens().

Referenced by parse().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _parseWelcome()

std::optional< Event > ProtocolParser::_parseWelcome ( const std::vector< std::string_view > &  tokens)
staticprivate

Definition at line 73 of file ProtocolParser.cpp.

Referenced by parse().

+ Here is the caller graph for this function:

◆ _split()

std::vector< std::string_view > ProtocolParser::_split ( std::string_view  str,
char  delimiter,
char  stopAt = '\n' 
)
staticprivate

Definition at line 35 of file ProtocolParser.cpp.

Referenced by parse().

+ Here is the caller graph for this function:

◆ parse()

std::optional< Event > ProtocolParser::parse ( std::string_view  input)
static

Parses a raw input string from the server and converts it into an Event variant. This method stops at the first '
' character. It does not provide mass transformation of multiple lines.

Parameters
inputThe raw input string to parse.
Returns
An optional Event variant containing the parsed event if successful, or std::null

Definition at line 6 of file ProtocolParser.cpp.

References _parseBCT(), _parseEBO(), _parseEDI(), _parseENW(), _parseGWT(), _parseMSZ(), _parsePBC(), _parsePDI(), _parsePDR(), _parsePEX(), _parsePFK(), _parsePGT(), _parsePIC(), _parsePIE(), _parsePIN(), _parsePLV(), _parsePNW(), _parsePPO(), _parseSBP(), _parseSEG(), _parseSGT(), _parseSMG(), _parseSSE(), _parseSST(), _parseSTU(), _parseSUC(), _parseTNA(), _parseWelcome(), and _split().

Referenced by App::pollAndEnqueue().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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