Sprinkle with template and typename keywords

This commit is contained in:
Thomas Krijnen
2017-12-22 16:45:02 +01:00
parent 472fde5599
commit 5e23086947
8 changed files with 20 additions and 12 deletions
+3 -1
View File
@@ -40,7 +40,7 @@ struct %(schema_name)s {
static const IfcParse::schema_definition& get_schema(); static const IfcParse::schema_definition& get_schema();
static const char* const Identifier = "%(schema_name_upper)s"; static const char* const Identifier;
// Forward definitions // Forward definitions
%(forward_definitions)s %(forward_definitions)s
@@ -75,6 +75,8 @@ implementation= """
#include <map> #include <map>
const char* const %(schema_name)s::Identifier = "%(schema_name_upper)s";
using namespace IfcParse; using namespace IfcParse;
using namespace IfcWrite; using namespace IfcWrite;
+2
View File
@@ -31,6 +31,8 @@
#include <map> #include <map>
const char* const Ifc2x3::Identifier = "IFC2X3";
using namespace IfcParse; using namespace IfcParse;
using namespace IfcWrite; using namespace IfcWrite;
File diff suppressed because one or more lines are too long
+2
View File
@@ -31,6 +31,8 @@
#include <map> #include <map>
const char* const Ifc4::Identifier = "IFC4";
using namespace IfcParse; using namespace IfcParse;
using namespace IfcWrite; using namespace IfcWrite;
+1 -1
View File
File diff suppressed because one or more lines are too long
+3 -3
View File
@@ -187,12 +187,12 @@ class IFC_PARSE_API IfcFileWithSchema : public IfcFile {
public: public:
std::pair<typename Schema::IfcNamedUnit*, double> getUnit(typename Schema::IfcUnitEnum::Value unit_type) { std::pair<typename Schema::IfcNamedUnit*, double> getUnit(typename Schema::IfcUnitEnum::Value unit_type) {
std::pair<IfcUtil::IfcBaseClass*, double> unit_info = IfcFile::getUnit(Schema::IfcUnitEnum::ToString(unit_type)); std::pair<IfcUtil::IfcBaseClass*, double> unit_info = IfcFile::getUnit(Schema::IfcUnitEnum::ToString(unit_type));
return std::make_pair(unit_info.first->as<typename Schema::IfcNamedUnit>(), unit_info.second); return std::make_pair(unit_info.first->template as<typename Schema::IfcNamedUnit>(), unit_info.second);
} }
/// Returns the entity with the specified GlobalId /// Returns the entity with the specified GlobalId
virtual typename Schema::IfcRoot::list::ptr instance_by_guid(const std::string& guid) { virtual typename Schema::IfcRoot* instance_by_guid(const std::string& guid) {
return IfcFile::instance_by_guid(guid)->as<typename Schema::IfcRoot>(); return IfcFile::instance_by_guid(guid)->template as<typename Schema::IfcRoot>();
} }
}; };
+3 -3
View File
@@ -48,16 +48,16 @@ double IfcParse::get_SI_equivalent(typename Schema::IfcNamedUnit* named_unit) {
typename Schema::IfcSIUnit* si_unit = 0; typename Schema::IfcSIUnit* si_unit = 0;
if (named_unit->declaration().is(Schema::IfcConversionBasedUnit::Class())) { if (named_unit->declaration().is(Schema::IfcConversionBasedUnit::Class())) {
typename Schema::IfcConversionBasedUnit* conv_unit = named_unit->as<typename Schema::IfcConversionBasedUnit>(); typename Schema::IfcConversionBasedUnit* conv_unit = named_unit->template as<typename Schema::IfcConversionBasedUnit>();
typename Schema::IfcMeasureWithUnit* factor = conv_unit->ConversionFactor(); typename Schema::IfcMeasureWithUnit* factor = conv_unit->ConversionFactor();
typename Schema::IfcUnit* component = factor->UnitComponent(); typename Schema::IfcUnit* component = factor->UnitComponent();
if (component->declaration().is(Schema::IfcSIUnit::Class())) { if (component->declaration().is(Schema::IfcSIUnit::Class())) {
si_unit = component->as<typename Schema::IfcSIUnit>(); si_unit = component->template as<typename Schema::IfcSIUnit>();
typename Schema::IfcValue* v = factor->ValueComponent(); typename Schema::IfcValue* v = factor->ValueComponent();
scale = *v->data().getArgument(0); scale = *v->data().getArgument(0);
} }
} else if (named_unit->declaration().is(Schema::IfcSIUnit::Class())) { } else if (named_unit->declaration().is(Schema::IfcSIUnit::Class())) {
si_unit = named_unit->as<typename Schema::IfcSIUnit>(); si_unit = named_unit->template as<typename Schema::IfcSIUnit>();
} }
if (si_unit) { if (si_unit) {
if (si_unit->hasPrefix()) { if (si_unit->hasPrefix()) {
+5 -3
View File
@@ -135,6 +135,8 @@ namespace IfcParse {
, schema_(0) , schema_(0)
{} {}
virtual ~declaration() {}
const std::string& name() const { return name_; } const std::string& name() const { return name_; }
const std::string& name_lc() const { return name_lower_; } const std::string& name_lc() const { return name_lower_; }
@@ -232,7 +234,7 @@ namespace IfcParse {
{} {}
const std::string& name() const { return name_; } const std::string& name() const { return name_; }
aggregate_type type_of_aggregation() const { type_of_aggregation_; } aggregate_type type_of_aggregation() const { return type_of_aggregation_; }
int bound1() const { return bound1_; } int bound1() const { return bound1_; }
int bound2() const { return bound2_; } int bound2() const { return bound2_; }
const entity* entity_reference() const { return entity_reference_; } const entity* entity_reference() const { return entity_reference_; }
@@ -358,7 +360,7 @@ namespace IfcParse {
index = std::distance(current->attributes().begin(), it); index = std::distance(current->attributes().begin(), it);
} }
} }
} while ((current = current->supertype_)); } while ((current = current->supertype_) != 0);
return index; return index;
} }
@@ -376,7 +378,7 @@ namespace IfcParse {
index = std::distance(current->attributes().begin(), it); index = std::distance(current->attributes().begin(), it);
} }
} }
} while ((current = current->supertype_)); } while ((current = current->supertype_) != 0);
return index; return index;
} }