Commit 60a8f7b6 authored by Mark Olesen's avatar Mark Olesen Committed by Andrew Heather
Browse files

ENH: allow alternative delimiter for getLine. Default: '\n'

parent 13967565
......@@ -137,7 +137,7 @@ public:
inline int peek();
//- Raw, low-level getline into a string function.
inline ISstream& getLine(std::string& str);
inline ISstream& getLine(std::string& str, char delim = '\n');
//- Raw, low-level putback character function.
inline ISstream& putback(const char c);
......
......@@ -74,11 +74,15 @@ inline int Foam::ISstream::peek()
}
inline Foam::ISstream& Foam::ISstream::getLine(std::string& str)
inline Foam::ISstream& Foam::ISstream::getLine(std::string& str, char delim)
{
std::getline(is_, str);
std::getline(is_, str, delim);
setState(is_.rdstate());
++lineNumber_;
if (delim == '\n')
{
++lineNumber_;
}
return *this;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment