mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-30 20:19:59 +00:00
Merge remote-tracking branch 'official/master'
Conflicts: src/ifcconvert/IfcConvert.cpp src/ifcgeom/IfcGeomIterator.h
This commit is contained in:
@@ -4247,48 +4247,48 @@ std::pair<const char*, int> Type::GetEnumerationIndex(Enum t, const std::string&
|
||||
}
|
||||
|
||||
std::pair<Type::Enum, unsigned> Type::GetInverseAttribute(Enum t, const std::string& a) {
|
||||
if (inverse_map.empty()) ::InitInverseMap();
|
||||
inverse_map_t::const_iterator it;
|
||||
inverse_map_t::mapped_type::const_iterator jt;
|
||||
while (true) {
|
||||
if (inverse_map.empty()) ::InitInverseMap();
|
||||
inverse_map_t::const_iterator it;
|
||||
inverse_map_t::mapped_type::const_iterator jt;
|
||||
for(;;) {
|
||||
it = inverse_map.find(t);
|
||||
if (it != inverse_map.end()) {
|
||||
jt = it->second.find(a);
|
||||
if (jt != it->second.end()) {
|
||||
return jt->second;
|
||||
}
|
||||
}
|
||||
jt = it->second.find(a);
|
||||
if (jt != it->second.end()) {
|
||||
return jt->second;
|
||||
}
|
||||
}
|
||||
if ((t = Parent(t)) == -1) break;
|
||||
}
|
||||
throw IfcException("Attribute not found");
|
||||
}
|
||||
|
||||
std::set<std::string> Type::GetInverseAttributeNames(Enum t) {
|
||||
if (inverse_map.empty()) ::InitInverseMap();
|
||||
inverse_map_t::const_iterator it;
|
||||
inverse_map_t::mapped_type::const_iterator jt;
|
||||
if (inverse_map.empty()) ::InitInverseMap();
|
||||
inverse_map_t::const_iterator it;
|
||||
inverse_map_t::mapped_type::const_iterator jt;
|
||||
|
||||
std::set<std::string> return_value;
|
||||
std::set<std::string> return_value;
|
||||
|
||||
while (true) {
|
||||
for (;;) {
|
||||
it = inverse_map.find(t);
|
||||
if (it != inverse_map.end()) {
|
||||
for (jt = it->second.begin(); jt != it->second.end(); ++jt) {
|
||||
return_value.insert(jt->first);
|
||||
}
|
||||
}
|
||||
for (jt = it->second.begin(); jt != it->second.end(); ++jt) {
|
||||
return_value.insert(jt->first);
|
||||
}
|
||||
}
|
||||
if ((t = Parent(t)) == -1) break;
|
||||
}
|
||||
|
||||
return return_value;
|
||||
|
||||
return return_value;
|
||||
}
|
||||
|
||||
void Type::PopulateDerivedFields(IfcWrite::IfcWritableEntity* e) {
|
||||
std::map<Type::Enum, std::set<int> >::const_iterator i = derived_map.find(e->type());
|
||||
if (i != derived_map.end()) {
|
||||
for (std::set<int>::const_iterator it = i->second.begin(); it != i->second.end(); ++it) {
|
||||
e->setArgumentDerived(*it);
|
||||
}
|
||||
}
|
||||
if (i != derived_map.end()) {
|
||||
for (std::set<int>::const_iterator it = i->second.begin(); it != i->second.end(); ++it) {
|
||||
e->setArgumentDerived(*it);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
#include "../ifcparse/IfcWrite.h"
|
||||
#include "../ifcparse/IfcWritableEntity.h"
|
||||
|
||||
#include <map>
|
||||
|
||||
using namespace Ifc2x3;
|
||||
using namespace IfcParse;
|
||||
using namespace IfcWrite;
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
@@ -37,6 +36,11 @@
|
||||
#include "../ifcparse/IfcException.h"
|
||||
#include "../ifcparse/Ifc2x3enum.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4100)
|
||||
#endif
|
||||
|
||||
#define IfcSchema Ifc2x3
|
||||
|
||||
namespace Ifc2x3 {
|
||||
@@ -41583,4 +41587,8 @@ void InitStringMap();
|
||||
IfcUtil::IfcBaseClass* SchemaEntity(IfcAbstractEntity* e = 0);
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -4941,48 +4941,48 @@ std::pair<const char*, int> Type::GetEnumerationIndex(Enum t, const std::string&
|
||||
}
|
||||
|
||||
std::pair<Type::Enum, unsigned> Type::GetInverseAttribute(Enum t, const std::string& a) {
|
||||
if (inverse_map.empty()) ::InitInverseMap();
|
||||
inverse_map_t::const_iterator it;
|
||||
inverse_map_t::mapped_type::const_iterator jt;
|
||||
while (true) {
|
||||
if (inverse_map.empty()) ::InitInverseMap();
|
||||
inverse_map_t::const_iterator it;
|
||||
inverse_map_t::mapped_type::const_iterator jt;
|
||||
for(;;) {
|
||||
it = inverse_map.find(t);
|
||||
if (it != inverse_map.end()) {
|
||||
jt = it->second.find(a);
|
||||
if (jt != it->second.end()) {
|
||||
return jt->second;
|
||||
}
|
||||
}
|
||||
jt = it->second.find(a);
|
||||
if (jt != it->second.end()) {
|
||||
return jt->second;
|
||||
}
|
||||
}
|
||||
if ((t = Parent(t)) == -1) break;
|
||||
}
|
||||
throw IfcException("Attribute not found");
|
||||
}
|
||||
|
||||
std::set<std::string> Type::GetInverseAttributeNames(Enum t) {
|
||||
if (inverse_map.empty()) ::InitInverseMap();
|
||||
inverse_map_t::const_iterator it;
|
||||
inverse_map_t::mapped_type::const_iterator jt;
|
||||
if (inverse_map.empty()) ::InitInverseMap();
|
||||
inverse_map_t::const_iterator it;
|
||||
inverse_map_t::mapped_type::const_iterator jt;
|
||||
|
||||
std::set<std::string> return_value;
|
||||
std::set<std::string> return_value;
|
||||
|
||||
while (true) {
|
||||
for (;;) {
|
||||
it = inverse_map.find(t);
|
||||
if (it != inverse_map.end()) {
|
||||
for (jt = it->second.begin(); jt != it->second.end(); ++jt) {
|
||||
return_value.insert(jt->first);
|
||||
}
|
||||
}
|
||||
for (jt = it->second.begin(); jt != it->second.end(); ++jt) {
|
||||
return_value.insert(jt->first);
|
||||
}
|
||||
}
|
||||
if ((t = Parent(t)) == -1) break;
|
||||
}
|
||||
|
||||
return return_value;
|
||||
|
||||
return return_value;
|
||||
}
|
||||
|
||||
void Type::PopulateDerivedFields(IfcWrite::IfcWritableEntity* e) {
|
||||
std::map<Type::Enum, std::set<int> >::const_iterator i = derived_map.find(e->type());
|
||||
if (i != derived_map.end()) {
|
||||
for (std::set<int>::const_iterator it = i->second.begin(); it != i->second.end(); ++it) {
|
||||
e->setArgumentDerived(*it);
|
||||
}
|
||||
}
|
||||
if (i != derived_map.end()) {
|
||||
for (std::set<int>::const_iterator it = i->second.begin(); it != i->second.end(); ++it) {
|
||||
e->setArgumentDerived(*it);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
#include "../ifcparse/IfcWrite.h"
|
||||
#include "../ifcparse/IfcWritableEntity.h"
|
||||
|
||||
#include <map>
|
||||
|
||||
using namespace Ifc4;
|
||||
using namespace IfcParse;
|
||||
using namespace IfcWrite;
|
||||
|
||||
+9
-1
@@ -29,7 +29,6 @@
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
@@ -37,6 +36,11 @@
|
||||
#include "../ifcparse/IfcException.h"
|
||||
#include "../ifcparse/Ifc4enum.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4100)
|
||||
#endif
|
||||
|
||||
#define IfcSchema Ifc4
|
||||
|
||||
namespace Ifc4 {
|
||||
@@ -55147,4 +55151,8 @@ void InitStringMap();
|
||||
IfcUtil::IfcBaseClass* SchemaEntity(IfcAbstractEntity* e = 0);
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -130,12 +130,12 @@ IfcCharacterDecoder::operator std::string() {
|
||||
#ifdef HAVE_ICU
|
||||
unsigned int old_hex = 0; // for compatibility_mode
|
||||
#endif
|
||||
while ( current_char = file->Peek() ) {
|
||||
while ( (current_char = file->Peek()) != 0 ) {
|
||||
if ( EXPECTS_CHARACTER(parse_state) ) {
|
||||
#ifdef HAVE_ICU
|
||||
if ( previous_codepage != codepage ) {
|
||||
if ( converter ) ucnv_close(converter);
|
||||
char encoder[11] = {'i','s','o','-','8','8','5','9','-',codepage + 0x30};
|
||||
char encoder[11] = {'i','s','o','-','8','8','5','9','-', (char)codepage + 0x30};
|
||||
converter = ucnv_open(encoder, &status);
|
||||
}
|
||||
const char characters[2] = { current_char + 0x80 };
|
||||
@@ -188,7 +188,7 @@ IfcCharacterDecoder::operator std::string() {
|
||||
if (old_hex == 0) {
|
||||
old_hex = hex;
|
||||
} else {
|
||||
char characters[3] = { old_hex, hex };
|
||||
char characters[3] = { (char)old_hex, (char)hex };
|
||||
const char* char_array = &characters[0];
|
||||
UChar32 ch = ucnv_getNextUChar(compatibility_converter,&char_array,char_array+2,&status);
|
||||
addChar(s,ch);
|
||||
@@ -227,7 +227,7 @@ void IfcCharacterDecoder::dryRun() {
|
||||
unsigned int parse_state = 0;
|
||||
char current_char;
|
||||
unsigned int hex_count = 0;
|
||||
while ( current_char = file->Peek() ) {
|
||||
while ((current_char = file->Peek()) != 0) {
|
||||
if ( EXPECTS_CHARACTER(parse_state) ) {
|
||||
parse_state = 0;
|
||||
} else if ( current_char == '\'' && ! parse_state ) {
|
||||
@@ -340,8 +340,8 @@ IfcCharacterEncoder::operator std::string() {
|
||||
oss << "\\X" << num_bytes_str << "\\";
|
||||
}
|
||||
if ( within_spf_range ) {
|
||||
oss.put(ch);
|
||||
if ( ch == '\\' || ch == '\'' ) oss.put(ch);
|
||||
oss.put((char)ch);
|
||||
if ( ch == '\\' || ch == '\'' ) oss.put((char)ch);
|
||||
} else {
|
||||
oss << std::hex << std::setw(num_bytes*2) << std::uppercase << std::setfill('0') << (int) ch;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace IfcUtil {
|
||||
std::pair<const char*, int> getIndex(const std::string& value) const {
|
||||
std::vector<std::string>::const_iterator it = std::find(values.begin(), values.end(), value);
|
||||
if (it != values.end()) {
|
||||
return std::make_pair(it->c_str(), std::distance(it, values.begin()));
|
||||
return std::make_pair(it->c_str(), (int)std::distance(it, values.begin()));
|
||||
} else {
|
||||
throw IfcParse::IfcException("Invalid enumeration value");
|
||||
}
|
||||
@@ -91,7 +91,7 @@ namespace IfcUtil {
|
||||
arguments.push_back(IfcArgumentDescriptor(name, optional, argument_type, data_type));
|
||||
}
|
||||
unsigned getArgumentCount() const {
|
||||
return (parent ? parent->getArgumentCount() : 0) + arguments.size();
|
||||
return (parent ? parent->getArgumentCount() : 0) + (unsigned)arguments.size();
|
||||
}
|
||||
const std::string& getArgumentName(unsigned i) const {
|
||||
const unsigned a = argument_start();
|
||||
|
||||
@@ -38,7 +38,7 @@ std::string base64(unsigned v, int l) {
|
||||
r.push_back(chars[v%64]);
|
||||
v /= 64;
|
||||
}
|
||||
while ( r.size() != l ) r.push_back('0');
|
||||
while ( (int)r.size() != l ) r.push_back('0');
|
||||
std::reverse(r.begin(),r.end());
|
||||
return r;
|
||||
}
|
||||
@@ -52,7 +52,7 @@ unsigned from_base64(const std::string& s) {
|
||||
r *= 64;
|
||||
const char* c = strchr(chars,*i);
|
||||
if ( !c ) throw IfcParse::IfcException("Failed to decode GlobalId");
|
||||
r += (c-chars);
|
||||
r += (unsigned)(c-chars);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
@@ -70,7 +70,7 @@ std::string compress(unsigned char* v) {
|
||||
|
||||
// Expands the base64 representation into a UUID byte array
|
||||
void expand(const std::string& s, std::vector<unsigned char>& v) {
|
||||
v.push_back(from_base64(s.substr(0,2)));
|
||||
v.push_back((unsigned char)from_base64(s.substr(0,2)));
|
||||
for( unsigned i = 0; i < 5; ++i ) {
|
||||
unsigned d = from_base64(s.substr(2+4*i,4));
|
||||
for ( unsigned j = 0; j < 3; ++ j ) {
|
||||
|
||||
@@ -290,7 +290,7 @@ void IfcHierarchyHelper::addBox(IfcSchema::IfcShapeRepresentation* rep, double w
|
||||
IfcSchema::IfcAxis2Placement2D* place, IfcSchema::IfcAxis2Placement3D* place2,
|
||||
IfcSchema::IfcDirection* dir, IfcSchema::IfcRepresentationContext* context)
|
||||
{
|
||||
if (false) {
|
||||
if (false) { // TODO What's this?
|
||||
IfcSchema::IfcRectangleProfileDef* profile = new IfcSchema::IfcRectangleProfileDef(
|
||||
IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA, boost::none, place ? place : addPlacement2d(), w, d);
|
||||
IfcSchema::IfcExtrudedAreaSolid* solid = new IfcSchema::IfcExtrudedAreaSolid(profile,
|
||||
@@ -303,10 +303,10 @@ void IfcHierarchyHelper::addBox(IfcSchema::IfcShapeRepresentation* rep, double w
|
||||
rep->setItems(items);
|
||||
} else {
|
||||
std::vector<std::pair<double, double> > points;
|
||||
points.push_back(std::pair<double, double>(-w/2, -d/2));
|
||||
points.push_back(std::pair<double, double>(w/2, -d/2));
|
||||
points.push_back(std::pair<double, double>(w/2, d/2));
|
||||
points.push_back(std::pair<double, double>(-w/2, d/2));
|
||||
points.push_back(std::make_pair(-w/2, -d/2));
|
||||
points.push_back(std::make_pair(w/2, -d/2));
|
||||
points.push_back(std::make_pair(w/2, d/2));
|
||||
points.push_back(std::make_pair(-w/2, d/2));
|
||||
// The call to addExtrudedPolyline() closes the polyline
|
||||
addExtrudedPolyline(rep, points, h, place, place2, dir, context);
|
||||
}
|
||||
|
||||
@@ -87,35 +87,35 @@ unsigned int IfcParse::IfcLateBoundEntity::getArgumentCount() const {
|
||||
return IfcSchema::Type::GetAttributeCount(_type);
|
||||
}
|
||||
IfcUtil::ArgumentType IfcParse::IfcLateBoundEntity::getArgumentType(unsigned int i) const {
|
||||
return IfcSchema::Type::GetAttributeDerived(_type, i)
|
||||
return IfcSchema::Type::GetAttributeDerived(_type, (unsigned char)i)
|
||||
? IfcUtil::Argument_DERIVED
|
||||
: IfcSchema::Type::GetAttributeType(_type,i);
|
||||
: IfcSchema::Type::GetAttributeType(_type, (unsigned char)i);
|
||||
}
|
||||
IfcSchema::Type::Enum IfcParse::IfcLateBoundEntity::getArgumentEntity(unsigned int i) const {
|
||||
return IfcSchema::Type::GetAttributeEntity(_type, i);
|
||||
return IfcSchema::Type::GetAttributeEntity(_type, (unsigned char)i);
|
||||
}
|
||||
Argument* IfcParse::IfcLateBoundEntity::getArgument(unsigned int i) const {
|
||||
return entity->getArgument(i);
|
||||
}
|
||||
const char* IfcParse::IfcLateBoundEntity::getArgumentName(unsigned int i) const {
|
||||
return IfcSchema::Type::GetAttributeName(_type,i).c_str();
|
||||
return IfcSchema::Type::GetAttributeName(_type, (unsigned char)i).c_str();
|
||||
}
|
||||
bool IfcParse::IfcLateBoundEntity::getArgumentOptionality(unsigned int i) const {
|
||||
return IfcSchema::Type::GetAttributeOptional(_type, i);
|
||||
return IfcSchema::Type::GetAttributeOptional(_type, (unsigned char)i);
|
||||
}
|
||||
|
||||
void IfcParse::IfcLateBoundEntity::invalid_argument(unsigned int i, const std::string& t) {
|
||||
const std::string arg_name = IfcSchema::Type::GetAttributeName(_type,i);
|
||||
const std::string arg_name = IfcSchema::Type::GetAttributeName(_type, (unsigned char)i);
|
||||
throw IfcException(t + " is not a valid type for '" + arg_name + "'");
|
||||
}
|
||||
void IfcParse::IfcLateBoundEntity::setArgumentAsNull(unsigned int i) {
|
||||
bool is_optional = IfcSchema::Type::GetAttributeOptional(_type, i);
|
||||
bool is_optional = IfcSchema::Type::GetAttributeOptional(_type, (unsigned char)i);
|
||||
if (is_optional) {
|
||||
writable_entity()->setArgument(i);
|
||||
} else invalid_argument(i,"NULL");
|
||||
}
|
||||
void IfcParse::IfcLateBoundEntity::setArgumentAsInt(unsigned int i, int v) {
|
||||
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type,i);
|
||||
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type, (unsigned char)i);
|
||||
if (arg_type == Argument_INT) {
|
||||
writable_entity()->setArgument(i,v);
|
||||
} else if ( (arg_type == Argument_BOOL) && ( (v == 0) || (v == 1) ) ) {
|
||||
@@ -123,23 +123,23 @@ void IfcParse::IfcLateBoundEntity::setArgumentAsInt(unsigned int i, int v) {
|
||||
} else invalid_argument(i,"INTEGER");
|
||||
}
|
||||
void IfcParse::IfcLateBoundEntity::setArgumentAsBool(unsigned int i, bool v) {
|
||||
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type,i);
|
||||
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type, (unsigned char)i);
|
||||
if (arg_type == Argument_BOOL) {
|
||||
writable_entity()->setArgument(i,v);
|
||||
} else invalid_argument(i,"BOOLEAN");
|
||||
}
|
||||
void IfcParse::IfcLateBoundEntity::setArgumentAsDouble(unsigned int i, double v) {
|
||||
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type,i);
|
||||
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type, (unsigned char)i);
|
||||
if (arg_type == Argument_DOUBLE) {
|
||||
writable_entity()->setArgument(i,v);
|
||||
} else invalid_argument(i,"REAL");
|
||||
}
|
||||
void IfcParse::IfcLateBoundEntity::setArgumentAsString(unsigned int i, const std::string& a) {
|
||||
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type,i);
|
||||
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type, (unsigned char)i);
|
||||
if (arg_type == Argument_STRING) {
|
||||
writable_entity()->setArgument(i,a);
|
||||
} else if (arg_type == Argument_ENUMERATION) {
|
||||
std::pair<const char*, int> enum_data = IfcSchema::Type::GetEnumerationIndex(IfcSchema::Type::GetAttributeEntity(_type, i), a);
|
||||
std::pair<const char*, int> enum_data = IfcSchema::Type::GetEnumerationIndex(IfcSchema::Type::GetAttributeEntity(_type, (unsigned char)i), a);
|
||||
writable_entity()->setArgument(i, enum_data.second, enum_data.first);
|
||||
} else if (arg_type == Argument_BINARY) {
|
||||
if (valid_binary_string(a)) {
|
||||
@@ -151,19 +151,19 @@ void IfcParse::IfcLateBoundEntity::setArgumentAsString(unsigned int i, const std
|
||||
} else invalid_argument(i,"STRING");
|
||||
}
|
||||
void IfcParse::IfcLateBoundEntity::setArgumentAsAggregateOfInt(unsigned int i, const std::vector<int>& v) {
|
||||
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type,i);
|
||||
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type, (unsigned char)i);
|
||||
if (arg_type == Argument_AGGREGATE_OF_INT) {
|
||||
writable_entity()->setArgument(i,v);
|
||||
} else invalid_argument(i,"AGGREGATE OF INT");
|
||||
}
|
||||
void IfcParse::IfcLateBoundEntity::setArgumentAsAggregateOfDouble(unsigned int i, const std::vector<double>& v) {
|
||||
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type,i);
|
||||
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type, (unsigned char)i);
|
||||
if (arg_type == Argument_AGGREGATE_OF_DOUBLE) {
|
||||
writable_entity()->setArgument(i,v);
|
||||
} else invalid_argument(i,"AGGREGATE OF DOUBLE");
|
||||
}
|
||||
void IfcParse::IfcLateBoundEntity::setArgumentAsAggregateOfString(unsigned int i, const std::vector<std::string>& v) {
|
||||
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type,i);
|
||||
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type, (unsigned char)i);
|
||||
if (arg_type == Argument_AGGREGATE_OF_STRING) {
|
||||
writable_entity()->setArgument(i,v);
|
||||
} else if (arg_type == Argument_AGGREGATE_OF_BINARY) {
|
||||
@@ -180,31 +180,31 @@ void IfcParse::IfcLateBoundEntity::setArgumentAsAggregateOfString(unsigned int i
|
||||
} else invalid_argument(i,"AGGREGATE OF STRING");
|
||||
}
|
||||
void IfcParse::IfcLateBoundEntity::setArgumentAsEntityInstance(unsigned int i, IfcParse::IfcLateBoundEntity* v) {
|
||||
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type,i);
|
||||
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type, (unsigned char)i);
|
||||
if (arg_type == Argument_ENTITY_INSTANCE) {
|
||||
writable_entity()->setArgument(i,v);
|
||||
} else invalid_argument(i,"ENTITY INSTANCE");
|
||||
}
|
||||
void IfcParse::IfcLateBoundEntity::setArgumentAsAggregateOfEntityInstance(unsigned int i, IfcEntityList::ptr v) {
|
||||
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type,i);
|
||||
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type, (unsigned char)i);
|
||||
if (arg_type == Argument_AGGREGATE_OF_ENTITY_INSTANCE) {
|
||||
writable_entity()->setArgument(i,v);
|
||||
} else invalid_argument(i,"AGGREGATE OF ENTITY INSTANCE");
|
||||
}
|
||||
void IfcParse::IfcLateBoundEntity::setArgumentAsAggregateOfAggregateOfInt(unsigned int i, const std::vector< std::vector<int> >& v) {
|
||||
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type,i);
|
||||
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type, (unsigned char)i);
|
||||
if (arg_type == Argument_AGGREGATE_OF_AGGREGATE_OF_INT) {
|
||||
writable_entity()->setArgument(i,v);
|
||||
} else invalid_argument(i,"AGGREGATE OF AGGREGATE OF INT");
|
||||
}
|
||||
void IfcParse::IfcLateBoundEntity::setArgumentAsAggregateOfAggregateOfDouble(unsigned int i, const std::vector< std::vector<double> >& v) {
|
||||
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type,i);
|
||||
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type, (unsigned char)i);
|
||||
if (arg_type == Argument_AGGREGATE_OF_AGGREGATE_OF_DOUBLE) {
|
||||
writable_entity()->setArgument(i,v);
|
||||
} else invalid_argument(i,"AGGREGATE OF AGGREGATE OF DOUBLE");
|
||||
}
|
||||
void IfcParse::IfcLateBoundEntity::setArgumentAsAggregateOfAggregateOfEntityInstance(unsigned int i, IfcEntityListList::ptr v) {
|
||||
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type,i);
|
||||
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type, (unsigned char)i);
|
||||
if (arg_type == Argument_AGGREGATE_OF_AGGREGATE_OF_ENTITY_INSTANCE) {
|
||||
writable_entity()->setArgument(i,v);
|
||||
} else invalid_argument(i,"AGGREGATE OF AGGREGATE OF ENTITY INSTANCE");
|
||||
@@ -230,7 +230,7 @@ bool IfcParse::IfcLateBoundEntity::is_valid() {
|
||||
const Argument& arg = *getArgument(i);
|
||||
is_null = arg.isNull();
|
||||
} catch(IfcException) {}
|
||||
if (!IfcSchema::Type::GetAttributeOptional(_type,i) && is_null) {
|
||||
if (!IfcSchema::Type::GetAttributeOptional(_type, (unsigned char)i) && is_null) {
|
||||
if (!valid) {
|
||||
oss << ", ";
|
||||
}
|
||||
|
||||
+27
-26
@@ -143,6 +143,8 @@ void IfcSpfStream::ReadBuffer(bool inc) {
|
||||
offset += len;
|
||||
fseek(stream, offset, SEEK_SET);
|
||||
}
|
||||
#else
|
||||
(void)inc;
|
||||
#endif
|
||||
eof = feof(stream) != 0;
|
||||
if ( eof ) return;
|
||||
@@ -308,7 +310,7 @@ Token IfcSpfLexer::Next() {
|
||||
while ( ! stream->eof ) {
|
||||
|
||||
// Read character and increment pointer if not starting a new token
|
||||
char c = stream->Peek();
|
||||
c = stream->Peek();
|
||||
if ( len && (c == '(' || c == ')' || c == '=' || c == ',' || c == ';' || c == '/') ) break;
|
||||
stream->Inc();
|
||||
len ++;
|
||||
@@ -363,7 +365,7 @@ bool TokenFunc::startsWith(const Token& t, char c) {
|
||||
}
|
||||
|
||||
bool TokenFunc::isOperator(const Token& t, char op) {
|
||||
return (!t.first) && (!op || op == t.second);
|
||||
return (!t.first) && (!op || (unsigned)op == t.second);
|
||||
}
|
||||
|
||||
bool TokenFunc::isIdentifier(const Token& t) {
|
||||
@@ -394,8 +396,8 @@ bool TokenFunc::isInt(const Token& t) {
|
||||
const std::string str = asString(t);
|
||||
const char* start = str.c_str();
|
||||
char* end;
|
||||
long result = strtol(start,&end,10);
|
||||
return ((end - start) == str.length());
|
||||
/*long result =*/ strtol(start,&end,10);
|
||||
return ((end - start) == (ptrdiff_t)str.length());
|
||||
}
|
||||
|
||||
bool TokenFunc::isBool(const Token& t) {
|
||||
@@ -412,11 +414,11 @@ bool TokenFunc::isFloat(const Token& t) {
|
||||
const char* start = str.c_str();
|
||||
char* end;
|
||||
#ifdef _MSC_VER
|
||||
double result = _strtod_l(start,&end,locale);
|
||||
/*double result =*/ _strtod_l(start,&end,locale);
|
||||
#else
|
||||
double result = strtod_l(start,&end,locale);
|
||||
#endif
|
||||
return ((end - start) == str.length());
|
||||
return ((end - start) == (ptrdiff_t)str.length());
|
||||
}
|
||||
|
||||
int TokenFunc::asInt(const Token& t) {
|
||||
@@ -467,7 +469,7 @@ boost::dynamic_bitset<> TokenFunc::asBinary(const Token& t) {
|
||||
}
|
||||
|
||||
++it;
|
||||
unsigned i = (str.size()-1) * 4 - n;
|
||||
unsigned i = ((unsigned)str.size()-1) * 4 - n;
|
||||
boost::dynamic_bitset<> bitset(i);
|
||||
|
||||
for(; it != str.end(); ++it) {
|
||||
@@ -508,8 +510,7 @@ EntityArgument::EntityArgument(const Token& t) {
|
||||
// Aditionally, stores the ids (i.e. #[\d]+) in a vector
|
||||
//
|
||||
void ArgumentList::read(IfcSpfLexer* t, std::vector<unsigned int>& ids) {
|
||||
IfcParse::IfcFile* file = t->file;
|
||||
|
||||
//IfcParse::IfcFile* file = t->file;
|
||||
Token next = t->Next();
|
||||
while( next.second || next.first ) {
|
||||
if ( TokenFunc::isOperator(next,',') ) {
|
||||
@@ -517,9 +518,9 @@ void ArgumentList::read(IfcSpfLexer* t, std::vector<unsigned int>& ids) {
|
||||
} else if ( TokenFunc::isOperator(next,')') ) {
|
||||
break;
|
||||
} else if ( TokenFunc::isOperator(next,'(') ) {
|
||||
ArgumentList* list = new ArgumentList();
|
||||
list->read(t, ids);
|
||||
push(list);
|
||||
ArgumentList* alist = new ArgumentList();
|
||||
alist->read(t, ids);
|
||||
push(alist);
|
||||
} else {
|
||||
if ( TokenFunc::isIdentifier(next) ) {
|
||||
ids.push_back(TokenFunc::asInt(next));
|
||||
@@ -640,7 +641,7 @@ ArgumentList::operator IfcEntityListList::ptr() const {
|
||||
for ( it = list.begin(); it != list.end(); ++ it ) {
|
||||
const Argument* arg = *it;
|
||||
const ArgumentList* arg_list;
|
||||
if ((arg_list = dynamic_cast<const ArgumentList*>(arg))) {
|
||||
if ((arg_list = dynamic_cast<const ArgumentList*>(arg)) != 0) {
|
||||
IfcEntityList::ptr e = *arg_list;
|
||||
l->push(e);
|
||||
}
|
||||
@@ -732,7 +733,7 @@ TokenArgument::operator std::vector< std::vector<int> >() const { throw IfcExcep
|
||||
TokenArgument::operator std::vector< std::vector<double> >() const { throw IfcException("Argument is not a list of list of floats"); }
|
||||
TokenArgument::operator IfcEntityListList::ptr() const { throw IfcException("Argument is not a list of list of entity instances"); }
|
||||
unsigned int TokenArgument::size() const { return 1; }
|
||||
Argument* TokenArgument::operator [] (unsigned int i) const { throw IfcException("Argument is not a list of attributes"); }
|
||||
Argument* TokenArgument::operator [] (unsigned int /*i*/) const { throw IfcException("Argument is not a list of attributes"); }
|
||||
std::string TokenArgument::toString(bool upper) const {
|
||||
if ( upper && TokenFunc::isString(token) ) {
|
||||
return IfcWrite::IfcCharacterEncoder(TokenFunc::asString(token));
|
||||
@@ -764,7 +765,7 @@ EntityArgument::operator std::vector< std::vector<int> >() const { throw IfcExce
|
||||
EntityArgument::operator std::vector< std::vector<double> >() const { throw IfcException("Argument is not a list of list of floats"); }
|
||||
EntityArgument::operator IfcEntityListList::ptr() const { throw IfcException("Argument is not a list of list of entity instances"); }
|
||||
unsigned int EntityArgument::size() const { return 1; }
|
||||
Argument* EntityArgument::operator [] (unsigned int i) const { throw IfcException("Argument is not a list of arguments"); }
|
||||
Argument* EntityArgument::operator [] (unsigned int /*i*/) const { throw IfcException("Argument is not a list of arguments"); }
|
||||
std::string EntityArgument::toString(bool upper) const {
|
||||
return entity->entity->toString(upper);
|
||||
}
|
||||
@@ -1070,9 +1071,9 @@ void IfcFile::addEntities(IfcEntityList::ptr es) {
|
||||
IfcUtil::IfcBaseClass* IfcFile::addEntity(IfcUtil::IfcBaseClass* entity) {
|
||||
// If this instance has been inserted before, return
|
||||
// a reference to the copy that was created from it.
|
||||
entity_entity_map_t::iterator it = entity_file_map.find(entity);
|
||||
if (it != entity_file_map.end()) {
|
||||
return it->second;
|
||||
entity_entity_map_t::iterator mit = entity_file_map.find(entity);
|
||||
if (mit != entity_file_map.end()) {
|
||||
return mit->second;
|
||||
}
|
||||
|
||||
// Obtain all forward references by a depth-first
|
||||
@@ -1272,8 +1273,8 @@ void IfcFile::removeEntity(IfcUtil::IfcBaseClass* entity) {
|
||||
// moment, inversely related instances affected by the removal of the
|
||||
// entity being deleted are not deleted themselves.
|
||||
if (references) {
|
||||
for (IfcEntityList::it it = references->begin(); it != references->end(); ++it) {
|
||||
IfcUtil::IfcBaseEntity* related_instance = (IfcUtil::IfcBaseEntity*) *it;
|
||||
for (IfcEntityList::it iit = references->begin(); iit != references->end(); ++iit) {
|
||||
IfcUtil::IfcBaseEntity* related_instance = (IfcUtil::IfcBaseEntity*) *iit;
|
||||
for (unsigned i = 0; i < related_instance->getArgumentCount(); ++i) {
|
||||
Argument* attr = related_instance->getArgument(i);
|
||||
if (attr->isNull()) continue;
|
||||
@@ -1495,21 +1496,21 @@ std::pair<IfcSchema::IfcNamedUnit*, double> IfcFile::getUnit(IfcSchema::IfcUnitE
|
||||
if (named_unit->UnitType() != type) {
|
||||
continue;
|
||||
}
|
||||
IfcSchema::IfcSIUnit* unit = 0;
|
||||
IfcSchema::IfcSIUnit* siunit = 0;
|
||||
if (named_unit->is(IfcSchema::Type::IfcConversionBasedUnit)) {
|
||||
IfcSchema::IfcConversionBasedUnit* u = (IfcSchema::IfcConversionBasedUnit*)named_unit;
|
||||
IfcSchema::IfcMeasureWithUnit* mu = u->ConversionFactor();
|
||||
return_value.second *= static_cast<double>(*mu->ValueComponent()->entity->getArgument(0));
|
||||
return_value.first = named_unit;
|
||||
if (mu->UnitComponent()->is(IfcSchema::Type::IfcSIUnit)) {
|
||||
unit = (IfcSchema::IfcSIUnit*) mu->UnitComponent();
|
||||
siunit = (IfcSchema::IfcSIUnit*) mu->UnitComponent();
|
||||
}
|
||||
} else if (named_unit->is(IfcSchema::Type::IfcSIUnit)) {
|
||||
return_value.first = unit = (IfcSchema::IfcSIUnit*) named_unit;
|
||||
return_value.first = siunit = (IfcSchema::IfcSIUnit*) named_unit;
|
||||
}
|
||||
if (unit) {
|
||||
if (unit->hasPrefix()) {
|
||||
return_value.second *= IfcSIPrefixToValue(unit->Prefix());
|
||||
if (siunit) {
|
||||
if (siunit->hasPrefix()) {
|
||||
return_value.second *= IfcSIPrefixToValue(siunit->Prefix());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,9 @@ class HeaderEntity : public IfcAbstractEntity {
|
||||
private:
|
||||
ArgumentList* _list;
|
||||
const char * const _datatype;
|
||||
|
||||
HeaderEntity(const HeaderEntity&); //N/A
|
||||
HeaderEntity& operator =(const HeaderEntity&); //N/A
|
||||
protected:
|
||||
HeaderEntity(const char * const datatype, IfcSpfLexer* lexer)
|
||||
: _datatype(datatype), _list(0)
|
||||
@@ -65,7 +68,7 @@ public:
|
||||
return (*_list)[i];
|
||||
}
|
||||
|
||||
IfcEntityList::ptr getInverse(IfcSchema::Type::Enum type, int attribute_index) {
|
||||
IfcEntityList::ptr getInverse(IfcSchema::Type::Enum /*type*/, int /*attribute_index*/) {
|
||||
return IfcEntityList::ptr(new IfcEntityList);
|
||||
}
|
||||
|
||||
@@ -81,7 +84,7 @@ public:
|
||||
return (IfcSchema::Type::Enum) -1;
|
||||
}
|
||||
|
||||
bool is(IfcSchema::Type::Enum v) const {
|
||||
bool is(IfcSchema::Type::Enum /*v*/) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ namespace IfcUtil {
|
||||
unsigned int getArgumentCount() const;
|
||||
Argument* getArgument(unsigned int i) const;
|
||||
const char* getArgumentName(unsigned int i) const;
|
||||
IfcSchema::Type::Enum getArgumentEntity(unsigned int i) const { return IfcSchema::Type::UNDEFINED; }
|
||||
IfcSchema::Type::Enum getArgumentEntity(unsigned int /*i*/) const { return IfcSchema::Type::UNDEFINED; }
|
||||
};
|
||||
|
||||
bool valid_binary_string(const std::string& s);
|
||||
@@ -194,11 +194,11 @@ public:
|
||||
}
|
||||
outer_it begin() const { return ls.begin(); }
|
||||
outer_it end() const { return ls.end(); }
|
||||
int size() const { return ls.size(); }
|
||||
int size() const { return (int)ls.size(); }
|
||||
int totalSize() const {
|
||||
int accum = 0;
|
||||
for (outer_it it = begin(); it != end(); ++it) {
|
||||
accum += it->size();
|
||||
accum += (int)it->size();
|
||||
}
|
||||
return accum;
|
||||
}
|
||||
@@ -237,7 +237,7 @@ public:
|
||||
void push(const std::vector<T*>& t) {ls.push_back(t);}
|
||||
outer_it begin() { return ls.begin(); }
|
||||
outer_it end() { return ls.end(); }
|
||||
int size() const { return ls.size(); }
|
||||
int size() const { return (int)ls.size(); }
|
||||
int totalSize() const {
|
||||
int accum = 0;
|
||||
for (outer_it it = begin(); it != end(); ++it) {
|
||||
|
||||
+24
-23
@@ -85,7 +85,7 @@ Argument* IfcWritableEntity::getArgument (unsigned int i) {
|
||||
}
|
||||
return args[i];
|
||||
}
|
||||
unsigned int IfcWritableEntity::getArgumentCount() const {return args.size(); }
|
||||
unsigned int IfcWritableEntity::getArgumentCount() const { return (unsigned)args.size(); }
|
||||
IfcSchema::Type::Enum IfcWritableEntity::type() const { return _type; }
|
||||
bool IfcWritableEntity::is(IfcSchema::Type::Enum v) const { return _type == v; }
|
||||
std::string IfcWritableEntity::toString(bool upper) const {
|
||||
@@ -105,7 +105,6 @@ std::string IfcWritableEntity::toString(bool upper) const {
|
||||
ss << dt << "(";
|
||||
for (std::map<int,Argument*>::const_iterator it = args.begin(); it != args.end(); ++ it) {
|
||||
if ( it != args.begin() ) ss << ",";
|
||||
const Argument* a = it->second;
|
||||
ss << it->second->toString(upper);
|
||||
}
|
||||
ss << ")";
|
||||
@@ -141,7 +140,6 @@ void IfcWritableEntity::setArgument(int i) {
|
||||
}
|
||||
|
||||
void IfcWritableEntity::setArgument(int i, Argument* a) {
|
||||
IfcWrite::IfcWriteArgument* wa = new IfcWrite::IfcWriteArgument(this);
|
||||
IfcUtil::ArgumentType attr_type = a->type();
|
||||
switch(attr_type) {
|
||||
case IfcUtil::Argument_NULL:
|
||||
@@ -183,7 +181,7 @@ void IfcWritableEntity::setArgument(int i, Argument* a) {
|
||||
this->setArgument(i, attr_value); }
|
||||
break;
|
||||
case IfcUtil::Argument_ENUMERATION: {
|
||||
IfcSchema::Type::Enum ty = IfcSchema::Type::GetAttributeEntity(_type, i);
|
||||
IfcSchema::Type::Enum ty = IfcSchema::Type::GetAttributeEntity(_type, (unsigned char)i);
|
||||
std::string enum_literal = a->toString();
|
||||
// Remove leading and trailing '.'
|
||||
enum_literal = enum_literal.substr(1, enum_literal.size() - 2);
|
||||
@@ -292,27 +290,30 @@ void IfcWritableEntity::setArgument(int i,const std::vector< boost::dynamic_bits
|
||||
|
||||
class SizeVisitor : public boost::static_visitor<int> {
|
||||
public:
|
||||
int operator()(const boost::none_t& i) const { return -1; }
|
||||
int operator()(const IfcWriteArgument::Derived& i) const { return -1; }
|
||||
int operator()(const int& i) const { return -1; }
|
||||
int operator()(const bool& i) const { return -1; }
|
||||
int operator()(const double& i) const { return -1; }
|
||||
int operator()(const std::string& i) const { return -1; }
|
||||
int operator()(const boost::dynamic_bitset<>& i) const { return -1; }
|
||||
int operator()(const std::vector<int>& i) const { return i.size(); }
|
||||
int operator()(const std::vector<double>& i) const { return i.size(); }
|
||||
int operator()(const std::vector< std::vector<int> >& i) const { return i.size(); }
|
||||
int operator()(const std::vector< std::vector<double> >& i) const { return i.size(); }
|
||||
int operator()(const std::vector<std::string>& i) const { return i.size(); }
|
||||
int operator()(const std::vector< boost::dynamic_bitset<> >& i) const { return i.size(); }
|
||||
int operator()(const IfcWriteArgument::EnumerationReference& i) const { return -1; }
|
||||
int operator()(const IfcUtil::IfcBaseClass* const& i) const { return -1; }
|
||||
int operator()(const boost::none_t& /*i*/) const { return -1; }
|
||||
int operator()(const IfcWriteArgument::Derived& /*i*/) const { return -1; }
|
||||
int operator()(const int& /*i*/) const { return -1; }
|
||||
int operator()(const bool& /*i*/) const { return -1; }
|
||||
int operator()(const double& /*i*/) const { return -1; }
|
||||
int operator()(const std::string& /*i*/) const { return -1; }
|
||||
int operator()(const boost::dynamic_bitset<>& /*i*/) const { return -1; }
|
||||
int operator()(const std::vector<int>& i) const { return (int)i.size(); }
|
||||
int operator()(const std::vector<double>& i) const { return (int)i.size(); }
|
||||
int operator()(const std::vector< std::vector<int> >& i) const { return (int)i.size(); }
|
||||
int operator()(const std::vector< std::vector<double> >& i) const { return (int)i.size(); }
|
||||
int operator()(const std::vector<std::string>& i) const { return (int)i.size(); }
|
||||
int operator()(const std::vector< boost::dynamic_bitset<> >& i) const { return (int)i.size(); }
|
||||
int operator()(const IfcWriteArgument::EnumerationReference& /*i*/) const { return -1; }
|
||||
int operator()(const IfcUtil::IfcBaseClass* const& /*i*/) const { return -1; }
|
||||
int operator()(const IfcEntityList::ptr& i) const { return i->size(); }
|
||||
int operator()(const IfcEntityListList::ptr& i) const { return i->size(); }
|
||||
};
|
||||
|
||||
class StringBuilderVisitor : public boost::static_visitor<void> {
|
||||
private:
|
||||
StringBuilderVisitor(const StringBuilderVisitor&); //N/A
|
||||
StringBuilderVisitor& operator =(const StringBuilderVisitor&); //N/A
|
||||
|
||||
std::ostringstream& data;
|
||||
template <typename T> void serialize(const std::vector<T>& i) {
|
||||
data << "(";
|
||||
@@ -352,7 +353,7 @@ private:
|
||||
oss.imbue(std::locale::classic());
|
||||
oss.put('"');
|
||||
oss << std::hex << std::setw(1);
|
||||
unsigned c = b.size();
|
||||
unsigned c = (unsigned)b.size();
|
||||
unsigned n = (4 - (c % 4)) & 3;
|
||||
oss << n;
|
||||
for (unsigned i = 0; i < c + n;) {
|
||||
@@ -371,8 +372,8 @@ private:
|
||||
public:
|
||||
StringBuilderVisitor(std::ostringstream& stream, bool upper = false)
|
||||
: data(stream), upper(upper) {}
|
||||
void operator()(const boost::none_t& i) { data << "$"; }
|
||||
void operator()(const IfcWriteArgument::Derived& i) { data << "*"; }
|
||||
void operator()(const boost::none_t& /*i*/) { data << "$"; }
|
||||
void operator()(const IfcWriteArgument::Derived& /*i*/) { data << "*"; }
|
||||
void operator()(const int& i) { data << i; }
|
||||
void operator()(const bool& i) { data << (i ? ".T." : ".F."); }
|
||||
void operator()(const double& i) { data << format_double(i); }
|
||||
@@ -502,7 +503,7 @@ IfcWriteArgument::operator std::vector< std::vector<int> >() const { return as<s
|
||||
IfcWriteArgument::operator std::vector< std::vector<double> >() const { return as<std::vector< std::vector<double> > >(); }
|
||||
IfcWriteArgument::operator IfcEntityListList::ptr() const { throw; }
|
||||
bool IfcWriteArgument::isNull() const { return type() == IfcUtil::Argument_NULL; }
|
||||
Argument* IfcWriteArgument::operator [] (unsigned int i) const { throw IfcParse::IfcException("Invalid cast"); }
|
||||
Argument* IfcWriteArgument::operator [] (unsigned int /*i*/) const { throw IfcParse::IfcException("Invalid cast"); }
|
||||
std::string IfcWriteArgument::toString(bool upper) const {
|
||||
std::ostringstream str;
|
||||
str.imbue(std::locale::classic());
|
||||
|
||||
Reference in New Issue
Block a user