Skip to content

CAbstractPacketParser

Takashiro edited this page Aug 20, 2015 · 1 revision
Cardirector Documentation: Network

CAbstractPacketParser

The CAbstractPacketParser defines the basic functionality of a packet parser, which converts structural data, i.e, CPacket into string representations so as to be transfered via sockets and string representations into CPacket objects. CAbstractPacketParser is the base class for CJsonPacketParser. You may implement your own parser by inheriting CAbstractPacketParser and apply it to CPacketRouter.

Public Functions

CAbstractPacketParser();
virtual ~CAbstractPacketParser();
virtual CPacket parse(const QByteArray &data) = 0;
virtual QByteArray parse(const CPacket &packet) = 0;

CAbstractPacketParser();

Create a new abstract packet parser.

virtual ~CAbstractPacketParser();

Destroys a packet parser.

virtual CPacket parse(const QByteArray &data) = 0;

Converts a raw string representation into a CPacket.

virtual QByteArray parse(const CPacket &packet) = 0;

Converts a CPacket into a string representation.