MCPcopy Create free account
hub / github.com/Illumina/hap.py / decodeUnicodeCodePoint

Method decodeUnicodeCodePoint

external/jsoncpp/jsoncpp.cpp:847–874  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

845}
846
847bool Reader::decodeUnicodeCodePoint(Token &token,
848 Location &current,
849 Location end,
850 unsigned int &unicode) {
851
852 if (!decodeUnicodeEscapeSequence(token, current, end, unicode))
853 return false;
854 if (unicode >= 0xD800 && unicode <= 0xDBFF) {
855 // surrogate pairs
856 if (end - current < 6)
857 return addError(
858 "additional six characters expected to parse unicode surrogate pair.",
859 token,
860 current);
861 unsigned int surrogatePair;
862 if (*(current++) == '\\' && *(current++) == 'u') {
863 if (decodeUnicodeEscapeSequence(token, current, end, surrogatePair)) {
864 unicode = 0x10000 + ((unicode & 0x3FF) << 10) + (surrogatePair & 0x3FF);
865 } else
866 return false;
867 } else
868 return addError("expecting another \\u token to begin the second half of "
869 "a unicode surrogate pair",
870 token,
871 current);
872 }
873 return true;
874}
875
876bool Reader::decodeUnicodeEscapeSequence(Token &token,
877 Location &current,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected