Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
websocketpp::utf8_validator::validator Class Reference

Provides streaming UTF8 validation functionality. More...

#include <utf8_validator.hpp>

Public Member Functions

 validator ()
 Construct and initialize the validator.
 
bool consume (uint8_t byte)
 Advance the state of the validator with the next input byte.
 
template<typename iterator_type >
bool decode (iterator_type begin, iterator_type end)
 Advance validator state with input from an iterator pair.
 
bool complete ()
 Return whether the input sequence ended on a valid utf8 codepoint.
 
void reset ()
 Reset the validator to decode another message.
 

Detailed Description

Definition at line 81 of file utf8_validator.hpp.

Constructor & Destructor Documentation

◆ validator()

websocketpp::utf8_validator::validator::validator ( )
inline

Definition at line 84 of file utf8_validator.hpp.

84: m_state(utf8_accept),m_codepoint(0) {}

Member Function Documentation

◆ complete()

bool websocketpp::utf8_validator::validator::complete ( )
inline
Returns
Whether or not the input sequence ended on a valid codepoint.

Definition at line 124 of file utf8_validator.hpp.

124 {
125 return m_state == utf8_accept;
126 }
Here is the caller graph for this function:

◆ consume()

bool websocketpp::utf8_validator::validator::consume ( uint8_t byte)
inline
Parameters
byteThe byte to advance the validation state with
Returns
Whether or not the byte resulted in a validation error.

Definition at line 91 of file utf8_validator.hpp.

91 {
92 if (utf8_validator::decode(&m_state,&m_codepoint,byte) == utf8_reject) {
93 return false;
94 }
95 return true;
96 }
uint32_t decode(uint32_t *state, uint32_t *codep, uint8_t byte)
Decode the next byte of a UTF8 sequence.
Here is the call graph for this function:

◆ decode()

template<typename iterator_type >
bool websocketpp::utf8_validator::validator::decode ( iterator_type begin,
iterator_type end )
inline
Parameters
beginInput iterator to the start of the input range
endInput iterator to the end of the input range
Returns
Whether or not decoding the bytes resulted in a validation error.

Definition at line 105 of file utf8_validator.hpp.

105 {
106 for (iterator_type it = begin; it != end; ++it) {
107 unsigned int result = utf8_validator::decode(
108 &m_state,
109 &m_codepoint,
110 static_cast<uint8_t>(*it)
111 );
112
113 if (result == utf8_reject) {
114 return false;
115 }
116 }
117 return true;
118 }
unsigned char uint8_t
Definition stdint.h:124
Here is the call graph for this function:
Here is the caller graph for this function:

◆ reset()

void websocketpp::utf8_validator::validator::reset ( )
inline

Definition at line 129 of file utf8_validator.hpp.

129 {
130 m_state = utf8_accept;
131 m_codepoint = 0;
132 }

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