Skip to content

Commit 5e23086

Browse files
committed
Sprinkle with template and typename keywords
1 parent 472fde5 commit 5e23086

File tree

8 files changed

+20
-12
lines changed

8 files changed

+20
-12
lines changed

src/ifcexpressparser/templates.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
4141
static const IfcParse::schema_definition& get_schema();
4242
43-
static const char* const Identifier = "%(schema_name_upper)s";
43+
static const char* const Identifier;
4444
4545
// Forward definitions
4646
%(forward_definitions)s
@@ -75,6 +75,8 @@
7575
7676
#include <map>
7777
78+
const char* const %(schema_name)s::Identifier = "%(schema_name_upper)s";
79+
7880
using namespace IfcParse;
7981
using namespace IfcWrite;
8082

src/ifcparse/Ifc2x3.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131

3232
#include <map>
3333

34+
const char* const Ifc2x3::Identifier = "IFC2X3";
35+
3436
using namespace IfcParse;
3537
using namespace IfcWrite;
3638

src/ifcparse/Ifc2x3.h

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/ifcparse/Ifc4.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131

3232
#include <map>
3333

34+
const char* const Ifc4::Identifier = "IFC4";
35+
3436
using namespace IfcParse;
3537
using namespace IfcWrite;
3638

src/ifcparse/Ifc4.h

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/ifcparse/IfcFile.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,12 +187,12 @@ class IFC_PARSE_API IfcFileWithSchema : public IfcFile {
187187
public:
188188
std::pair<typename Schema::IfcNamedUnit*, double> getUnit(typename Schema::IfcUnitEnum::Value unit_type) {
189189
std::pair<IfcUtil::IfcBaseClass*, double> unit_info = IfcFile::getUnit(Schema::IfcUnitEnum::ToString(unit_type));
190-
return std::make_pair(unit_info.first->as<typename Schema::IfcNamedUnit>(), unit_info.second);
190+
return std::make_pair(unit_info.first->template as<typename Schema::IfcNamedUnit>(), unit_info.second);
191191
}
192192

193193
/// Returns the entity with the specified GlobalId
194-
virtual typename Schema::IfcRoot::list::ptr instance_by_guid(const std::string& guid) {
195-
return IfcFile::instance_by_guid(guid)->as<typename Schema::IfcRoot>();
194+
virtual typename Schema::IfcRoot* instance_by_guid(const std::string& guid) {
195+
return IfcFile::instance_by_guid(guid)->template as<typename Schema::IfcRoot>();
196196
}
197197
};
198198

src/ifcparse/IfcSIPrefix.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,16 @@ double IfcParse::get_SI_equivalent(typename Schema::IfcNamedUnit* named_unit) {
4848
typename Schema::IfcSIUnit* si_unit = 0;
4949

5050
if (named_unit->declaration().is(Schema::IfcConversionBasedUnit::Class())) {
51-
typename Schema::IfcConversionBasedUnit* conv_unit = named_unit->as<typename Schema::IfcConversionBasedUnit>();
51+
typename Schema::IfcConversionBasedUnit* conv_unit = named_unit->template as<typename Schema::IfcConversionBasedUnit>();
5252
typename Schema::IfcMeasureWithUnit* factor = conv_unit->ConversionFactor();
5353
typename Schema::IfcUnit* component = factor->UnitComponent();
5454
if (component->declaration().is(Schema::IfcSIUnit::Class())) {
55-
si_unit = component->as<typename Schema::IfcSIUnit>();
55+
si_unit = component->template as<typename Schema::IfcSIUnit>();
5656
typename Schema::IfcValue* v = factor->ValueComponent();
5757
scale = *v->data().getArgument(0);
5858
}
5959
} else if (named_unit->declaration().is(Schema::IfcSIUnit::Class())) {
60-
si_unit = named_unit->as<typename Schema::IfcSIUnit>();
60+
si_unit = named_unit->template as<typename Schema::IfcSIUnit>();
6161
}
6262
if (si_unit) {
6363
if (si_unit->hasPrefix()) {

src/ifcparse/IfcSchema.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ namespace IfcParse {
135135
, schema_(0)
136136
{}
137137

138+
virtual ~declaration() {}
139+
138140
const std::string& name() const { return name_; }
139141
const std::string& name_lc() const { return name_lower_; }
140142

@@ -232,7 +234,7 @@ namespace IfcParse {
232234
{}
233235

234236
const std::string& name() const { return name_; }
235-
aggregate_type type_of_aggregation() const { type_of_aggregation_; }
237+
aggregate_type type_of_aggregation() const { return type_of_aggregation_; }
236238
int bound1() const { return bound1_; }
237239
int bound2() const { return bound2_; }
238240
const entity* entity_reference() const { return entity_reference_; }
@@ -358,7 +360,7 @@ namespace IfcParse {
358360
index = std::distance(current->attributes().begin(), it);
359361
}
360362
}
361-
} while ((current = current->supertype_));
363+
} while ((current = current->supertype_) != 0);
362364
return index;
363365
}
364366

@@ -376,7 +378,7 @@ namespace IfcParse {
376378
index = std::distance(current->attributes().begin(), it);
377379
}
378380
}
379-
} while ((current = current->supertype_));
381+
} while ((current = current->supertype_) != 0);
380382
return index;
381383
}
382384

0 commit comments

Comments
 (0)