Reference Citations - HerongYang.com - v2.95, by Herong Yang
regexParser.cpp
'UTF-8 Encoding Algorithm' code example was used in W3C SPARQL JSON RegEx Parser code in 2011.
The UTF-8 Encoding Algorithm was used in W3C SPARQL JSON RegEx Parser code in 2011.
Subject: regexParser.cpp
Date: Jul, 2011
Author: ericP
Source: http://www.w3.org/2011/07/SPARQL_JSON/regexParser
A boost regex library approach to parsing JSON-format SPARQL results.
(Quick and dirtly syntax colorizing with emacs htmlize-buffer.)
/** JSONparser.cpp - boost::regex parser for the SPARQL JSON results
format.
* input: strings defined by
<http://www.w3.org/TR/rdf-sparql-json-res/>.
* requires:
* boost::regex - regular expression library.
* boost::optional - optionally initialized container, like Haskel
Maybe.
* author: ericP, Eric Prud'hommeaux .
* license: Apache License, Version 2.0, free like speech.
*/
/** ToUTF8 - convert ordinal references to UTF-8 sequences.
* Out - an input_stream or something with a similar incremental
operator=.
*/
struct ToUTF8
{
struct InvalidUCScode : public std::runtime_error {
...
};
template<typename Out>
Out operator() (const char* s, Out out) const {
return operator()(strtol(s, (char**) NULL, 16), out);
}
template<typename Out>
Out operator() (unsigned int ord, Out out)
const throw(InvalidUCScode) {
// https://www.herongyang.com/Unicode
/UTF-8-UTF-8-Encoding-Algorithm.html
if (ord < 0x80) {
out = ord >> 0 & 0x7F | 0x00;
} else if (ord < 0x0800) {
out = ord >> 6 & 0x1F | 0xC0;
out = ord >> 0 & 0x3F | 0x80;
} else if (ord < 0x010000) {
out = ord >> 12 & 0x0F | 0xE0;
out = ord >> 6 & 0x3F | 0x80;
out = ord >> 0 & 0x3F | 0x80;
} else if (ord < 0x110000) {
out = ord >> 18 & 0x07 | 0xF0;
out = ord >> 12 & 0x3F | 0x80;
out = ord >> 6 & 0x3F | 0x80;
out = ord >> 0 & 0x3F | 0x80;
} else {
throw InvalidUCScode(ord);
}
return out;
}
};
...
Table of Contents
Simplified Chinese Unicode table
How to Edit a Mobile Registry With Commander
Utilisation de la JVisualVM en remote via jstatd
OpenOffice.org Newsletter - April 2011
AES Encryption / Decryption with Java 1.5 and ActionScript as3crypto
problem in insert into database
Implement statement batch for Connector C++
How to connect Oracle data base
SET IDENTITY_INSERT for table fails