MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / peekNextLine

Method peekNextLine

other_src/astyle/src/astyle_main.cpp:206–238  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

204// call this function from ASFormatter ONLY
205template<typename T>
206string ASStreamIterator<T>::peekNextLine()
207{
208 assert (hasMoreLines());
209 string nextLine_;
210 char ch;
211
212 if (peekStart == 0)
213 peekStart = inStream->tellg();
214
215 // read the next record
216 inStream->get(ch);
217 while (!inStream->eof() && ch != '\n' && ch != '\r')
218 {
219 nextLine_.append(1, ch);
220 inStream->get(ch);
221 }
222
223 if (inStream->eof())
224 {
225 return nextLine_;
226 }
227
228 int peekCh = inStream->peek();
229
230 // remove end-of-line characters
231 if (!inStream->eof())
232 {
233 if ((peekCh == '\n' || peekCh == '\r') && peekCh != ch) ///////////// changed //////////
234 inStream->get();
235 }
236
237 return nextLine_;
238}
239
240// reset current position and EOF for peekNextLine()
241template<typename T>

Callers 3

peekNextTextMethod · 0.80

Calls 2

getMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected