What we do is this: for each line of text in the istream, we use a OptStrTokIter to iterate over each token on the line. If the first non-white character on a line is c_COMMENT, then we consider the line to be a comment and we ignore it.
| 281 | // consider the line to be a comment and we ignore it. |
| 282 | // |
| 283 | void OptIstreamIter::fill(void) |
| 284 | { |
| 285 | #ifdef USE_STDIO |
| 286 | return; |
| 287 | #else |
| 288 | char buf[OptIstreamIter::MAX_LINE_LEN]; |
| 289 | do |
| 290 | { |
| 291 | *buf = '\0'; |
| 292 | is.getline(buf, sizeof(buf)); |
| 293 | char *ptr = buf; |
| 294 | while (isspace(*ptr)) |
| 295 | ++ptr; |
| 296 | if (*ptr && (*ptr != c_COMMENT)) |
| 297 | { |
| 298 | delete tok_iter; |
| 299 | tok_iter = new OptStrTokIter(ptr); |
| 300 | return; |
| 301 | } |
| 302 | } while (is); |
| 303 | #endif /* USE_STDIO */ |
| 304 | } |
| 305 | |
| 306 | // **************************************************** Options class utilities |
| 307 |
no outgoing calls