MCPcopy Create free account
hub / github.com/ThatOpen/engine_web-ifc / ParseLines

Method ParseLines

src/cpp/web-ifc/parsing/IfcLoader.cpp:228–292  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

226 }
227
228 void IfcLoader::ParseLines()
229 {
230 _lines.reserve(_tokenStream->GetNoLines());
231 uint32_t currentIfcType = 0;
232 uint32_t currentExpressID = 0;
233 uint32_t currentTapeOffset = 0;
234 while (!_tokenStream->IsAtEnd())
235 {
236 IfcTokenType t = static_cast<IfcTokenType>(_tokenStream->Read<char>());
237 switch (t)
238 {
239 case IfcTokenType::LINE_END:
240 {
241 if (currentIfcType !=0)
242 {
243 IfcLine* l = new IfcLine();
244 l->ifcType = currentIfcType;
245 l->tapeOffset = currentTapeOffset;
246 if(currentIfcType == webifc::schema::FILE_DESCRIPTION || currentIfcType == webifc::schema::FILE_NAME || currentIfcType == webifc::schema::FILE_SCHEMA )
247 {
248 _headerLines.push_back(l);
249 }
250 else if (currentExpressID != 0)
251 {
252 _ifcTypeToExpressID[currentIfcType].push_back(currentExpressID);
253 _maxExpressId = std::max(_maxExpressId, currentExpressID);
254 _lines[currentExpressID]=l;
255 currentExpressID = 0;
256 }
257 currentIfcType = 0;
258 }
259 currentTapeOffset = _tokenStream->GetReadOffset();
260 break;
261 }
262 case IfcTokenType::UNKNOWN:
263 case IfcTokenType::EMPTY:
264 case IfcTokenType::SET_BEGIN:
265 case IfcTokenType::SET_END:
266 break;
267 case IfcTokenType::STRING:
268 case IfcTokenType::REAL:
269 case IfcTokenType::INTEGER:
270 case IfcTokenType::ENUM:
271 {
272 auto size = _tokenStream->Read<uint16_t>();
273 _tokenStream->Forward(size);
274 break;
275 }
276 case IfcTokenType::LABEL:
277 {
278 std::string_view s = _tokenStream->ReadString();
279 if (currentIfcType == 0) currentIfcType = _schemaManager.IfcTypeToTypeCode(s);
280 break;
281 }
282 case IfcTokenType::REF:
283 {
284 uint32_t ref = _tokenStream->Read<uint32_t>();
285 if (currentExpressID == 0) currentExpressID = ref;

Callers

nothing calls this directly

Calls 6

GetReadOffsetMethod · 0.80
IfcTypeToTypeCodeMethod · 0.80
GetNoLinesMethod · 0.45
IsAtEndMethod · 0.45
ForwardMethod · 0.45
ReadStringMethod · 0.45

Tested by

no test coverage detected