| 69 | |
| 70 | |
| 71 | void TiXmlParsingData::Stamp( const TCHAR* now ) |
| 72 | { |
| 73 | assert( now ); |
| 74 | |
| 75 | // Do nothing if the tabsize is 0. |
| 76 | if ( tabsize < 1 ) |
| 77 | { |
| 78 | return; |
| 79 | } |
| 80 | |
| 81 | // Get the current row, column. |
| 82 | int row = cursor.row; |
| 83 | int col = cursor.col; |
| 84 | const TCHAR* p = stamp; |
| 85 | assert( p ); |
| 86 | |
| 87 | while ( p < now ) |
| 88 | { |
| 89 | // Code contributed by Fletcher Dunn: (modified by lee) |
| 90 | switch (*p) { |
| 91 | case 0: |
| 92 | // We *should* never get here, but in case we do, don't |
| 93 | // advance past the terminating null character, ever |
| 94 | return; |
| 95 | |
| 96 | case '\r': |
| 97 | // bump down to the next line |
| 98 | ++row; |
| 99 | col = 0; |
| 100 | // Eat the character |
| 101 | ++p; |
| 102 | |
| 103 | // Check for \r\n sequence, and treat this as a single character |
| 104 | if (*p == '\n') { |
| 105 | ++p; |
| 106 | } |
| 107 | break; |
| 108 | |
| 109 | case '\n': |
| 110 | // bump down to the next line |
| 111 | ++row; |
| 112 | col = 0; |
| 113 | |
| 114 | // Eat the character |
| 115 | ++p; |
| 116 | |
| 117 | // Check for \n\r sequence, and treat this as a single |
| 118 | // character. (Yes, this bizarre thing does occur still |
| 119 | // on some arcane platforms...) |
| 120 | if (*p == '\r') { |
| 121 | ++p; |
| 122 | } |
| 123 | break; |
| 124 | |
| 125 | case '\t': |
| 126 | // Eat the character |
| 127 | ++p; |
| 128 | |