case '<':
- /* " <br> " */
+ // " <br> "
if (chpt[ i + 1 ] == 'b' && chpt[ i + 2 ] == 'r' && chpt[ i + 3 ] == '>') {
unsigned int i2 = i - startPos;
- if (i > 0 && chpt[ i - 1 ] == ' ') i2--; /* remove space before <br> */
+ if (i > 0 && chpt[ i - 1 ] == ' ') i2--; // remove space before <br>
text += rawData.mid(startPos, i2) + '\n';
startPos = i + 4;
- if (chpt[ startPos ] == ' ') startPos++; /* remove space after <br> */
+ if (chpt[ startPos ] == ' ') startPos++; // remove space after <br>
i = startPos - 1;
}
- /*----------------------------------------*/
+ //----------------------------------------
- /* remove HTML tags <[^>]*> */
+ // remove HTML tags <[^>]*>
else {
if (i - startPos) text += rawData.mid(startPos, i - startPos);
break;
- /*----------------------------------*/
+ //----------------------------------
case '&':
- /* special char */
+ // special char
{
QString tmpstr;
tmpstr = parseSpecialChar(chpt + i, pos);
static bool isHYPHEN(unsigned short c)
{
- /* UTF-16 */
+ // UTF-16
if (c == '-'
|| (c >= 0x2010 && c <= 0x2015)
|| (c == 0x2212)
- || (c == 0xFF0D) /* UTF8: 0xEFBC8D */
+ || (c == 0xFF0D) // UTF8: 0xEFBC8D
) {
return true;
}
refNum[ 1 ] = 0;
pos = 0;
- /* check '>' twice */
+ // check '>' twice
for (int i = 0; i < 2; i++) {
if (cdat[ pos ].unicode() == UTF16_BRACKET) {
linkstr += cdat[ pos ];
pos++;
- } else if (cdat[ pos ] == '&' && cdat[ pos + 1 ] == 'g' /* > */
+ } else if (cdat[ pos ] == '&' && cdat[ pos + 1 ] == 'g' // >
&& cdat[ pos + 2 ] == 't' && cdat[ pos + 3 ] == ';') {
linkstr += '>';
pos += 4;
}
- /* check ',' */
+ // check ','
if (!pos) {
if (cdat[ pos ] == ',' || cdat[ pos ].unicode() == UTF16_COMMA) {
linkstr += ',';
}
}
- /* check '=' */
+ // check '='
if (!pos) {
if (cdat[ pos ] == '=' || cdat[ pos ].unicode() == UTF16_EQ) {
linkstr += '=';
}
}
- /* check digits */
+ // check digits
int hyphen = 0;
for (int i = 0 ; i < KITA_RESDIGIT + 1 && pos < length ; i++, pos++) {
unsigned int length = resdat.name.length();
resdat.nameHTML.clear();
- /* anchor */
+ // anchor
while (parseResAnchor(chpt + i, length - i, linkstr, refNum, pos)) {
linkurl = QString("#%1").arg(refNum[ 0 ]);
i += pos;
}
- /* non-digits strings */
+ // non-digits strings
if (i < length) {
resdat.nameHTML += "<span class=\"name_noaddr\">";
}
resdat.date = rawStr.left(pos);
- /* id */
+ // id
if (chpt[ pos ] == 'I' && chpt[ pos + 1 ] == 'D') {
pos += 3;
startpos = pos;
if (pos >= length) return ;
- /* be */
+ // be
if (chpt[ pos ] == 'B' && chpt[ pos + 1 ] == 'E') {
pos += 3;
startpos = pos;
if (pos >= length) return ;
- /* host */
+ // host
if (chpt[ pos ] == 'H' && chpt[ pos + 1 ] == 'O') {
pos += 5;
startpos = pos;
)
{
- /*-----------------------------*/
+ //-----------------------------
linkstr.clear();
linkurl.clear();
unsigned int pos;
unsigned int length = rawStr.length();
- /* parse anchor */
+ // parse anchor
if (!parseResAnchor(chpt + i, length - i, linkstr, refNum, pos)) {
i += pos - 1;
return false;
}
- /* create anchor */
+ // create anchor
resdat.bodyHTML += rawStr.mid(startPos, i - startPos);
linkurl = QString("#%1").arg(refNum[ 0 ]);
if (refNum[ 1 ]) linkurl += QString("-%1").arg(refNum[ 1 ]);
resdat.bodyHTML += linkstr;
resdat.bodyHTML += "</a>";
- /* add anchor to ancList */
+ // add anchor to ancList
ANCNUM anctmp;
if (refNum[ 1 ] < refNum[ 0 ]) refNum[ 1 ] = refNum[ 0 ];
anctmp.from = refNum[ 0 ];
bool ancChain = false;
- /* ancChain is chain for anchor. For examle, if anchor ">2"
- appeared, ancChain is set to true. Moreover, if next strings
- are "=5", anchor for 5 is also set. Thus, we can obtain anchors
- for strings ">2=5" as follows:
-
- <a href="#2">>2</a><a href="#5">=5</a>
- */
+ // ancChain is chain for anchor. For examle, if anchor ">2"
+ // appeared, ancChain is set to true. Moreover, if next strings
+ // are "=5", anchor for 5 is also set. Thus, we can obtain anchors
+ // for strings ">2=5" as follows:
+ //
+ // <a href="#2">>2</a><a href="#5">=5</a>
int offset = 0;
- if (chpt[ 0 ] == ' ') offset = 1; /* remove one space after <> */
+ if (chpt[ 0 ] == ' ') offset = 1; // remove one space after <>
for (unsigned int i = startPos = offset ; i < length ; i++) {
switch (chpt[ i ].unicode()) {
case '<':
- /* " <br> " */
+ // " <br> "
if (chpt[ i + 1 ] == 'b' && chpt[ i + 2 ] == 'r' && chpt[ i + 3 ] == '>') {
- /* reset anchor chain */
+ // reset anchor chain
ancChain = false;
unsigned int i2 = i - startPos;
- if (i > 0 && chpt[ i - 1 ] == ' ') i2--; /* remove space before <br> */
+ if (i > 0 && chpt[ i - 1 ] == ' ') i2--; // remove space before <br>
resdat.bodyHTML += rawStr.mid(startPos, i2);
resdat.bodyHTML += "<br>";
startPos = i + 4;
- if (chpt[ startPos ] == ' ') startPos++; /* remove space after <br> */
+ if (chpt[ startPos ] == ' ') startPos++; // remove space after <br>
i = startPos - 1;
}
- /*----------------------------------------*/
+ //----------------------------------------
- /* remove HTML tags <[^>]*> */
+ // remove HTML tags <[^>]*>
else {
if (i - startPos) resdat.bodyHTML += rawStr.mid(startPos, i - startPos);
break;
- /*----------------------------------------*/
+ //----------------------------------------
- case 'h': /* "http://" or "ttp://" or "tp:" */
+ case 'h': // "http://" or "ttp://" or "tp:"
case 't':
{
unsigned int pos = 0;
break;
- /*----------------------------------*/
+ //----------------------------------
case '&':
- /* > */
+ // >
if (chpt[ i + 1 ] == 'g' && chpt[ i + 2 ] == 't' && chpt[ i + 3 ] == ';')
ancChain = createResAnchor(rawStr, resdat, chpt, i, startPos);
break;
- /*----------------------------------------*/
+ //----------------------------------------
- /* unicode '>' */
+ // unicode '>'
case UTF16_BRACKET:
ancChain = createResAnchor(rawStr, resdat, chpt, i, startPos);
break;
- /*----------------------------------*/
+ //----------------------------------
default:
resdat.broken = false;
resdat.anclist.clear();
- /* search the staring positions of each section to split raw data. */
+ // search the staring positions of each section to split raw data.
const QChar *chpt = resdat.linestr.unicode();
unsigned int length = resdat.linestr.length();
unsigned int section = 0;
unsigned int sectionPos[ 5 ];
for (unsigned int i = 0 ; i < length ; i++) {
- /* sections are splitted by "<>" */
+ // sections are splitted by "<>"
if (chpt[ i ] == '<' && chpt[ i + 1 ] == '>') {
section++;
}
}
- /* broken data */
+ // broken data
if (section != 4) {
resdat.broken = true;
return true;
// qDebug("[%d] %d %d %d %d",section, sectionPos[1],sectionPos[2],sectionPos[3],sectionPos[4]);
- /* name */
+ // name
length = sectionPos[ 1 ] - 2 ;
parseName(resdat.linestr.mid(0, length), resdat);
- /* mail */
+ // mail
length = sectionPos[ 2 ] - 2 - sectionPos[ 1 ];
datToText(resdat.linestr.mid(sectionPos[ 1 ], length), resdat.address);
- /* date, ID, host */
+ // date, ID, host
length = sectionPos[ 3 ] - 2 - sectionPos[ 2 ];
parseDateId(resdat.linestr.mid(sectionPos[ 2 ], length), resdat);
- /* body */
+ // body
length = sectionPos[ 4 ] - 2 - sectionPos[ 3 ];
parseBody(resdat.linestr.mid(sectionPos[ 3 ], length), resdat);
- /* subject */
+ // subject
subject = resdat.linestr.mid(sectionPos[ 4 ]);
return true;