Common String Codec Filter class, a filter who can extract a string(ends with specific char) from incoming bytes.
More...
#include <StringCodec.h>
|
| StringCodec () |
| Constructor function.
|
|
| StringCodec (char separator, int maxstrlen) |
|
virtual | ~StringCodec () |
| Destructor function.
|
|
virtual bool | Extract (SessionPtr session, IoBufferPtr data, std::vector< IoBufferPtr > &readylist) |
|
virtual IoBufferPtr | Encode (SessionPtr session, void *data) |
|
virtual void * | Decode (SessionPtr session, IoBufferPtr data) |
|
Common String Codec Filter class, a filter who can extract a string(ends with specific char) from incoming bytes.
esnlib::StringCodec::StringCodec |
( |
char |
separator, |
|
|
int |
maxstrlen |
|
) |
| |
Constructor function
- Parameters
-
separator | The separator, a character that the string will end with |
maxstrlen | The maximum length of the string |
virtual void* esnlib::StringCodec::Decode |
( |
SessionPtr |
session, |
|
|
IoBufferPtr |
data |
|
) |
| |
|
virtual |
Decode the IO buffer
- Parameters
-
session | Current session |
data | The pointer of the IO buffer encoded |
- Returns
- The original raw buffer (the pointer of the string's first char)
Implements esnlib::IoFilter.
virtual IoBufferPtr esnlib::StringCodec::Encode |
( |
SessionPtr |
session, |
|
|
void * |
data |
|
) |
| |
|
virtual |
Encode the raw buffer
- Parameters
-
session | Current session |
data | The pointer of the raw buffer (the pointer of the string's first char) |
- Returns
- The pointer of the IO buffer encoded
Implements esnlib::IoFilter.
virtual bool esnlib::StringCodec::Extract |
( |
SessionPtr |
session, |
|
|
IoBufferPtr |
data, |
|
|
std::vector< IoBufferPtr > & |
readylist |
|
) |
| |
|
virtual |
Extract useful data (the string) from the incoming bytes
- Parameters
-
session | Current session |
data | The pointer of the incoming bytes |
readylist | The list used to save the useful data extracted |
- Returns
- Return true if some useful data has been extracted successfully
Implements esnlib::IoFilter.
The documentation for this class was generated from the following file: