#include <fstream>#include <string>#include <iostream>#include "Debug.h"#include "readline.h"Go to the source code of this file.
Functions | |
| int | nlreadline (istream &is, string &strg, int keepnl) |
| int | readtext (istream &is, string &strg, int keepnl, char *eot) |
|
||||||||||||||||
|
Definition at line 10 of file readline.cc. References Logger::Error, Logger::p(), and slog. Referenced by checkConvertArtOver(), checkConvertOverOver(), RServer::connect(), Lexer::getToken(), RServer::issue(), RServer::listgroup(), ns_list(), RServer::post(), NVActiveDB::read(), readgroups(), NVNewsgroup::readoverdb(), RNewsgroup::readoverdb(), readtext(), and OverviewFmt::readxoin().
00014 {
00015 int pos, len;
00016 try {
00017 getline(is, strg);
00018 } catch(...) {
00019 // FIXME: should be improved or removed (Debugging)
00020 slog.p(Logger::Error) << "nlreadline: Error in getline\n";
00021 exit(1);
00022 }
00023 pos = len = strg.length();
00024 while (pos) {
00025 pos--;
00026 if (strg[pos] != '\r' && strg[pos] != '\n') {
00027 pos++;
00028 break;
00029 }
00030 }
00031 if (keepnl) {
00032 strg.replace(pos, len - pos, "\r\n");
00033 } else {
00034 strg.replace(pos, len - pos, (char *) NULL, 0);
00035 }
00036 return strg.length();
00037 }
|
|
||||||||||||||||||||
|
Definition at line 39 of file readline.cc. References nlreadline(). Referenced by Article::read().
00044 {
00045 int lines = 0;
00046 string line;
00047
00048 for (;;) {
00049 nlreadline(is, line, keepnl);
00050 if (line == eot)
00051 break;
00052 if (!is.good()) {
00053 if (is.eof())
00054 break;
00055 break;
00056 }
00057 strg += line;
00058 lines++;
00059 }
00060
00061 return lines;
00062 }
|
1.3.6-20040222