MCPcopy Create free account
hub / github.com/IfcOpenShell/IfcOpenShell / init_input_file

Function init_input_file

src/ifcconvert/IfcConvert.cpp:1269–1321  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1267#include <boost/algorithm/string/predicate.hpp>
1268
1269bool init_input_file(const std::string& filename, IfcParse::IfcFile*& ifc_file, bool no_progress, bool mmap, bool bypass_properties) {
1270 time_t start, end;
1271
1272 // Prevent IfcFile::Init() prints by setting output to null temporarily
1273 if (no_progress) { Logger::SetOutput(NULL, &log_stream); }
1274
1275 time(&start);
1276
1277 bool requires_init = false;
1278
1279#ifdef WITH_IFCXML
1280 if (boost::ends_with(boost::to_lower_copy(filename), ".ifcxml")) {
1281 ifc_file = IfcParse::parse_ifcxml(filename);
1282 } else
1283#endif
1284 {
1285 ifc_file = new IfcParse::IfcFile(IfcParse::uninitialized_tag{});
1286 requires_init = true;
1287 }
1288
1289 if (bypass_properties) {
1290 ifc_file->bypass_type("IfcRelDefinesByProperties");
1291 ifc_file->bypass_type("IfcPropertySetDefinition");
1292 ifc_file->bypass_type("IfcProperty");
1293 ifc_file->bypass_type("IfcMaterialProperties");
1294 ifc_file->bypass_type("IfcProfileProperties");
1295 ifc_file->bypass_type("IfcPhysicalQuantity");
1296 }
1297
1298#ifdef USE_MMAP
1299 if (mmap) {
1300 ifc_file->initialize(filename, mmap);
1301 requires_init = false;
1302 }
1303#else
1304 (void)mmap;
1305#endif
1306 if (requires_init) {
1307 ifc_file->initialize(filename);
1308 }
1309
1310 if (!ifc_file || !ifc_file->good()) {
1311 Logger::Error("Unable to parse input file '" + filename + "'");
1312 return false;
1313 }
1314 time(&end);
1315
1316 if (no_progress) { Logger::SetOutput(&cout_, &log_stream); }
1317 else { Logger::Status("Parsing input file took " + format_duration(start, end)); }
1318
1319 return true;
1320
1321}
1322
1323bool append_filter(const std::string& type, const std::vector<std::string>& values, geom_filter& filter)
1324{

Callers 1

IfcConvert.cppFile · 0.85

Calls 5

StatusClass · 0.85
format_durationFunction · 0.85
bypass_typeMethod · 0.80
ErrorFunction · 0.50
initializeMethod · 0.45

Tested by

no test coverage detected