Twitch SDK (Internal)
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ttv::chat::ChatReader Class Reference

#include <chatreader.h>

Inheritance diagram for ttv::chat::ChatReader:
ttv::chat::IChatTransportReader

Public Member Functions

 ChatReader ()
 
 ~ChatReader ()
 
void SetNotifySink (IChatReceiveNetworkEvent *pNotify)
 
virtual void OnConnect (TTV_ErrorCode err, const char *error)
 
virtual void OnError (TTV_ErrorCode err)
 
virtual void OnClose ()
 
virtual void OnRead (const char *pData, size_t nSize)
 
void OnLineRead (const char *line)
 

Private Member Functions

bool ParseEvent (ChatNetworkEvent &evt, const char *line)
 

Private Attributes

IChatReceiveNetworkEventmNotify
 The component to notify when a line is successfully read. More...
 
uint32_t mLineLength
 The number of characters in the line buffer. More...
 
std::vector< char > mLineBuffer
 The scratch buffer which may store a partial line between reads from the transport. More...
 
char mParseBuffer [IChatTransport::kMaxBufferSize]
 A scratch buffer for parsing lines. More...
 

Detailed Description

Takes lines received from the transport and parses them.

Constructor & Destructor Documentation

◆ ChatReader()

ttv::chat::ChatReader::ChatReader ( )

◆ ~ChatReader()

ttv::chat::ChatReader::~ChatReader ( )

Member Function Documentation

◆ OnClose()

virtual void ttv::chat::ChatReader::OnClose ( )
virtual

Inject information into the read when a disconnection occurs.

Implements ttv::chat::IChatTransportReader.

◆ OnConnect()

virtual void ttv::chat::ChatReader::OnConnect ( TTV_ErrorCode  hr,
const char *  error 
)
virtual

Inject information into the read when a connection occurs.

Implements ttv::chat::IChatTransportReader.

◆ OnError()

virtual void ttv::chat::ChatReader::OnError ( TTV_ErrorCode  hr)
virtual

Inject information into the read when an error occurs.

Implements ttv::chat::IChatTransportReader.

◆ OnLineRead()

void ttv::chat::ChatReader::OnLineRead ( const char *  line)

Parses the given IRC line and acts upon the content, producing events if needed.

◆ OnRead()

virtual void ttv::chat::ChatReader::OnRead ( const char *  pData,
size_t  nSize 
)
virtual

Read raw data from a transport.

Implements ttv::chat::IChatTransportReader.

◆ ParseEvent()

bool ttv::chat::ChatReader::ParseEvent ( ChatNetworkEvent evt,
const char *  line 
)
private

Parses the given IRC line and populates the event structure.

◆ SetNotifySink()

void ttv::chat::ChatReader::SetNotifySink ( IChatReceiveNetworkEvent pNotify)
inline

Sets the event notifier instance to use for sending events.

Member Data Documentation

◆ mLineBuffer

std::vector<char> ttv::chat::ChatReader::mLineBuffer
private

The scratch buffer which may store a partial line between reads from the transport.

◆ mLineLength

uint32_t ttv::chat::ChatReader::mLineLength
private

The number of characters in the line buffer.

◆ mNotify

IChatReceiveNetworkEvent* ttv::chat::ChatReader::mNotify
private

The component to notify when a line is successfully read.

◆ mParseBuffer

char ttv::chat::ChatReader::mParseBuffer[IChatTransport::kMaxBufferSize]
private

A scratch buffer for parsing lines.


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