File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -57,13 +57,15 @@ namespace webifc::parsing {
5757 auto line = GetHeaderLinesWithType (schema::FILE_SCHEMA )[0 ];
5858 MoveToHeaderLineArgument (line, 0 );
5959 auto schemas = _schemaManager.GetAvailableSchemas ();
60+ auto schemaMaps = _schemaManager.GetAvailableSchemaMaps ();
6061
6162 while (!_tokenStream->IsAtEnd ()) {
6263 IfcTokenType t = static_cast <IfcTokenType>(_tokenStream->Read <char >());
6364 if (t == IfcTokenType::LINE_END ) break ;
6465 if (t == IfcTokenType::LABEL )
6566 {
6667 std::string_view schemaName = _tokenStream->ReadString ();
68+ if (schemaMaps.contains (schemaName)) schemaName = schemaMaps[schemaName];
6769 for (size_t i = 0 ; i < schemas.size ();i++)
6870 {
6971 if (_schemaManager.GetSchemaName (schemas[i]) == schemaName) return schemas[i];
Original file line number Diff line number Diff line change @@ -32,6 +32,11 @@ namespace webifc::schema {
3232 return _schemas;
3333 }
3434
35+ const std::map<std::string_view,std::string_view> &IfcSchemaManager::GetAvailableSchemaMaps () const
36+ {
37+ return _schemaMap;
38+ }
39+
3540 uint32_t IfcSchemaManager::IfcTypeToTypeCode (std::string_view name) const
3641 {
3742 return IfcTypeToTypeCode (name.data (),name.size ());
Original file line number Diff line number Diff line change 66
77#include " ifc-schema.h"
88#include < vector>
9+ #include < map>
910#include < string>
1011#include < string_view>
1112#include < unordered_set>
@@ -17,6 +18,7 @@ namespace webifc::schema {
1718 public:
1819 IfcSchemaManager ();
1920 const std::vector<IFC_SCHEMA > GetAvailableSchemas () const ;
21+ const std::map<std::string_view,std::string_view> &GetAvailableSchemaMaps () const ;
2022 std::string_view GetSchemaName (IFC_SCHEMA schema) const ;
2123 uint32_t IfcTypeToTypeCode (const std::string_view name) const ;
2224 std::string IfcTypeCodeToType (const uint32_t typeCode) const ;
@@ -27,6 +29,7 @@ namespace webifc::schema {
2729 std::unordered_set<uint32_t > _ifcElements;
2830 std::vector<IFC_SCHEMA > _schemas;
2931 std::vector<std::string_view> _schemaNames;
32+ std::map<std::string_view,std::string_view> _schemaMap;
3033 void initSchemaData ();
3134 uint32_t IfcTypeToTypeCode (const void * name, const size_t len) const ;
3235 };
Original file line number Diff line number Diff line change 44#include " IfcSchemaManager.h"
55namespace webifc ::schema {
66void IfcSchemaManager::initSchemaData () {
7+ _schemaMap[" IFC2X_FINAL" ]=" IFC2X3" ;
8+ _schemaMap[" IFC4X1" ]=" IFC4X3" ;
9+ _schemaMap[" IFC4X2" ]=" IFC4X3" ;
10+ _schemaMap[" IFC4X3_RC3" ]=" IFC4X3" ;
11+ _schemaMap[" IFC4X3_RC4" ]=" IFC4X3" ;
12+ _schemaMap[" IFC4X3_RC1" ]=" IFC4X3" ;
13+ _schemaMap[" IFC4X3_RC2" ]=" IFC4X3" ;
14+ _schemaMap[" IFC4X3_ADD2" ]=" IFC4X3" ;
15+ _schemaMap[" IFC4X3_ADD1" ]=" IFC4X3" ;
16+ _schemaMap[" IFC4X2SCGL" ]=" IFC4X3" ;
717_ifcElements.insert (IFCPRODUCT );
818_ifcElements.insert (IFCPROXY );
919_ifcElements.insert (IFCSPATIALSTRUCTUREELEMENT );
Original file line number Diff line number Diff line change @@ -354,7 +354,9 @@ cppSchema.push("#include <string>");
354354cppSchema . push ( "#include \"ifc-schema.h\"" ) ;
355355cppSchema . push ( "#include \"IfcSchemaManager.h\"" ) ;
356356cppSchema . push ( "namespace webifc::schema {" )
357+
357358cppSchema . push ( "void IfcSchemaManager::initSchemaData() {" ) ;
359+ for ( const schemaAlias of schemaAliases ) cppSchema . push ( `_schemaMap["${ schemaAlias . schemaName } "]="${ schemaAlias . alias } ";` ) ;
358360completeifcElementList . forEach ( element => {
359361 cppSchema . push ( `_ifcElements.insert(${ element . toUpperCase ( ) } );` ) ;
360362} ) ;
You can’t perform that action at this time.
0 commit comments