mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-06 12:26:26 +00:00
clang-tidy
This commit is contained in:
@@ -55,8 +55,6 @@
|
|||||||
* *
|
* *
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
#define _DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR
|
|
||||||
|
|
||||||
#ifndef IFCGEOMITERATOR_H
|
#ifndef IFCGEOMITERATOR_H
|
||||||
#define IFCGEOMITERATOR_H
|
#define IFCGEOMITERATOR_H
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@
|
|||||||
#define ARBITRARY (1 << 7)
|
#define ARBITRARY (1 << 7)
|
||||||
#define EXTENDED2 (1 << 8)
|
#define EXTENDED2 (1 << 8)
|
||||||
#define EXTENDED4 (1 << 9)
|
#define EXTENDED4 (1 << 9)
|
||||||
#define HEX(N) (1 << (9 + N))
|
#define HEX(N) (1 << (9 + (N)))
|
||||||
#define THIRD_SOLIDUS (1 << 18)
|
#define THIRD_SOLIDUS (1 << 18)
|
||||||
#define ENDEXTENDED_X (1 << 19)
|
#define ENDEXTENDED_X (1 << 19)
|
||||||
#define ENDEXTENDED_0 (1 << 20)
|
#define ENDEXTENDED_0 (1 << 20)
|
||||||
@@ -52,22 +52,22 @@
|
|||||||
#define ENCOUNTERED_HEX (1 << 23)
|
#define ENCOUNTERED_HEX (1 << 23)
|
||||||
|
|
||||||
// FIXME: These probably need to be less forgiving in terms of wrongly defined sequences
|
// FIXME: These probably need to be less forgiving in terms of wrongly defined sequences
|
||||||
#define EXPECTS_ALPHABET(S) (S & FIRST_SOLIDUS)
|
#define EXPECTS_ALPHABET(S) ((S) & FIRST_SOLIDUS)
|
||||||
#define EXPECTS_PAGE(S) (S & FIRST_SOLIDUS)
|
#define EXPECTS_PAGE(S) ((S) & FIRST_SOLIDUS)
|
||||||
#define EXPECTS_ARBITRARY(S) (S & FIRST_SOLIDUS)
|
#define EXPECTS_ARBITRARY(S) ((S) & FIRST_SOLIDUS)
|
||||||
#define EXPECTS_N_OR_F(S) (S & FIRST_SOLIDUS && !(S & ARBITRARY))
|
#define EXPECTS_N_OR_F(S) ((S) & FIRST_SOLIDUS && !((S) & ARBITRARY))
|
||||||
#define EXPECTS_ARBITRARY2(S) (S & ARBITRARY && !(S & SECOND_SOLIDUS))
|
#define EXPECTS_ARBITRARY2(S) ((S) & ARBITRARY && !((S) & SECOND_SOLIDUS))
|
||||||
#define EXPECTS_ALPHABET_DEFINITION(S) (S & FIRST_SOLIDUS && S & ALPHABET)
|
#define EXPECTS_ALPHABET_DEFINITION(S) ((S) & FIRST_SOLIDUS && (S) & ALPHABET)
|
||||||
#define EXPECTS_SOLIDUS(S) (S & ALPHABET_DEFINITION || S & PAGE || S & ARBITRARY || S & EXTENDED2 || S & EXTENDED4 || S & ENDEXTENDED_0 || S & IGNORED_DIRECTIVE || (S & EXTENDED4 && S & HEX(8)) || (S & EXTENDED2 && S & HEX(4)))
|
#define EXPECTS_SOLIDUS(S) ((S) & ALPHABET_DEFINITION || (S) & PAGE || (S) & ARBITRARY || (S) & EXTENDED2 || (S) & EXTENDED4 || (S) & ENDEXTENDED_0 || (S) & IGNORED_DIRECTIVE || ((S) & EXTENDED4 && (S) & HEX(8)) || ((S) & EXTENDED2 && (S) & HEX(4)))
|
||||||
#define EXPECTS_CHARACTER(S) (S & PAGE && S & SECOND_SOLIDUS)
|
#define EXPECTS_CHARACTER(S) ((S) & PAGE && (S) & SECOND_SOLIDUS)
|
||||||
#define EXPECTS_HEX(S) (S & HEX(1) || S & HEX(3) || S & HEX(5) || S & HEX(6) || S & HEX(7) || (S & ARBITRARY && S & SECOND_SOLIDUS) || (S & EXTENDED2 && S & HEX(2)) || (S & EXTENDED4 && S & HEX(4)))
|
#define EXPECTS_HEX(S) ((S) & HEX(1) || (S) & HEX(3) || (S) & HEX(5) || (S) & HEX(6) || (S) & HEX(7) || ((S) & ARBITRARY && (S) & SECOND_SOLIDUS) || ((S) & EXTENDED2 && (S) & HEX(2)) || ((S) & EXTENDED4 && (S) & HEX(4)))
|
||||||
#define EXPECTS_ENDEXTENDED_X(S) (S & THIRD_SOLIDUS)
|
#define EXPECTS_ENDEXTENDED_X(S) ((S) & THIRD_SOLIDUS)
|
||||||
#define EXPECTS_ENDEXTENDED_0(S) (S & ENDEXTENDED_X)
|
#define EXPECTS_ENDEXTENDED_0(S) ((S) & ENDEXTENDED_X)
|
||||||
|
|
||||||
#define IS_VALID_ALPHABET_DEFINITION(C) (C >= 0x41 && C <= 0x49)
|
#define IS_VALID_ALPHABET_DEFINITION(C) ((C) >= 0x41 && (C) <= 0x49)
|
||||||
#define IS_HEXADECIMAL(C) ((C >= 0x30 && C <= 0x39) || (C >= 0x41 && C <= 0x46))
|
#define IS_HEXADECIMAL(C) (((C) >= 0x30 && (C) <= 0x39) || ((C) >= 0x41 && (C) <= 0x46))
|
||||||
#define HEX_TO_INT(C) ((C >= 0x30 && C <= 0x39) ? C - 0x30 : (C + 10) - 0x41)
|
#define HEX_TO_INT(C) (((C) >= 0x30 && (C) <= 0x39) ? (C) - 0x30 : ((C) + 10) - 0x41)
|
||||||
#define CLEAR_HEX(C) (C &= ~(HEX(1) | HEX(2) | HEX(3) | HEX(4) | HEX(5) | HEX(6) | HEX(7) | HEX(8)))
|
#define CLEAR_HEX(C) ((C) &= ~(HEX(1) | HEX(2) | HEX(3) | HEX(4) | HEX(5) | HEX(6) | HEX(7) | HEX(8)))
|
||||||
|
|
||||||
using namespace IfcParse;
|
using namespace IfcParse;
|
||||||
|
|
||||||
@@ -80,7 +80,7 @@ IfcCharacterDecoder::~IfcCharacterDecoder() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
static unsigned int reference_helper = 0;
|
unsigned int reference_helper = 0;
|
||||||
|
|
||||||
class pure_impure_helper {
|
class pure_impure_helper {
|
||||||
private:
|
private:
|
||||||
@@ -446,9 +446,9 @@ std::u32string IfcUtil::convert_utf8_to_utf32(const std::string& s) {
|
|||||||
}
|
}
|
||||||
if (is_ascii) {
|
if (is_ascii) {
|
||||||
return std::u32string(s.begin(), s.end());
|
return std::u32string(s.begin(), s.end());
|
||||||
} else {
|
|
||||||
return std::wstring_convert<std::codecvt_utf8<std::u32string::value_type>, std::u32string::value_type>().from_bytes(s);
|
|
||||||
}
|
}
|
||||||
|
return std::wstring_convert<std::codecvt_utf8<std::u32string::value_type>, std::u32string::value_type>().from_bytes(s);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ public:
|
|||||||
int operator()(const double& /*i*/) const { return -1; }
|
int operator()(const double& /*i*/) const { return -1; }
|
||||||
int operator()(const std::string& /*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 boost::dynamic_bitset<>& /*i*/) const { return -1; }
|
||||||
int operator()(const empty_aggregate_t&) const { return 0; }
|
int operator()(const empty_aggregate_t& /*unused*/) const { return 0; }
|
||||||
int operator()(const empty_aggregate_of_aggregate_t&) const { return 0; }
|
int operator()(const empty_aggregate_of_aggregate_t& /*unused*/) const { return 0; }
|
||||||
int operator()(const std::vector<int>& i) const { return (int)i.size(); }
|
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<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<int>>& i) const { return (int)i.size(); }
|
||||||
|
|||||||
+11
-11
@@ -80,7 +80,7 @@ namespace {
|
|||||||
target == IfcUtil::Argument_AGGREGATE_OF_AGGREGATE_OF_INT ||
|
target == IfcUtil::Argument_AGGREGATE_OF_AGGREGATE_OF_INT ||
|
||||||
target == IfcUtil::Argument_AGGREGATE_OF_AGGREGATE_OF_DOUBLE ||
|
target == IfcUtil::Argument_AGGREGATE_OF_AGGREGATE_OF_DOUBLE ||
|
||||||
target == IfcUtil::Argument_AGGREGATE_OF_AGGREGATE_OF_ENTITY_INSTANCE;
|
target == IfcUtil::Argument_AGGREGATE_OF_AGGREGATE_OF_ENTITY_INSTANCE;
|
||||||
} else if (source == IfcUtil::Argument_AGGREGATE_OF_EMPTY_AGGREGATE) {
|
} if (source == IfcUtil::Argument_AGGREGATE_OF_EMPTY_AGGREGATE) {
|
||||||
return target == IfcUtil::Argument_AGGREGATE_OF_AGGREGATE_OF_INT ||
|
return target == IfcUtil::Argument_AGGREGATE_OF_AGGREGATE_OF_INT ||
|
||||||
target == IfcUtil::Argument_AGGREGATE_OF_AGGREGATE_OF_DOUBLE ||
|
target == IfcUtil::Argument_AGGREGATE_OF_AGGREGATE_OF_DOUBLE ||
|
||||||
target == IfcUtil::Argument_AGGREGATE_OF_AGGREGATE_OF_ENTITY_INSTANCE;
|
target == IfcUtil::Argument_AGGREGATE_OF_AGGREGATE_OF_ENTITY_INSTANCE;
|
||||||
@@ -237,9 +237,9 @@ namespace {
|
|||||||
IfcEntityInstanceData IfcParse::parse_context::construct(int name, unresolved_references& references_to_resolve, const IfcParse::declaration* decl) {
|
IfcEntityInstanceData IfcParse::parse_context::construct(int name, unresolved_references& references_to_resolve, const IfcParse::declaration* decl) {
|
||||||
std::vector<const IfcParse::parameter_type*> parameter_types;
|
std::vector<const IfcParse::parameter_type*> parameter_types;
|
||||||
|
|
||||||
if (decl && decl->as_type_declaration()) {
|
if ((decl != nullptr) && (decl->as_type_declaration() != nullptr)) {
|
||||||
parameter_types = { decl->as_type_declaration()->declared_type() };
|
parameter_types = { decl->as_type_declaration()->declared_type() };
|
||||||
} else if (decl && decl->as_entity()) {
|
} else if ((decl != nullptr) && (decl->as_entity() != nullptr)) {
|
||||||
auto entity_attrs = decl->as_entity()->all_attributes();
|
auto entity_attrs = decl->as_entity()->all_attributes();
|
||||||
std::transform(
|
std::transform(
|
||||||
entity_attrs.begin(),
|
entity_attrs.begin(),
|
||||||
@@ -251,32 +251,32 @@ IfcEntityInstanceData IfcParse::parse_context::construct(int name, unresolved_re
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (decl && (tokens_.size() != parameter_types.size())) {
|
if ((decl != nullptr) && (tokens_.size() != parameter_types.size())) {
|
||||||
// warning
|
// warning
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tokens_.size() == 0) {
|
if (tokens_.empty()) {
|
||||||
return IfcEntityInstanceData(storage_t(0));
|
return IfcEntityInstanceData(storage_t(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
storage_t storage(decl
|
storage_t storage(decl != nullptr
|
||||||
? (std::min)(parameter_types.size(), tokens_.size())
|
? (std::min)(parameter_types.size(), tokens_.size())
|
||||||
: tokens_.size()
|
: tokens_.size()
|
||||||
);
|
);
|
||||||
|
|
||||||
auto it = tokens_.begin();
|
auto it = tokens_.begin();
|
||||||
auto kt = parameter_types.begin();
|
auto kt = parameter_types.begin();
|
||||||
for (; it != tokens_.end() && (!decl || kt != parameter_types.end()); ++it) {
|
for (; it != tokens_.end() && ((decl == nullptr) || kt != parameter_types.end()); ++it) {
|
||||||
auto& token = *it;
|
auto& token = *it;
|
||||||
// @todo coerce to expected type, e.g empty -> std::vector<int>, bool -> logical
|
// @todo coerce to expected type, e.g empty -> std::vector<int>, bool -> logical
|
||||||
const IfcParse::parameter_type* param_type = nullptr;
|
const IfcParse::parameter_type* param_type = nullptr;
|
||||||
if (decl) {
|
if (decl != nullptr) {
|
||||||
param_type = *kt;
|
param_type = *kt;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto index = (uint8_t) std::distance(tokens_.begin(), it);
|
auto index = (uint8_t) std::distance(tokens_.begin(), it);
|
||||||
|
|
||||||
boost::apply_visitor([this, &storage, name, &references_to_resolve, index, it, param_type](auto& v) {
|
boost::apply_visitor([this, &storage, name, &references_to_resolve, index, param_type](auto& v) {
|
||||||
if constexpr (std::is_same_v<std::decay_t<decltype(v)>, IfcParse::Token>) {
|
if constexpr (std::is_same_v<std::decay_t<decltype(v)>, IfcParse::Token>) {
|
||||||
dispatch_token(v, param_type && param_type->as_named_type() ? param_type->as_named_type()->declared_type() : nullptr, [this, &storage, name, &references_to_resolve, index](auto v) {
|
dispatch_token(v, param_type && param_type->as_named_type() ? param_type->as_named_type()->declared_type() : nullptr, [this, &storage, name, &references_to_resolve, index](auto v) {
|
||||||
if constexpr (std::is_same_v<std::decay_t<decltype(v)>, IfcParse::reference_or_simple_type>) {
|
if constexpr (std::is_same_v<std::decay_t<decltype(v)>, IfcParse::reference_or_simple_type>) {
|
||||||
@@ -292,7 +292,7 @@ IfcEntityInstanceData IfcParse::parse_context::construct(int name, unresolved_re
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if constexpr (std::is_same_v<std::decay_t<decltype(v)>, IfcParse::parse_context*>) {
|
} else if constexpr (std::is_same_v<std::decay_t<decltype(v)>, IfcParse::parse_context*>) {
|
||||||
auto pt = param_type;
|
const auto *pt = param_type;
|
||||||
if (pt) {
|
if (pt) {
|
||||||
while (pt->as_named_type()) {
|
while (pt->as_named_type()) {
|
||||||
pt = pt->as_named_type()->declared_type()->as_type_declaration()->declared_type();
|
pt = pt->as_named_type()->declared_type()->as_type_declaration()->declared_type();
|
||||||
@@ -312,7 +312,7 @@ IfcEntityInstanceData IfcParse::parse_context::construct(int name, unresolved_re
|
|||||||
}
|
}
|
||||||
}, token);
|
}, token);
|
||||||
|
|
||||||
if (decl) {
|
if (decl != nullptr) {
|
||||||
++kt;
|
++kt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -274,11 +274,11 @@ class IFC_PARSE_API IfcFile {
|
|||||||
/// Performs a depth-first traversal, returning all entity instance
|
/// Performs a depth-first traversal, returning all entity instance
|
||||||
/// attributes as a flat list. NB: includes the root instance specified
|
/// attributes as a flat list. NB: includes the root instance specified
|
||||||
/// in the first function argument.
|
/// in the first function argument.
|
||||||
aggregate_of_instance::ptr traverse(IfcUtil::IfcBaseClass* instance, int max_level = -1);
|
static aggregate_of_instance::ptr traverse(IfcUtil::IfcBaseClass* instance, int max_level = -1);
|
||||||
|
|
||||||
/// Same as traverse() but maintains topological order by using a
|
/// Same as traverse() but maintains topological order by using a
|
||||||
/// breadth-first search
|
/// breadth-first search
|
||||||
aggregate_of_instance::ptr traverse_breadth_first(IfcUtil::IfcBaseClass* instance, int max_level = -1);
|
static aggregate_of_instance::ptr traverse_breadth_first(IfcUtil::IfcBaseClass* instance, int max_level = -1);
|
||||||
|
|
||||||
/// Get the attribute indices corresponding to the list of entity instances
|
/// Get the attribute indices corresponding to the list of entity instances
|
||||||
/// returned by getInverse().
|
/// returned by getInverse().
|
||||||
@@ -324,10 +324,10 @@ class IFC_PARSE_API IfcFile {
|
|||||||
const IfcSpfHeader& header() const { return _header; }
|
const IfcSpfHeader& header() const { return _header; }
|
||||||
IfcSpfHeader& header() { return _header; }
|
IfcSpfHeader& header() { return _header; }
|
||||||
|
|
||||||
std::string createTimestamp() const;
|
static std::string createTimestamp() ;
|
||||||
|
|
||||||
void load(unsigned entity_instance_name, const IfcParse::entity* entity, parse_context&, int attribute_index = -1);
|
void load(unsigned entity_instance_name, const IfcParse::entity* entity, parse_context&, int attribute_index = -1);
|
||||||
void try_read_semicolon();
|
void try_read_semicolon() const;
|
||||||
|
|
||||||
void register_inverse(unsigned, const IfcParse::entity* from_entity, Token, int attribute_index);
|
void register_inverse(unsigned, const IfcParse::entity* from_entity, Token, int attribute_index);
|
||||||
void register_inverse(unsigned, const IfcParse::entity* from_entity, IfcUtil::IfcBaseClass*, int attribute_index);
|
void register_inverse(unsigned, const IfcParse::entity* from_entity, IfcUtil::IfcBaseClass*, int attribute_index);
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ IfcParse::IfcGlobalId::IfcGlobalId() {
|
|||||||
uuid_data_ = gen();
|
uuid_data_ = gen();
|
||||||
std::vector<unsigned char> v(uuid_data_.size());
|
std::vector<unsigned char> v(uuid_data_.size());
|
||||||
std::copy(uuid_data_.begin(), uuid_data_.end(), v.begin());
|
std::copy(uuid_data_.begin(), uuid_data_.end(), v.begin());
|
||||||
string_data_ = compress(&v[0]);
|
string_data_ = compress(v.data());
|
||||||
#if BOOST_VERSION < 104400
|
#if BOOST_VERSION < 104400
|
||||||
formatted_string = boost::lexical_cast<std::string>(uuid_data);
|
formatted_string = boost::lexical_cast<std::string>(uuid_data);
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -17,8 +17,6 @@
|
|||||||
* *
|
* *
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
#define _DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR
|
|
||||||
|
|
||||||
#include "IfcLogger.h"
|
#include "IfcLogger.h"
|
||||||
|
|
||||||
#include "Argument.h"
|
#include "Argument.h"
|
||||||
|
|||||||
+21
-21
@@ -245,7 +245,7 @@ char IfcSpfStream::Read(unsigned int offset) {
|
|||||||
//
|
//
|
||||||
// Returns the cursor position
|
// Returns the cursor position
|
||||||
//
|
//
|
||||||
unsigned int IfcSpfStream::Tell() {
|
unsigned int IfcSpfStream::Tell() const {
|
||||||
return ptr_;
|
return ptr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -274,7 +274,7 @@ IfcSpfLexer::~IfcSpfLexer() {
|
|||||||
delete decoder_;
|
delete decoder_;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int IfcSpfLexer::skipWhitespace() {
|
unsigned int IfcSpfLexer::skipWhitespace() const {
|
||||||
unsigned int index = 0;
|
unsigned int index = 0;
|
||||||
while (!stream->eof) {
|
while (!stream->eof) {
|
||||||
char character = stream->Peek();
|
char character = stream->Peek();
|
||||||
@@ -288,7 +288,7 @@ unsigned int IfcSpfLexer::skipWhitespace() {
|
|||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int IfcSpfLexer::skipComment() {
|
unsigned int IfcSpfLexer::skipComment() const {
|
||||||
char character = stream->Peek();
|
char character = stream->Peek();
|
||||||
if (character != '/') {
|
if (character != '/') {
|
||||||
return 0;
|
return 0;
|
||||||
@@ -376,7 +376,7 @@ Token IfcSpfLexer::Next() {
|
|||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IfcSpfStream::is_eof_at(unsigned int local_ptr) {
|
bool IfcSpfStream::is_eof_at(unsigned int local_ptr) const {
|
||||||
return local_ptr >= len_;
|
return local_ptr >= len_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -646,7 +646,7 @@ std::string TokenFunc::asString(const Token& token) {
|
|||||||
|
|
||||||
boost::dynamic_bitset<> TokenFunc::asBinary(const Token& token) {
|
boost::dynamic_bitset<> TokenFunc::asBinary(const Token& token) {
|
||||||
const std::string& str = asStringRef(token);
|
const std::string& str = asStringRef(token);
|
||||||
if (str.size() < 1) {
|
if (str.empty()) {
|
||||||
throw IfcException("Token is not a valid binary sequence");
|
throw IfcException("Token is not a valid binary sequence");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -716,7 +716,7 @@ void IfcParse::IfcFile::load(unsigned entity_instance_name, const IfcParse::enti
|
|||||||
try {
|
try {
|
||||||
parse_context ps;
|
parse_context ps;
|
||||||
load(0, nullptr, ps, -1);
|
load(0, nullptr, ps, -1);
|
||||||
auto decl = schema_->declaration_by_name(TokenFunc::asStringRef(next));
|
const auto *decl = schema_->declaration_by_name(TokenFunc::asStringRef(next));
|
||||||
auto* simple_type_instance = schema_->instantiate(decl, ps.construct(-1, references_to_resolve, decl));
|
auto* simple_type_instance = schema_->instantiate(decl, ps.construct(-1, references_to_resolve, decl));
|
||||||
//@todo decide addEntity(((IfcUtil::IfcBaseClass*)*entity));
|
//@todo decide addEntity(((IfcUtil::IfcBaseClass*)*entity));
|
||||||
context.push(simple_type_instance);
|
context.push(simple_type_instance);
|
||||||
@@ -748,7 +748,7 @@ IfcEntityInstanceData IfcParse::read(unsigned int i, IfcFile* f) {
|
|||||||
return IfcEntityInstanceData(pc.construct(i, f->references_to_resolve, ty));
|
return IfcEntityInstanceData(pc.construct(i, f->references_to_resolve, ty));
|
||||||
}
|
}
|
||||||
|
|
||||||
void IfcParse::IfcFile::try_read_semicolon() {
|
void IfcParse::IfcFile::try_read_semicolon() const {
|
||||||
unsigned int old_offset = tokens->stream->Tell();
|
unsigned int old_offset = tokens->stream->Tell();
|
||||||
Token semilocon = tokens->Next();
|
Token semilocon = tokens->Next();
|
||||||
if (!TokenFunc::isOperator(semilocon, ';')) {
|
if (!TokenFunc::isOperator(semilocon, ';')) {
|
||||||
@@ -799,7 +799,7 @@ namespace {
|
|||||||
// The REAL token definition from the IFC SPF standard does not necessarily match
|
// The REAL token definition from the IFC SPF standard does not necessarily match
|
||||||
// the output of the C++ ostream formatting operation.
|
// the output of the C++ ostream formatting operation.
|
||||||
// REAL = [ SIGN ] DIGIT { DIGIT } "." { DIGIT } [ "E" [ SIGN ] DIGIT { DIGIT } ] .
|
// REAL = [ SIGN ] DIGIT { DIGIT } "." { DIGIT } [ "E" [ SIGN ] DIGIT { DIGIT } ] .
|
||||||
std::string format_double(const double& d) {
|
static std::string format_double(const double& d) {
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss.imbue(std::locale::classic());
|
oss.imbue(std::locale::classic());
|
||||||
oss << std::setprecision(std::numeric_limits<double>::digits10) << d;
|
oss << std::setprecision(std::numeric_limits<double>::digits10) << d;
|
||||||
@@ -821,7 +821,7 @@ namespace {
|
|||||||
return oss.str();
|
return oss.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string format_binary(const boost::dynamic_bitset<>& b) {
|
static std::string format_binary(const boost::dynamic_bitset<>& b) {
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss.imbue(std::locale::classic());
|
oss.imbue(std::locale::classic());
|
||||||
oss.put('"');
|
oss.put('"');
|
||||||
@@ -906,8 +906,8 @@ namespace {
|
|||||||
}
|
}
|
||||||
data_ << ")";
|
data_ << ")";
|
||||||
}
|
}
|
||||||
void operator()(const empty_aggregate_t&) const { data_ << "()"; }
|
void operator()(const empty_aggregate_t& /*unused*/) const { data_ << "()"; }
|
||||||
void operator()(const empty_aggregate_of_aggregate_t&) const { data_ << "()"; }
|
void operator()(const empty_aggregate_of_aggregate_t& /*unused*/) const { data_ << "()"; }
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
@@ -1428,8 +1428,6 @@ void IfcFile::initialize_(IfcParse::IfcSpfStream* s) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
references_to_resolve.clear();
|
references_to_resolve.clear();
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void IfcFile::recalculate_id_counter() {
|
void IfcFile::recalculate_id_counter() {
|
||||||
@@ -1969,7 +1967,7 @@ namespace {
|
|||||||
template <typename Fn>
|
template <typename Fn>
|
||||||
void visit_subtypes(const IfcParse::entity* ent, Fn fn) {
|
void visit_subtypes(const IfcParse::entity* ent, Fn fn) {
|
||||||
fn(ent);
|
fn(ent);
|
||||||
for (auto& st : ent->subtypes()) {
|
for (const auto& st : ent->subtypes()) {
|
||||||
visit_subtypes(st, fn);
|
visit_subtypes(st, fn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1985,7 +1983,7 @@ namespace {
|
|||||||
|
|
||||||
aggregate_of_instance::ptr IfcFile::instances_by_type(const IfcParse::declaration* t) {
|
aggregate_of_instance::ptr IfcFile::instances_by_type(const IfcParse::declaration* t) {
|
||||||
aggregate_of_instance::ptr insts(new aggregate_of_instance);
|
aggregate_of_instance::ptr insts(new aggregate_of_instance);
|
||||||
if (t->as_entity()) {
|
if (t->as_entity() != nullptr) {
|
||||||
visit_subtypes(t->as_entity(), [this, &insts](const IfcParse::entity* ent) {
|
visit_subtypes(t->as_entity(), [this, &insts](const IfcParse::entity* ent) {
|
||||||
auto it = bytype_excl_.find(ent);
|
auto it = bytype_excl_.find(ent);
|
||||||
if (it != bytype_excl_.end()) {
|
if (it != bytype_excl_.end()) {
|
||||||
@@ -2096,7 +2094,7 @@ std::ostream& operator<<(std::ostream& out, const IfcParse::IfcFile& file) {
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string IfcFile::createTimestamp() const {
|
std::string IfcFile::createTimestamp() {
|
||||||
char buf[255];
|
char buf[255];
|
||||||
|
|
||||||
time_t t;
|
time_t t;
|
||||||
@@ -2104,7 +2102,7 @@ std::string IfcFile::createTimestamp() const {
|
|||||||
|
|
||||||
struct tm* ti = localtime(&t);
|
struct tm* ti = localtime(&t);
|
||||||
|
|
||||||
std::string result = "";
|
std::string result;
|
||||||
if (strftime(buf, 255, "%Y-%m-%dT%H:%M:%S", ti) != 0U) {
|
if (strftime(buf, 255, "%Y-%m-%dT%H:%M:%S", ti) != 0U) {
|
||||||
result = std::string(buf);
|
result = std::string(buf);
|
||||||
}
|
}
|
||||||
@@ -2194,8 +2192,10 @@ size_t IfcFile::getTotalInverses(int instance_id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void IfcFile::setDefaultHeaderValues() {
|
void IfcFile::setDefaultHeaderValues() {
|
||||||
const std::string empty_string = "";
|
const std::string empty_string;
|
||||||
std::vector<std::string> file_description, schema_identifiers, empty_vector;
|
std::vector<std::string> file_description;
|
||||||
|
std::vector<std::string> schema_identifiers;
|
||||||
|
std::vector<std::string> empty_vector;
|
||||||
|
|
||||||
file_description.push_back("ViewDefinition [CoordinationView]");
|
file_description.push_back("ViewDefinition [CoordinationView]");
|
||||||
if (schema() != nullptr) {
|
if (schema() != nullptr) {
|
||||||
@@ -2311,8 +2311,8 @@ void IfcUtil::IfcBaseClass::unset_attribute_value(size_t index) {
|
|||||||
|
|
||||||
void IfcUtil::IfcBaseClass::toString(std::ostream& out, bool upper) const
|
void IfcUtil::IfcBaseClass::toString(std::ostream& out, bool upper) const
|
||||||
{
|
{
|
||||||
auto ent = declaration().as_entity();
|
const auto *ent = declaration().as_entity();
|
||||||
if (ent) {
|
if (ent != nullptr) {
|
||||||
out << "#" << as<IfcUtil::IfcBaseEntity>()->id() << "=";
|
out << "#" << as<IfcUtil::IfcBaseEntity>()->id() << "=";
|
||||||
}
|
}
|
||||||
if (upper) {
|
if (upper) {
|
||||||
|
|||||||
@@ -148,8 +148,8 @@ Token NoneTokenPtr();
|
|||||||
class IFC_PARSE_API IfcSpfLexer {
|
class IFC_PARSE_API IfcSpfLexer {
|
||||||
private:
|
private:
|
||||||
IfcCharacterDecoder* decoder_;
|
IfcCharacterDecoder* decoder_;
|
||||||
unsigned int skipWhitespace();
|
unsigned int skipWhitespace() const;
|
||||||
unsigned int skipComment();
|
unsigned int skipComment() const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
std::string& GetTempString() const {
|
std::string& GetTempString() const {
|
||||||
|
|||||||
@@ -50,9 +50,9 @@ namespace {
|
|||||||
}
|
}
|
||||||
|
|
||||||
HeaderEntity::HeaderEntity(const char* const datatype, size_t size, IfcFile* file)
|
HeaderEntity::HeaderEntity(const char* const datatype, size_t size, IfcFile* file)
|
||||||
: data_(file ? read_from_file(file, size) : IfcEntityInstanceData(storage_t(size)))
|
: datatype_(datatype)
|
||||||
, datatype_(datatype)
|
|
||||||
, file_(file)
|
, file_(file)
|
||||||
|
, data_(file ? read_from_file(file, size) : IfcEntityInstanceData(storage_t(size)))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
HeaderEntity::~HeaderEntity() {
|
HeaderEntity::~HeaderEntity() {
|
||||||
|
|||||||
@@ -71,9 +71,9 @@ class IFC_PARSE_API IfcSpfStream {
|
|||||||
/// Moves the file cursor to an arbitrary offset in the file
|
/// Moves the file cursor to an arbitrary offset in the file
|
||||||
void Seek(unsigned int offset);
|
void Seek(unsigned int offset);
|
||||||
/// Returns the cursor position
|
/// Returns the cursor position
|
||||||
unsigned int Tell();
|
unsigned int Tell() const;
|
||||||
|
|
||||||
bool is_eof_at(unsigned int);
|
bool is_eof_at(unsigned int) const;
|
||||||
void increment_at(unsigned int&);
|
void increment_at(unsigned int&);
|
||||||
char peek_at(unsigned int);
|
char peek_at(unsigned int);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -459,7 +459,7 @@ static void start_element(void* user, const xmlChar* tag, const xmlChar** attrs)
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Create or reference an instance from the file and set attributes based on XML attributes.
|
// Create or reference an instance from the file and set attributes based on XML attributes.
|
||||||
auto create_instance = [&state, &attributes, &id](const IfcParse::declaration* decl) {
|
auto create_instance = [&state, &attributes](const IfcParse::declaration* decl) {
|
||||||
boost::optional<std::string> id;
|
boost::optional<std::string> id;
|
||||||
boost::variant<std::string, IfcUtil::IfcBaseClass*> rv;
|
boost::variant<std::string, IfcUtil::IfcBaseClass*> rv;
|
||||||
|
|
||||||
@@ -479,7 +479,7 @@ static void start_element(void* user, const xmlChar* tag, const xmlChar** attrs)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto untyped = IfcEntityInstanceData(storage_t(decl->as_entity() ? decl->as_entity()->attribute_count() : 1));
|
auto untyped = IfcEntityInstanceData(storage_t(decl->as_entity() != nullptr ? decl->as_entity()->attribute_count() : 1));
|
||||||
|
|
||||||
const IfcParse::entity* entity = decl->as_entity();
|
const IfcParse::entity* entity = decl->as_entity();
|
||||||
if (entity != nullptr) {
|
if (entity != nullptr) {
|
||||||
|
|||||||
Reference in New Issue
Block a user