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