MCPcopy Create free account
hub / github.com/Kitware/VTK / FindAppendedDataPosition

Method FindAppendedDataPosition

IO/XMLParser/vtkXMLDataParser.cxx:266–301  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

264
265//------------------------------------------------------------------------------
266void vtkXMLDataParser::FindAppendedDataPosition()
267{
268 // Clear stream fail and eof bits. We may have already read past
269 // the end of the stream when processing the AppendedData element.
270 this->Stream->clear(this->Stream->rdstate() & ~ios::failbit);
271 this->Stream->clear(this->Stream->rdstate() & ~ios::eofbit);
272
273 // Scan for the start of the actual appended data.
274 char c = 0;
275 vtkTypeInt64 returnPosition = this->TellG();
276 this->SeekG(this->GetXMLByteIndex());
277 while (this->Stream->get(c) && (c != '>'))
278 {
279 }
280 while (this->Stream->get(c) && vtkXMLDataParser::IsSpace(c))
281 {
282 }
283
284 // Store the start of the appended data. We skip the first
285 // character because it is always a "_".
286 this->AppendedDataPosition = this->TellG();
287
288 // If first character was not an underscore, assume it is part of
289 // the data.
290 if (c != '_')
291 {
292 vtkWarningMacro("First character in AppendedData is ASCII value "
293 << int(c) << ", not '_'. Scan for first character "
294 << "started from file position " << this->GetXMLByteIndex() << ". The return position is "
295 << returnPosition << ".");
296 --this->AppendedDataPosition;
297 }
298
299 // Restore the stream position.
300 this->SeekG(returnPosition);
301}
302
303//------------------------------------------------------------------------------
304void vtkXMLDataParser::PushOpenElement(vtkXMLDataElement* element)

Callers 1

StartElementMethod · 0.95

Calls 5

TellGMethod · 0.80
SeekGMethod · 0.80
GetXMLByteIndexMethod · 0.80
clearMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected