MCPcopy Create free account
hub / github.com/buggins/coolreader / processLine

Method processLine

crengine/src/lvxml.cpp:2015–2209  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2013 }
2014
2015 void processLine( lString16 text ) {
2016 int len = text.length();
2017 const lChar16 * str = text.c_str();
2018 for ( int j=0; j<len; j++ ) {
2019 //bool isStartOfLine = (j==0);
2020 lChar16 ch = str[j];
2021 lChar16 ch2 = str[j+1];
2022 if ( ch=='\\' ) {
2023 if ( ch2=='a' ) {
2024 // \aXXX Insert non-ASCII character whose Windows 1252 code is decimal XXX.
2025 int n = decodeDecimal( str + j + 2, 3 );
2026 bool use1252 = true;
2027 if ( n>=128 && n<=255 && use1252 ) {
2028 addChar( cp1252[n-128] );
2029 j+=4;
2030 continue;
2031 } else if ( n>=1 && n<=255 ) {
2032 addChar( n );
2033 j+=4;
2034 continue;
2035 }
2036 } else if ( ch2=='U' ) {
2037 // \UXXXX Insert non-ASCII character whose Unicode code is hexidecimal XXXX.
2038 int n = decodeHex( str + j + 2, 4 );
2039 if ( n>0 ) {
2040 addChar( n );
2041 j+=5;
2042 continue;
2043 }
2044 } else if ( ch2=='\\' ) {
2045 // insert '\'
2046 addChar( ch2 );
2047 j++;
2048 continue;
2049 } else if ( ch2=='-' ) {
2050 // insert '\'
2051 addChar( UNICODE_SOFT_HYPHEN_CODE );
2052 j++;
2053 continue;
2054 } else if ( ch2=='T' ) {
2055 // Indents the specified percentage of the screen width, 50% in this case.
2056 // If the current drawing position is already past the specified screen location, this tag is ignored.
2057 j+=2;
2058 lString16 w = readParam( str, j );
2059 // IGNORE
2060 continue;
2061 } else if ( ch2=='m' ) {
2062 // Insert the named image.
2063 j+=2;
2064 lString16 image = readParam( str, j );
2065 onImage( image );
2066 continue;
2067 } else if ( ch2=='Q' ) {
2068 // \Q="linkanchor" - Specify a link anchor in the document.
2069 j+=2;
2070 lString16 anchor = readParam( str, j );
2071 addAnchor(anchor);
2072 continue;

Callers 1

DoPMLImportMethod · 0.45

Calls 5

decodeDecimalFunction · 0.85
decodeHexFunction · 0.85
hexDigitFunction · 0.70
lengthMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected