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

Method ParseAsciiData

IO/XMLParser/vtkXMLDataParser.cxx:1258–1295  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1256
1257//------------------------------------------------------------------------------
1258int vtkXMLDataParser::ParseAsciiData(int wordType)
1259{
1260 istream& is = *(this->Stream);
1261
1262 // Don't re-parse the same ascii data.
1263 if (this->AsciiDataPosition == this->TellG())
1264 {
1265 return (this->AsciiDataBuffer ? 1 : 0);
1266 }
1267
1268 // Prepare for new data.
1269 this->AsciiDataPosition = this->TellG();
1270 if (this->AsciiDataBuffer)
1271 {
1272 this->FreeAsciiBuffer();
1273 }
1274
1275 int length = 0;
1276 void* buffer = nullptr;
1277 switch (wordType)
1278 {
1279 vtkTemplateMacro(buffer = vtkXMLParseAsciiData(is, &length, static_cast<VTK_TT*>(nullptr), 1));
1280
1281 case VTK_BIT:
1282 buffer = vtkXMLParseAsciiBitData(is, &length);
1283 break;
1284 }
1285
1286 // Read terminated from failure. Clear the fail bit so another read
1287 // can take place later.
1288 is.clear(is.rdstate() & ~ios::failbit);
1289
1290 // Save the buffer.
1291 this->AsciiDataBuffer = reinterpret_cast<unsigned char*>(buffer);
1292 this->AsciiDataBufferLength = length;
1293 this->AsciiDataWordType = wordType;
1294 return (this->AsciiDataBuffer ? 1 : 0);
1295}
1296
1297//------------------------------------------------------------------------------
1298template <class T>

Callers 1

ReadAsciiDataMethod · 0.95

Calls 5

FreeAsciiBufferMethod · 0.95
vtkXMLParseAsciiDataFunction · 0.85
vtkXMLParseAsciiBitDataFunction · 0.85
TellGMethod · 0.80
clearMethod · 0.45

Tested by

no test coverage detected