Skip to content

Commit d199fb8

Browse files
committed
replace map.contains with find, to be able to compile with C++ 17
1 parent 0fe5aa1 commit d199fb8

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/cpp/web-ifc/parsing/IfcLoader.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
#include <string>
77
#include <cmath>
88
#include <algorithm>
9-
#include <format>
109
#include <fast_float/fast_float.h>
1110
#include <spdlog/spdlog.h>
1211
#include "IfcLoader.h"
@@ -294,13 +293,14 @@ namespace webifc::parsing {
294293

295294
bool IfcLoader::IsValidExpressID(const uint32_t expressID) const
296295
{
297-
if (expressID == 0 || expressID > _maxExpressId || !_lines.contains(expressID)) return false;
296+
if (expressID == 0 || expressID > _maxExpressId ) return false;
297+
if (_lines.find(expressID) == _lines.end()) return false;
298298
else return true;
299299
}
300300

301301
uint32_t IfcLoader::GetLineType(const uint32_t expressID) const
302302
{
303-
if (expressID == 0 || expressID > _maxExpressId || !_lines.contains(expressID)) {
303+
if (expressID == 0 || expressID > _maxExpressId || _lines.find(expressID) == _lines.end()) {
304304
spdlog::error("[GetLineType()] Attempt to Access Invalid ExpressID {}", expressID);
305305
return 0;
306306
}
@@ -318,7 +318,7 @@ namespace webifc::parsing {
318318

319319
void IfcLoader::MoveToLineArgument(const uint32_t expressID, const uint32_t argumentIndex) const
320320
{
321-
if (!_lines.contains(expressID)) return;
321+
if (_lines.find(expressID) == _lines.end()) return;
322322
_tokenStream->MoveTo(_lines.at(expressID)->tapeOffset);
323323
ArgumentOffset(argumentIndex);
324324
}
@@ -343,7 +343,7 @@ namespace webifc::parsing {
343343

344344
void IfcLoader::PushDouble(double input)
345345
{
346-
std::string numberString = std::format("{}", input);
346+
std::string numberString = std::to_string(input);
347347
size_t eLoc = numberString.find_first_of('e');
348348
if (eLoc != std::string::npos) numberString[eLoc]='E';
349349
else if (std::floor(input) == input) numberString+='.';
@@ -426,7 +426,7 @@ namespace webifc::parsing {
426426

427427
void IfcLoader::UpdateLineTape(const uint32_t expressID, const uint32_t type, const uint32_t start)
428428
{
429-
if (!_lines.contains(expressID))
429+
if (_lines.find(expressID) == _lines.end())
430430
{
431431
// create line object
432432
IfcLine * line = new IfcLine();
@@ -656,7 +656,7 @@ namespace webifc::parsing {
656656
uint32_t IfcLoader::GetNoLineArguments(uint32_t expressID) const
657657
{
658658

659-
if (!_lines.contains(expressID)) return 0;
659+
if (_lines.find(expressID) == _lines.end()) return 0;
660660
_tokenStream->MoveTo(_lines.at(expressID)->tapeOffset);
661661
_tokenStream->Read<char>();
662662
_tokenStream->Read<uint32_t>();
@@ -698,7 +698,7 @@ namespace webifc::parsing {
698698

699699
void IfcLoader::MoveToArgumentOffset(const uint32_t expressID, const uint32_t argumentIndex) const
700700
{
701-
if (_lines.contains(expressID)) {
701+
if (_lines.find(expressID) != _lines.end()) {
702702
_tokenStream->MoveTo(_lines.at(expressID)->tapeOffset);
703703
ArgumentOffset(argumentIndex);
704704
}
@@ -733,7 +733,7 @@ namespace webifc::parsing {
733733

734734
uint32_t IfcLoader::GetNextExpressID(uint32_t expressId) const {
735735
uint32_t currentId = expressId+1;
736-
while(!_lines.contains(currentId)) currentId++;
736+
while(_lines.find(currentId) == _lines.end()) currentId++;
737737
return currentId;
738738
}
739739

0 commit comments

Comments
 (0)