2022-02-28 01:11:10 +00:00
|
|
|
#include "Runtime/Streams/CTextInStream.hpp"
|
|
|
|
#include <algorithm>
|
|
|
|
|
|
|
|
namespace metaforce {
|
|
|
|
CTextInStream::CTextInStream(CInputStream& in, int len) : m_in(&in), m_len(len) {}
|
|
|
|
|
|
|
|
std::string CTextInStream::GetNextLine() {
|
|
|
|
std::string ret;
|
2022-03-02 08:26:24 +00:00
|
|
|
while (!IsEOF()) {
|
2022-02-28 01:11:10 +00:00
|
|
|
auto chr = m_in->ReadChar();
|
|
|
|
ret += chr;
|
2022-03-02 08:26:24 +00:00
|
|
|
if (ret.back() == '\n') {
|
2022-02-28 01:11:10 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ret.erase(std::remove(ret.begin(), ret.end(), '\r'), ret.end());
|
|
|
|
ret.erase(std::remove(ret.begin(), ret.end(), '\n'), ret.end());
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
} // namespace metaforce
|