42 #ifdef CHECK_MEMORY_LEAKS 44 #endif // CHECK_MEMORY_LEAKS 82 bool moreAvailable =
true;
83 while (toReport.length() == 0) {
90 if (idx != std::string::npos) {
93 myRread += (
unsigned int)idx + 1;
101 noBytes = noBytes > 1024 ? 1024 : noBytes;
106 moreAvailable =
false;
107 if (toReport ==
"") {
108 return lh.
report(toReport);
114 int idx = (int)toReport.length() - 1;
115 while (idx >= 0 && toReport[idx] < 32) {
119 toReport = toReport.substr(0, idx + 1);
124 if (!lh.
report(toReport)) {
127 return moreAvailable;
133 std::string toReport;
134 while (toReport.length() == 0 &&
myStrm.good()) {
141 if (idx != std::string::npos) {
144 myRread += (
unsigned int) idx + 1;
152 noBytes = noBytes > 1024 ? 1024 : noBytes;
158 if (toReport ==
"") {
168 int idx = (int)toReport.length() - 1;
169 while (idx >= 0 && toReport[idx] < 32) {
173 toReport = toReport.substr(0, idx + 1);
209 myStrm.unsetf(std::ios::skipws);
210 myStrm.seekg(0, std::ios::end);
212 myStrm.seekg(0, std::ios::beg);
221 myStrm.seekg(pos, std::ios::beg);
std::ifstream myStrm
the stream used
unsigned long getPosition()
Returns the current position within the file.
unsigned int myRead
Information about how many characters were supplied to the LineHandler.
virtual bool report(const std::string &result)=0
Method that obatins a line read by the LineReader.
char myBuffer[1024]
To override MSVC++-bugs, we use an own getline which uses this buffer.
unsigned int myAvailable
Information how many bytes are available within the used file.
bool setFile(const std::string &file)
Reinitialises the reader for reading from the given 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.
unsigned int myRread
Information how many bytes were read by the reader from the file.
bool good() const
Returns the information whether the stream is readable.
std::string getFileName() const
Returns the name of the used file.
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.
bool hasMore() const
Returns whether another line may be read (the file was not read completely)
std::string myFileName
the name of the file to read the contents from
std::string myStrBuffer
a string-buffer