Skip to content

Commit 16a82f0

Browse files
committed
templates.py: disable C4100 warnings for headers created by this file + move <map> inclusion to .cpp as it's not needed in .h + use spaces instead of tabs consistently for these files as seems to be the convention.
1 parent b562508 commit 16a82f0

File tree

8 files changed

+111
-79
lines changed

8 files changed

+111
-79
lines changed

src/ifcexpressparser/README.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ the IFC schema and will most likely fail on any other Express schema.
44

55
The code can be invoked in the following way and results in two header files
66
and a single implementation file named according to the schema name in the
7-
Express file. A python 3 interpreter with the pyparsing library is required.
7+
Express file. A python 3 interpreter with the pyparsing [1] library is required.
88

99
$ python bootstrap.py express.bnf > express_parser.py && python express_parser.py IFC2X3_TC1.exp
10+
11+
[1] http://pyparsing.wikispaces.com/Download+and+Installation

src/ifcexpressparser/templates.py

Lines changed: 36 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,18 @@
2323
2424
#include <string>
2525
#include <vector>
26-
#include <map>
2726
2827
#include <boost/optional.hpp>
2928
3029
#include "../ifcparse/IfcUtil.h"
3130
#include "../ifcparse/IfcException.h"
3231
#include "../ifcparse/%(schema_name)senum.h"
3332
33+
#ifdef _MSC_VER
34+
#pragma warning(push)
35+
#pragma warning(disable : 4100)
36+
#endif
37+
3438
#define IfcSchema %(schema_name)s
3539
3640
namespace %(schema_name)s {
@@ -47,6 +51,10 @@
4751
IfcUtil::IfcBaseClass* SchemaEntity(IfcAbstractEntity* e = 0);
4852
}
4953
54+
#ifdef _MSC_VER
55+
#pragma warning(pop)
56+
#endif
57+
5058
#endif
5159
"""
5260

@@ -107,6 +115,8 @@
107115
#include "../ifcparse/IfcWrite.h"
108116
#include "../ifcparse/IfcWritableEntity.h"
109117
118+
#include <map>
119+
110120
using namespace %(schema_name)s;
111121
using namespace IfcParse;
112122
using namespace IfcWrite;
@@ -261,49 +271,49 @@
261271
}
262272
263273
std::pair<Type::Enum, unsigned> Type::GetInverseAttribute(Enum t, const std::string& a) {
264-
if (inverse_map.empty()) ::InitInverseMap();
265-
inverse_map_t::const_iterator it;
266-
inverse_map_t::mapped_type::const_iterator jt;
267-
while (true) {
274+
if (inverse_map.empty()) ::InitInverseMap();
275+
inverse_map_t::const_iterator it;
276+
inverse_map_t::mapped_type::const_iterator jt;
277+
for(;;) {
268278
it = inverse_map.find(t);
269279
if (it != inverse_map.end()) {
270-
jt = it->second.find(a);
271-
if (jt != it->second.end()) {
272-
return jt->second;
273-
}
274-
}
280+
jt = it->second.find(a);
281+
if (jt != it->second.end()) {
282+
return jt->second;
283+
}
284+
}
275285
if ((t = Parent(t)) == -1) break;
276286
}
277287
throw IfcException("Attribute not found");
278288
}
279289
280290
std::set<std::string> Type::GetInverseAttributeNames(Enum t) {
281-
if (inverse_map.empty()) ::InitInverseMap();
282-
inverse_map_t::const_iterator it;
283-
inverse_map_t::mapped_type::const_iterator jt;
291+
if (inverse_map.empty()) ::InitInverseMap();
292+
inverse_map_t::const_iterator it;
293+
inverse_map_t::mapped_type::const_iterator jt;
284294
285-
std::set<std::string> return_value;
295+
std::set<std::string> return_value;
286296
287-
while (true) {
297+
for (;;) {
288298
it = inverse_map.find(t);
289299
if (it != inverse_map.end()) {
290-
for (jt = it->second.begin(); jt != it->second.end(); ++jt) {
291-
return_value.insert(jt->first);
292-
}
293-
}
300+
for (jt = it->second.begin(); jt != it->second.end(); ++jt) {
301+
return_value.insert(jt->first);
302+
}
303+
}
294304
if ((t = Parent(t)) == -1) break;
295305
}
296-
297-
return return_value;
306+
307+
return return_value;
298308
}
299309
300310
void Type::PopulateDerivedFields(IfcWrite::IfcWritableEntity* e) {
301311
std::map<Type::Enum, std::set<int> >::const_iterator i = derived_map.find(e->type());
302-
if (i != derived_map.end()) {
303-
for (std::set<int>::const_iterator it = i->second.begin(); it != i->second.end(); ++it) {
304-
e->setArgumentDerived(*it);
305-
}
306-
}
312+
if (i != derived_map.end()) {
313+
for (std::set<int>::const_iterator it = i->second.begin(); it != i->second.end(); ++it) {
314+
e->setArgumentDerived(*it);
315+
}
316+
}
307317
}
308318
"""
309319

src/ifcparse/Ifc2x3-latebound.cpp

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4247,48 +4247,48 @@ std::pair<const char*, int> Type::GetEnumerationIndex(Enum t, const std::string&
42474247
}
42484248

42494249
std::pair<Type::Enum, unsigned> Type::GetInverseAttribute(Enum t, const std::string& a) {
4250-
if (inverse_map.empty()) ::InitInverseMap();
4251-
inverse_map_t::const_iterator it;
4252-
inverse_map_t::mapped_type::const_iterator jt;
4253-
for (;;) {
4250+
if (inverse_map.empty()) ::InitInverseMap();
4251+
inverse_map_t::const_iterator it;
4252+
inverse_map_t::mapped_type::const_iterator jt;
4253+
for(;;) {
42544254
it = inverse_map.find(t);
42554255
if (it != inverse_map.end()) {
4256-
jt = it->second.find(a);
4257-
if (jt != it->second.end()) {
4258-
return jt->second;
4259-
}
4260-
}
4256+
jt = it->second.find(a);
4257+
if (jt != it->second.end()) {
4258+
return jt->second;
4259+
}
4260+
}
42614261
if ((t = Parent(t)) == -1) break;
42624262
}
42634263
throw IfcException("Attribute not found");
42644264
}
42654265

42664266
std::set<std::string> Type::GetInverseAttributeNames(Enum t) {
4267-
if (inverse_map.empty()) ::InitInverseMap();
4268-
inverse_map_t::const_iterator it;
4269-
inverse_map_t::mapped_type::const_iterator jt;
4267+
if (inverse_map.empty()) ::InitInverseMap();
4268+
inverse_map_t::const_iterator it;
4269+
inverse_map_t::mapped_type::const_iterator jt;
42704270

4271-
std::set<std::string> return_value;
4271+
std::set<std::string> return_value;
42724272

4273-
for (;;) {
4273+
for (;;) {
42744274
it = inverse_map.find(t);
42754275
if (it != inverse_map.end()) {
4276-
for (jt = it->second.begin(); jt != it->second.end(); ++jt) {
4277-
return_value.insert(jt->first);
4278-
}
4279-
}
4276+
for (jt = it->second.begin(); jt != it->second.end(); ++jt) {
4277+
return_value.insert(jt->first);
4278+
}
4279+
}
42804280
if ((t = Parent(t)) == -1) break;
42814281
}
4282-
4283-
return return_value;
4282+
4283+
return return_value;
42844284
}
42854285

42864286
void Type::PopulateDerivedFields(IfcWrite::IfcWritableEntity* e) {
42874287
std::map<Type::Enum, std::set<int> >::const_iterator i = derived_map.find(e->type());
4288-
if (i != derived_map.end()) {
4289-
for (std::set<int>::const_iterator it = i->second.begin(); it != i->second.end(); ++it) {
4290-
e->setArgumentDerived(*it);
4291-
}
4292-
}
4288+
if (i != derived_map.end()) {
4289+
for (std::set<int>::const_iterator it = i->second.begin(); it != i->second.end(); ++it) {
4290+
e->setArgumentDerived(*it);
4291+
}
4292+
}
42934293
}
42944294
#endif

src/ifcparse/Ifc2x3.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
#include "../ifcparse/IfcWrite.h"
3232
#include "../ifcparse/IfcWritableEntity.h"
3333

34+
#include <map>
35+
3436
using namespace Ifc2x3;
3537
using namespace IfcParse;
3638
using namespace IfcWrite;

src/ifcparse/Ifc2x3.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,18 @@
2929

3030
#include <string>
3131
#include <vector>
32-
#include <map>
3332

3433
#include <boost/optional.hpp>
3534

3635
#include "../ifcparse/IfcUtil.h"
3736
#include "../ifcparse/IfcException.h"
3837
#include "../ifcparse/Ifc2x3enum.h"
3938

39+
#ifdef _MSC_VER
40+
#pragma warning(push)
41+
#pragma warning(disable : 4100)
42+
#endif
43+
4044
#define IfcSchema Ifc2x3
4145

4246
namespace Ifc2x3 {
@@ -41583,4 +41587,8 @@ void InitStringMap();
4158341587
IfcUtil::IfcBaseClass* SchemaEntity(IfcAbstractEntity* e = 0);
4158441588
}
4158541589

41590+
#ifdef _MSC_VER
41591+
#pragma warning(pop)
41592+
#endif
41593+
4158641594
#endif

src/ifcparse/Ifc4-latebound.cpp

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4941,48 +4941,48 @@ std::pair<const char*, int> Type::GetEnumerationIndex(Enum t, const std::string&
49414941
}
49424942

49434943
std::pair<Type::Enum, unsigned> Type::GetInverseAttribute(Enum t, const std::string& a) {
4944-
if (inverse_map.empty()) ::InitInverseMap();
4945-
inverse_map_t::const_iterator it;
4946-
inverse_map_t::mapped_type::const_iterator jt;
4947-
while (true) {
4944+
if (inverse_map.empty()) ::InitInverseMap();
4945+
inverse_map_t::const_iterator it;
4946+
inverse_map_t::mapped_type::const_iterator jt;
4947+
for(;;) {
49484948
it = inverse_map.find(t);
49494949
if (it != inverse_map.end()) {
4950-
jt = it->second.find(a);
4951-
if (jt != it->second.end()) {
4952-
return jt->second;
4953-
}
4954-
}
4950+
jt = it->second.find(a);
4951+
if (jt != it->second.end()) {
4952+
return jt->second;
4953+
}
4954+
}
49554955
if ((t = Parent(t)) == -1) break;
49564956
}
49574957
throw IfcException("Attribute not found");
49584958
}
49594959

49604960
std::set<std::string> Type::GetInverseAttributeNames(Enum t) {
4961-
if (inverse_map.empty()) ::InitInverseMap();
4962-
inverse_map_t::const_iterator it;
4963-
inverse_map_t::mapped_type::const_iterator jt;
4961+
if (inverse_map.empty()) ::InitInverseMap();
4962+
inverse_map_t::const_iterator it;
4963+
inverse_map_t::mapped_type::const_iterator jt;
49644964

4965-
std::set<std::string> return_value;
4965+
std::set<std::string> return_value;
49664966

4967-
while (true) {
4967+
for (;;) {
49684968
it = inverse_map.find(t);
49694969
if (it != inverse_map.end()) {
4970-
for (jt = it->second.begin(); jt != it->second.end(); ++jt) {
4971-
return_value.insert(jt->first);
4972-
}
4973-
}
4970+
for (jt = it->second.begin(); jt != it->second.end(); ++jt) {
4971+
return_value.insert(jt->first);
4972+
}
4973+
}
49744974
if ((t = Parent(t)) == -1) break;
49754975
}
4976-
4977-
return return_value;
4976+
4977+
return return_value;
49784978
}
49794979

49804980
void Type::PopulateDerivedFields(IfcWrite::IfcWritableEntity* e) {
49814981
std::map<Type::Enum, std::set<int> >::const_iterator i = derived_map.find(e->type());
4982-
if (i != derived_map.end()) {
4983-
for (std::set<int>::const_iterator it = i->second.begin(); it != i->second.end(); ++it) {
4984-
e->setArgumentDerived(*it);
4985-
}
4986-
}
4982+
if (i != derived_map.end()) {
4983+
for (std::set<int>::const_iterator it = i->second.begin(); it != i->second.end(); ++it) {
4984+
e->setArgumentDerived(*it);
4985+
}
4986+
}
49874987
}
49884988
#endif

src/ifcparse/Ifc4.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
#include "../ifcparse/IfcWrite.h"
3232
#include "../ifcparse/IfcWritableEntity.h"
3333

34+
#include <map>
35+
3436
using namespace Ifc4;
3537
using namespace IfcParse;
3638
using namespace IfcWrite;

src/ifcparse/Ifc4.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,18 @@
2929

3030
#include <string>
3131
#include <vector>
32-
#include <map>
3332

3433
#include <boost/optional.hpp>
3534

3635
#include "../ifcparse/IfcUtil.h"
3736
#include "../ifcparse/IfcException.h"
3837
#include "../ifcparse/Ifc4enum.h"
3938

39+
#ifdef _MSC_VER
40+
#pragma warning(push)
41+
#pragma warning(disable : 4100)
42+
#endif
43+
4044
#define IfcSchema Ifc4
4145

4246
namespace Ifc4 {
@@ -55147,4 +55151,8 @@ void InitStringMap();
5514755151
IfcUtil::IfcBaseClass* SchemaEntity(IfcAbstractEntity* e = 0);
5514855152
}
5514955153

55154+
#ifdef _MSC_VER
55155+
#pragma warning(pop)
55156+
#endif
55157+
5515055158
#endif

0 commit comments

Comments
 (0)