@@ -168,9 +168,9 @@ def __str__(self):
168168 return "typedef %s %s;" % (self .type ,self .name )
169169 elif generator_mode == 'SOURCE' and isinstance (self .type ,EnumType ):
170170 generator_mode = 'SOURCE_TO'
171- s = "std::string %(name)s::ToString(%(name)s v) {\n if ( v < 0 || v >= %(len)d ) throw;\n const char* names[] = %(type)s;\n return names[v];\n }\n " % self .__dict__
171+ s = "std::string %(name)s::ToString(%(name)s v) {\n if ( v < 0 || v >= %(len)d ) throw IfcException( \" Unable to find find keyword in schema \" ) ;\n const char* names[] = %(type)s;\n return names[v];\n }\n " % self .__dict__
172172 generator_mode = 'SOURCE_FROM'
173- s += ("%(name)s::%(name)s %(name)s::FromString(const std::string& s) {\n %(type)s throw;\n }" % self .__dict__ )% self .__dict__
173+ s += ("%(name)s::%(name)s %(name)s::FromString(const std::string& s) {\n %(type)s throw IfcException( \" Unable to find find keyword in schema\) ;\n }" % self .__dict__ )% self .__dict__
174174 generator_mode = 'SOURCE'
175175 return s
176176class Argument (object ):
@@ -252,7 +252,7 @@ def __str__(self):
252252 "\n bool %(class_name)s::is(Type::Enum v) const { return v == Type::%(class_name)s || %(parent_class)s::is(v); }" )+
253253 "\n Type::Enum %(class_name)s::type() const { return Type::%(class_name)s; }" +
254254 "\n Type::Enum %(class_name)s::Class() { return Type::%(class_name)s; }" +
255- "\n %(class_name)s::%(class_name)s(IfcAbstractEntityPtr e) { if (!is(Type::%(class_name)s)) throw; entity = e; }" )% self .__dict__ )% self .__dict__
255+ "\n %(class_name)s::%(class_name)s(IfcAbstractEntityPtr e) { if (!is(Type::%(class_name)s)) throw IfcException( \" Unable to find find keyword in schema \" ) ; entity = e; }" )% self .__dict__ )% self .__dict__
256256
257257
258258from funcparserlib .parser import a , skip , many , maybe , some
@@ -427,8 +427,10 @@ def __str__(self):
427427generator_mode = 'SOURCE'
428428
429429print >> cpp_file , """#include "%(schema)s.h"
430+ #include "IfcException.h"
430431
431432using namespace %(schema)s;
433+ using namespace IfcParse;
432434
433435IfcSchemaEntity %(schema)s::SchemaEntity(IfcAbstractEntityPtr e) {
434436 switch(e->type()){""" % {'schema' :schema_version }
@@ -437,11 +439,11 @@ def __str__(self):
437439 print >> cpp_file , " case Type::%s: return new IfcEntitySelect(e); break;" % e
438440for e in entity_enumerations :
439441 print >> cpp_file , " case Type::%s: return new %s(e); break;" % (e ,e )
440- print >> cpp_file , " default: throw; break; "
442+ print >> cpp_file , " default: throw IfcException( \" Unable to find find keyword in schema \" ) ; break; "
441443print >> cpp_file , " }\n }"
442444print >> cpp_file
443445print >> cpp_file , "std::string Type::ToString(Enum v) {"
444- print >> cpp_file , " if (v < 0 || v >= %d) throw;" % len (all_enumerations )
446+ print >> cpp_file , " if (v < 0 || v >= %d) throw IfcException( \" Unable to find find keyword in schema \" ) ;" % len (all_enumerations )
445447print >> cpp_file , ' const char* names[] = { "%s" };' % '","' .join (all_enumerations )
446448print >> cpp_file , ' return names[v];'
447449print >> cpp_file , "}"
@@ -461,7 +463,7 @@ def __str__(self):
461463print >> cpp_file , """}
462464Type::Enum Type::FromString(const std::string& s) {
463465 std::map<std::string,Type::Enum>::const_iterator it = string_map.find(s);
464- if ( it == string_map.end() ) throw;
466+ if ( it == string_map.end() ) throw IfcException("Unable to find find keyword in schema") ;
465467 else return it->second;
466468}"""
467469
0 commit comments