44 lines
745 B
C++
44 lines
745 B
C++
#ifndef __TCPLineBufferParser_h__
|
|
#define __TCPLineBufferParser_h__
|
|
|
|
#include "TCPSocket.h"
|
|
|
|
namespace core {
|
|
|
|
///
|
|
/// TCPLineBufferParser
|
|
///
|
|
/// This object will read lines of data from the source one line at a time.
|
|
///
|
|
///
|
|
|
|
class TCPLineBufferParser : public TCPSocket {
|
|
|
|
protected:
|
|
|
|
///
|
|
/// This method is called when a line is ready to be processed.
|
|
///
|
|
|
|
virtual void onDataReceived();
|
|
|
|
private:
|
|
|
|
///
|
|
/// Read the data for the socket and split into lines and call dataReceived
|
|
/// for each line parsed.
|
|
///
|
|
|
|
void readDataNotification() override;
|
|
|
|
char *buffer;
|
|
size_t bufferSize;
|
|
char *cursor;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|
|
|