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

Classes

class  validator
 Provides streaming UTF8 validation functionality. More...
 

Functions

uint32_t decode (uint32_t *state, uint32_t *codep, uint8_t byte)
 Decode the next byte of a UTF8 sequence.
 
bool validate (std::string const &s)
 Validate a UTF8 string.
 

Function Documentation

◆ decode()

uint32_t websocketpp::utf8_validator::decode ( uint32_t * state,
uint32_t * codep,
uint8_t byte )
inline
Parameters
[out]stateThe decoder state to advance
[out]codepThe codepoint to fill in
[in]byteThe byte to input
Returns
The ending state of the decode operation

Definition at line 69 of file utf8_validator.hpp.

69 {
70 uint32_t type = utf8d[byte];
71
72 *codep = (*state != utf8_accept) ?
73 (byte & 0x3fu) | (*codep << 6) :
74 (0xff >> type) & (byte);
75
76 *state = utf8d[256 + *state*16 + type];
77 return *state;
78}
unsigned int uint32_t
Definition stdint.h:126
yh_object_type type
Definition yubihsm.h:672
Here is the caller graph for this function:

◆ validate()

bool websocketpp::utf8_validator::validate ( std::string const & s)
inline

convenience function that creates a validator, validates a complete string and returns the result.

Definition at line 143 of file utf8_validator.hpp.

143 {
144 validator v;
145 if (!v.decode(s.begin(),s.end())) {
146 return false;
147 }
148 return v.complete();
149}
Provides streaming UTF8 validation functionality.
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.
char * s
Here is the call graph for this function:
Here is the caller graph for this function: