77 bool moreAvailable =
true;
78 while (toReport.length() == 0) {
79 const std::string::size_type idx =
myStrBuffer.find(
'\n');
85 if (idx != std::string::npos) {
96 noBytes = noBytes > 1024 ? 1024 : noBytes;
101 moreAvailable =
false;
102 if (toReport ==
"") {
103 return lh.
report(toReport);
109 int idx = (int)toReport.length() - 1;
110 while (idx >= 0 && toReport[idx] < 32) {
114 toReport = toReport.substr(0, idx + 1);
119 if (!lh.
report(toReport)) {
122 return moreAvailable;
128 std::string toReport;
129 while (toReport.length() == 0 &&
myStrm.good()) {
130 const std::string::size_type idx =
myStrBuffer.find(
'\n');
136 if (idx != std::string::npos) {
147 noBytes = noBytes > 1024 ? 1024 : noBytes;
153 if (toReport ==
"") {
163 int idx = (int)toReport.length() - 1;
164 while (idx >= 0 && toReport[idx] < 32) {
168 toReport = toReport.substr(0, idx + 1);
204 myStrm.unsetf(std::ios::skipws);
205 myStrm.seekg(0, std::ios::end);
207 myStrm.seekg(0, std::ios::beg);
216 myStrm.seekg(pos, std::ios::beg);
std::ifstream myStrm
the stream used
unsigned long getPosition()
Returns the current position within the file.
std::string getFileName() const
Returns the name of the used file.
virtual bool report(const std::string &result)=0
Method that obatins a line read by the LineReader.
bool good() const
Returns the information whether the stream is readable.
char myBuffer[1024]
To override MSVC++-bugs, we use an own getline which uses this buffer.
bool setFile(const std::string &file)
Reinitialises the reader for reading from the given file.
int myAvailable
Information how many bytes are available within the used file.
Interface definition for a class which retrieves lines from a LineHandler.
void readAll(LineHandler &lh)
Reads the whole file linewise, reporting every line to the given LineHandler.
int myRread
Information how many bytes were read by the reader from the file.
int myRead
Information about how many characters were supplied to the LineHandler.
bool hasMore() const
Returns whether another line may be read (the file was not read completely)
void reinit()
Reinitialises the reading (of the previous file)
std::string readLine()
Reads a single (the next) line from the file and returns it.
void setPos(unsigned long pos)
Sets the current position within the file to the given value.
std::string myFileName
the name of the file to read the contents from
std::string myStrBuffer
a string-buffer