Public Member Functions | |
| void | Stamp (const char *now, TiXmlEncoding encoding) |
| const TiXmlCursor & | Cursor () |
Private Member Functions | |
| TiXmlParsingData (const char *start, int _tabsize, int row, int col) | |
Private Attributes | |
| TiXmlCursor | cursor |
| const char * | stamp |
| int | tabsize |
Friends | |
| class | TiXmlDocument |
|
||||||||||||||||||||
|
Definition at line 181 of file tinyxmlparser.cpp. 00182 {
00183 assert( start );
00184 stamp = start;
00185 tabsize = _tabsize;
00186 cursor.row = row;
00187 cursor.col = col;
00188 }
|
|
|
Definition at line 177 of file tinyxmlparser.cpp. Referenced by TiXmlDeclaration::Parse(), TiXmlText::Parse(), TiXmlAttribute::Parse(), TiXmlComment::Parse(), TiXmlUnknown::Parse(), TiXmlElement::Parse(), and TiXmlDocument::SetError(). 00177 { return cursor; }
|
|
||||||||||||
|
Definition at line 196 of file tinyxmlparser.cpp. References TiXmlCursor::col, cursor, TiXmlCursor::row, stamp, tabsize, TIXML_UTF_LEAD_0, and TIXML_UTF_LEAD_1. Referenced by TiXmlDeclaration::Parse(), TiXmlText::Parse(), TiXmlAttribute::Parse(), TiXmlComment::Parse(), TiXmlUnknown::Parse(), TiXmlElement::Parse(), and TiXmlDocument::SetError(). 00197 {
00198 assert( now );
00199
00200 // Do nothing if the tabsize is 0.
00201 if ( tabsize < 1 )
00202 {
00203 return;
00204 }
00205
00206 // Get the current row, column.
00207 int row = cursor.row;
00208 int col = cursor.col;
00209 const char* p = stamp;
00210 assert( p );
00211
00212 while ( p < now )
00213 {
00214 // Treat p as unsigned, so we have a happy compiler.
00215 const unsigned char* pU = (const unsigned char*)p;
00216
00217 // Code contributed by Fletcher Dunn: (modified by lee)
00218 switch (*pU) {
00219 case 0:
00220 // We *should* never get here, but in case we do, don't
00221 // advance past the terminating null character, ever
00222 return;
00223
00224 case '\r':
00225 // bump down to the next line
00226 ++row;
00227 col = 0;
00228 // Eat the character
00229 ++p;
00230
00231 // Check for \r\n sequence, and treat this as a single character
00232 if (*p == '\n') {
00233 ++p;
00234 }
00235 break;
00236
00237 case '\n':
00238 // bump down to the next line
00239 ++row;
00240 col = 0;
00241
00242 // Eat the character
00243 ++p;
00244
00245 // Check for \n\r sequence, and treat this as a single
00246 // character. (Yes, this bizarre thing does occur still
00247 // on some arcane platforms...)
00248 if (*p == '\r') {
00249 ++p;
00250 }
00251 break;
00252
00253 case '\t':
00254 // Eat the character
00255 ++p;
00256
00257 // Skip to next tab stop
00258 col = (col / tabsize + 1) * tabsize;
00259 break;
00260
00261 case TIXML_UTF_LEAD_0:
00262 if ( encoding == TIXML_ENCODING_UTF8 )
00263 {
00264 if ( *(p+1) && *(p+2) )
00265 {
00266 // In these cases, don't advance the column. These are
00267 // 0-width spaces.
00268 if ( *(pU+1)==TIXML_UTF_LEAD_1 && *(pU+2)==TIXML_UTF_LEAD_2 )
00269 p += 3;
00270 else if ( *(pU+1)==0xbfU && *(pU+2)==0xbeU )
00271 p += 3;
00272 else if ( *(pU+1)==0xbfU && *(pU+2)==0xbfU )
00273 p += 3;
00274 else
00275 { p +=3; ++col; } // A normal character.
00276 }
00277 }
00278 else
00279 {
00280 ++p;
00281 ++col;
00282 }
00283 break;
00284
00285 default:
00286 if ( encoding == TIXML_ENCODING_UTF8 )
00287 {
00288 // Eat the 1 to 4 byte utf8 character.
00289 int step = TiXmlBase::utf8ByteTable[*((const unsigned char*)p)];
00290 if ( step == 0 )
00291 step = 1; // Error case from bad encoding, but handle gracefully.
00292 p += step;
00293
00294 // Just advance one column, of course.
00295 ++col;
00296 }
00297 else
00298 {
00299 ++p;
00300 ++col;
00301 }
00302 break;
00303 }
00304 }
00305 cursor.row = row;
00306 cursor.col = col;
00307 assert( cursor.row >= -1 );
00308 assert( cursor.col >= -1 );
00309 stamp = p;
00310 assert( stamp );
00311 }
|
|
|
Definition at line 173 of file tinyxmlparser.cpp. |
|
|
Definition at line 190 of file tinyxmlparser.cpp. Referenced by TiXmlDocument::Parse(), and Stamp(). |
|
|
Definition at line 191 of file tinyxmlparser.cpp. Referenced by Stamp(). |
|
|
Definition at line 192 of file tinyxmlparser.cpp. Referenced by Stamp(). |
1.3.9.1