| 204 | // call this function from ASFormatter ONLY |
| 205 | template<typename T> |
| 206 | string ASStreamIterator<T>::peekNextLine() |
| 207 | { |
| 208 | assert (hasMoreLines()); |
| 209 | string nextLine_; |
| 210 | char ch; |
| 211 | |
| 212 | if (peekStart == 0) |
| 213 | peekStart = inStream->tellg(); |
| 214 | |
| 215 | // read the next record |
| 216 | inStream->get(ch); |
| 217 | while (!inStream->eof() && ch != '\n' && ch != '\r') |
| 218 | { |
| 219 | nextLine_.append(1, ch); |
| 220 | inStream->get(ch); |
| 221 | } |
| 222 | |
| 223 | if (inStream->eof()) |
| 224 | { |
| 225 | return nextLine_; |
| 226 | } |
| 227 | |
| 228 | int peekCh = inStream->peek(); |
| 229 | |
| 230 | // remove end-of-line characters |
| 231 | if (!inStream->eof()) |
| 232 | { |
| 233 | if ((peekCh == '\n' || peekCh == '\r') && peekCh != ch) ///////////// changed ////////// |
| 234 | inStream->get(); |
| 235 | } |
| 236 | |
| 237 | return nextLine_; |
| 238 | } |
| 239 | |
| 240 | // reset current position and EOF for peekNextLine() |
| 241 | template<typename T> |
no test coverage detected