MCPcopy Create free account
hub / github.com/Kitware/CMake / GetLine

Method GetLine

Source/CTest/cmProcess.cxx:171–201  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

169}
170
171bool cmProcess::Buffer::GetLine(std::string& line)
172{
173 // Scan for the next newline.
174 for (size_type sz = this->size(); this->Last != sz; ++this->Last) {
175 if ((*this)[this->Last] == '\n' || (*this)[this->Last] == '\0') {
176 // Extract the range first..last as a line.
177 char const* text = this->data() + this->First;
178 size_type length = this->Last - this->First;
179 while (length && text[length - 1] == '\r') {
180 length--;
181 }
182 line.assign(text, length);
183
184 // Start a new range for the next line.
185 ++this->Last;
186 this->First = this->Last;
187
188 // Return the line extracted.
189 return true;
190 }
191 }
192
193 // Available data have been exhausted without a newline.
194 if (this->First != 0) {
195 // Move the partial line to the beginning of the buffer.
196 this->erase(this->begin(), this->begin() + this->First);
197 this->First = 0;
198 this->Last = this->size();
199 }
200 return false;
201}
202
203bool cmProcess::Buffer::GetLast(std::string& line)
204{

Callers 6

CreateMethod · 0.45
SourceFileLoadedMethod · 0.45
GetBreakpointsMethod · 0.45
GetStackTraceResponseFunction · 0.45
OnReadMethod · 0.45

Calls 5

assignMethod · 0.80
eraseMethod · 0.80
sizeMethod · 0.45
dataMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected