#include <Pt/Utf8.h>
Incremental UTF-8 well-formedness checker. More...
Public Member Functions | |
| Utf8Validator () | |
| Creates an empty validator. | |
| bool | advance (const char *data, std::size_t n) |
| Feeds the next bytes. | |
| bool | finish () const |
| Returns true if no error occurred and no character is incomplete. | |
| void | reset () |
| Returns the validator to the empty initial state. | |
Related Symbols | |
(Note that these are not member symbols.) | |
| bool | isValidUtf8 (const char *data, std::size_t n) |
| Returns true if data is a complete well-formed UTF-8 sequence. | |
Utf8Validator checks that a byte sequence is well-formed UTF-8 as defined by RFC 3629. Bytes may arrive in chunks; a character may be split across feeds. Overlong encodings, surrogate code points and values above U+10FFFF are rejected. After an error, further feeds fail until reset().
isValidUtf8() checks a complete sequence in one call.
| bool advance | ( | const char * | data, |
| std::size_t | n ) |