mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-31 17:06:29 +00:00
Normalize whitespaces in the codebase
This commit is contained in:
@@ -193,11 +193,11 @@ std::tuple<std::vector<Ifc4x3_add2::IfcObjectDefinition>, std::vector<Ifc4x3_add
|
||||
design_parameters.setEndRadiusOfCurvature(0);
|
||||
design_parameters.setSegmentLength(0.0);
|
||||
design_parameters.setPredefinedType(Ifc4x3_add2::IfcAlignmentHorizontalSegmentTypeEnum::IfcAlignmentHorizontalSegmentType_LINE);
|
||||
|
||||
|
||||
alignment_segment = file.create<Ifc4x3_add2::IfcAlignmentSegment>();
|
||||
alignment_segment.setGlobalId(ifcopenshell::global_id());
|
||||
alignment_segment.setDesignParameters(design_parameters);
|
||||
|
||||
|
||||
horizontal_segments.push_back(alignment_segment);
|
||||
if (include_geometry) {
|
||||
auto segment = mapAlignmentHorizontalSegment(file, design_parameters).first;
|
||||
@@ -238,7 +238,7 @@ Ifc4x3_add2::IfcAlignment addHorizontalAlignment(hierarchy_helper<Ifc4x3_add2>&
|
||||
//
|
||||
Ifc4x3_add2::IfcLocalPlacement placement;
|
||||
Ifc4x3_add2::IfcProductDefinitionShape product_definition_shape;
|
||||
if (include_geometry) {
|
||||
if (include_geometry) {
|
||||
// create the footprint representation
|
||||
auto axis_model_representation_subcontext = file.getRepresentationSubContext("Axis", "Model");
|
||||
auto footprint_shape_representation = file.create<Ifc4x3_add2::IfcShapeRepresentation>();
|
||||
@@ -246,7 +246,7 @@ Ifc4x3_add2::IfcAlignment addHorizontalAlignment(hierarchy_helper<Ifc4x3_add2>&
|
||||
footprint_shape_representation.setRepresentationIdentifier("FootPrint");
|
||||
footprint_shape_representation.setRepresentationType("Curve2D");
|
||||
footprint_shape_representation.setItems(std::vector<Ifc4x3_add2::IfcRepresentationItem>{composite_curve});
|
||||
|
||||
|
||||
placement = file.addLocalPlacement();
|
||||
// the alignment has a plan view footprint representation
|
||||
// create the alignment product definition
|
||||
@@ -263,7 +263,7 @@ Ifc4x3_add2::IfcAlignment addHorizontalAlignment(hierarchy_helper<Ifc4x3_add2>&
|
||||
alignment.setGlobalId(ifcopenshell::global_id());
|
||||
alignment.setName(alignment_name);
|
||||
alignment.setObjectPlacement(placement);
|
||||
alignment.setRepresentation(product_definition_shape);
|
||||
alignment.setRepresentation(product_definition_shape);
|
||||
|
||||
return alignment;
|
||||
}
|
||||
@@ -429,13 +429,13 @@ Ifc4x3_add2::IfcAlignment addAlignment(hierarchy_helper<Ifc4x3_add2>& file, cons
|
||||
auto vertical_profile = file.create<Ifc4x3_add2::IfcAlignmentVertical>();
|
||||
vertical_profile.setGlobalId(ifcopenshell::global_id());
|
||||
vertical_profile.setName(alignment_name + "- Vertical");
|
||||
|
||||
|
||||
auto nests_vertical_segments = file.create<Ifc4x3_add2::IfcRelNests>();
|
||||
nests_vertical_segments.setGlobalId(ifcopenshell::global_id());
|
||||
nests_vertical_segments.setName("Nests vertical alignment segments with vertical alignment");
|
||||
nests_vertical_segments.setRelatingObject(vertical_profile);
|
||||
nests_vertical_segments.setRelatedObjects(vertical_segments);
|
||||
|
||||
|
||||
Ifc4x3_add2::IfcLocalPlacement placement;
|
||||
Ifc4x3_add2::IfcProductDefinitionShape product_definition_shape;
|
||||
if (include_geometry) {
|
||||
@@ -475,7 +475,7 @@ Ifc4x3_add2::IfcAlignment addAlignment(hierarchy_helper<Ifc4x3_add2>& file, cons
|
||||
alignment.setName(alignment_name);
|
||||
alignment.setObjectPlacement(placement);
|
||||
alignment.setRepresentation(product_definition_shape);
|
||||
|
||||
|
||||
// Nest the IfcAlignmentHorizontal and IfcAlignmentVertical with the IfcAlignment to complete the business logic
|
||||
// 4.1.4.4.1 Alignments nest horizontal and vertical layouts
|
||||
// https://standards.buildingsmart.org/IFC/RELEASE/IFC4_3/HTML/concepts/Object_Composition/Nesting/Alignment_Layouts/content.html
|
||||
@@ -856,7 +856,7 @@ std::pair<Ifc4x3_add2::IfcCurveSegment, Ifc4x3_add2::IfcCurveSegment> mapAlignme
|
||||
} else {
|
||||
logger.error(std::string("unexpected AlignmentVerticalSegmentType encountered"));
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace {
|
||||
!std::is_same_v<std::remove_cv_t<T>, express::base>)
|
||||
{
|
||||
std::string str;
|
||||
array_.db_ptr->db->Get(rocksdb::ReadOptions{},
|
||||
array_.db_ptr->db->Get(rocksdb::ReadOptions{},
|
||||
(is_header ? "h|" : (entity_or_type->as_entity() ? "i|" : "t|")) +
|
||||
(is_header ? entity_or_type->name() : std::to_string(instance_name_)) + "|" +
|
||||
std::to_string(index_), &str);
|
||||
@@ -132,7 +132,7 @@ namespace {
|
||||
}
|
||||
return (size_t) str[0] - 'A';
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
throw std::logic_error("RocksDB storage is unavailable");
|
||||
}
|
||||
}
|
||||
@@ -347,7 +347,7 @@ bool ::impl::serialize(std::string& val, const std::vector<std::vector<express::
|
||||
{
|
||||
std::ostringstream oss;
|
||||
oss.put(type_encoder::encode_type<std::vector<std::vector<express::base>>>());
|
||||
|
||||
|
||||
auto write_size = [&oss](size_t sz) {
|
||||
std::string size_str;
|
||||
size_str.resize(sizeof(size_t));
|
||||
@@ -477,7 +477,7 @@ bool ::impl::deserialize(ifcopenshell::impl::rocks_db_file_storage* storage, con
|
||||
size_t inner_size;
|
||||
memcpy(&inner_size, ptr, sizeof(size_t));
|
||||
ptr += sizeof(size_t);
|
||||
|
||||
|
||||
if (ptr + inner_size * (sizeof(size_t) + 1) > val.data() + val.size()) {
|
||||
return false;
|
||||
}
|
||||
@@ -533,7 +533,7 @@ void rocks_db_attribute_storage::set(void* storage, const ifcopenshell::declarat
|
||||
rdb_storage->db->Put(
|
||||
rdb_storage->wopts,
|
||||
(is_header ? "h|" : (decl->as_entity() ? "i|" : "t|")) +
|
||||
(is_header ? decl->name() : std::to_string(identity)) + "|" +
|
||||
(is_header ? decl->name() : std::to_string(identity)) + "|" +
|
||||
std::to_string(index), v);
|
||||
}
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ class IFC_PARSE_API base {
|
||||
|
||||
void set_attribute_value(size_t attribute_index, const express::base& value);
|
||||
void set_attribute_value(const std::string& attribute_name, const express::base& value);
|
||||
|
||||
|
||||
void unset_attribute_value(size_t attribute_index);
|
||||
|
||||
ifcopenshell::attribute_value get_attribute_value(size_t attribute_index) const;
|
||||
@@ -152,7 +152,7 @@ class IFC_PARSE_API base {
|
||||
} else {
|
||||
return T{};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ifcopenshell::file* file() const;
|
||||
|
||||
@@ -51,7 +51,7 @@ express::base ifcopenshell::impl::rocks_db_file_storage::assert_existance(size_t
|
||||
return express::base(it->second);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::string v;
|
||||
|
||||
rocksdb::Status s = db->Get(rocksdb::ReadOptions{}, (r == entityinstance_ref ? "i|" : "t|") + std::to_string(number) + "|_", &v);
|
||||
@@ -377,7 +377,7 @@ express::base ifcopenshell::impl::in_memory_file_storage::create(const ifcopensh
|
||||
} else {
|
||||
tbyid_.insert({data->identity(), data});
|
||||
}
|
||||
|
||||
|
||||
express::base inst(data);
|
||||
add_type_ref(inst);
|
||||
|
||||
@@ -414,4 +414,3 @@ express::base ifcopenshell::file::create(const ifcopenshell::declaration* decl,
|
||||
}
|
||||
}, storage_);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -428,7 +428,7 @@ public:
|
||||
express::base create(const ifcopenshell::declaration* declaration, int instance_id = -1);
|
||||
|
||||
void batch() {
|
||||
batch_mode_ = true;
|
||||
batch_mode_ = true;
|
||||
}
|
||||
void unbatch();
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ class IFC_SCHEMA_API hierarchy_helper : public ifcopenshell::file {
|
||||
auto t = create<T>();
|
||||
t.set_attribute_value(0, std::vector<double>{x, y});
|
||||
return t;
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T, typename U>
|
||||
T addValue(U value) {
|
||||
|
||||
@@ -114,7 +114,7 @@ typename Schema::IfcOwnerHistory hierarchy_helper<Schema>::addOwnerHistory() {
|
||||
owner_hist.setLastModifyingUser(person_and_org);
|
||||
owner_hist.setLastModifyingApplication(application);
|
||||
owner_hist.setCreationDate(timestamp);
|
||||
|
||||
|
||||
return owner_hist;
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ typename Schema::IfcProject hierarchy_helper<Schema>::addProject(typename Schema
|
||||
unit2.setUnitType(Schema::IfcUnitEnum::IfcUnit_PLANEANGLEUNIT);
|
||||
unit2.setName("Degrees");
|
||||
unit2.setConversionFactor(unit2b);
|
||||
|
||||
|
||||
std::vector<typename Schema::IfcUnit> units = {unit1, unit2};
|
||||
auto unit_assignment = create<typename Schema::IfcUnitAssignment>();
|
||||
unit_assignment.setUnits(units);
|
||||
@@ -317,7 +317,7 @@ void hierarchy_helper<Schema>::addExtrudedPolyline(typename Schema::IfcShapeRepr
|
||||
solid.setPosition(place2 ? place2 : addPlacement3d());
|
||||
solid.setExtrudedDirection(dir ? dir : addTriplet<typename Schema::IfcDirection>(0, 0, 1));
|
||||
solid.setDepth(h);
|
||||
|
||||
|
||||
std::vector<typename Schema::IfcRepresentationItem> items;
|
||||
try {
|
||||
auto existing_items = rep.Items();
|
||||
@@ -372,7 +372,7 @@ template <typename Schema>
|
||||
void hierarchy_helper<Schema>::addAxis(
|
||||
typename Schema::IfcShapeRepresentation rep,
|
||||
double l,
|
||||
typename Schema::IfcRepresentationContext /*context*/)
|
||||
typename Schema::IfcRepresentationContext /*context*/)
|
||||
{
|
||||
auto p1 = addDoublet<typename Schema::IfcCartesianPoint>(-l / 2., 0.);
|
||||
auto p2 = addDoublet<typename Schema::IfcCartesianPoint>(+l / 2., 0.);
|
||||
@@ -402,7 +402,7 @@ typename Schema::IfcProductDefinitionShape hierarchy_helper<Schema>::addBox(doub
|
||||
|
||||
auto shape = create<typename Schema::IfcProductDefinitionShape>();
|
||||
shape.setRepresentations(std::vector<typename Schema::IfcRepresentation>{rep});
|
||||
|
||||
|
||||
addBox(rep, w, d, h, place, place2, dir, context);
|
||||
return shape;
|
||||
}
|
||||
|
||||
@@ -301,7 +301,7 @@ namespace impl {
|
||||
bool serialize(std::string& buffer, const boost::logic::tribool& value);
|
||||
|
||||
bool serialize(std::string& buffer, const boost::dynamic_bitset<>& value);
|
||||
|
||||
|
||||
bool serialize(std::string& buffer, const express::base& value);
|
||||
|
||||
bool serialize(std::string& buffer, const ifcopenshell::enumeration_reference& value);
|
||||
|
||||
+14
-14
@@ -1085,7 +1085,7 @@ void ifcopenshell::impl::rocks_db_file_storage::register_inverse(unsigned id_fro
|
||||
uint32_t v = id_from;
|
||||
s.resize(sizeof(uint32_t));
|
||||
memcpy(s.data(), &v, sizeof(uint32_t));
|
||||
|
||||
|
||||
auto key = "v|" + to_string_fixed_width(inst_id, 10) + "|" + to_string_fixed_width(from_entity->index_in_schema(), 4) + "|" + to_string_fixed_width(attribute_index, 2);
|
||||
|
||||
db->Merge(wopts, key, s);
|
||||
@@ -1143,7 +1143,7 @@ void ifcopenshell::impl::rocks_db_file_storage::add_type_ref(const express::base
|
||||
|
||||
// no merges yet, because the python client doesn't support them
|
||||
db->Merge(wopts, "t|" + std::to_string(new_entity.declaration().index_in_schema()), s);
|
||||
|
||||
|
||||
/*{
|
||||
std::string current;
|
||||
// @todo this uses the same key-namespace as typedecl instances, not a direct conflict, but also not very clear
|
||||
@@ -1151,7 +1151,7 @@ void ifcopenshell::impl::rocks_db_file_storage::add_type_ref(const express::base
|
||||
db->Get(rocksdb::ReadOptions{}, key, ¤t);
|
||||
auto new_val = current + s;
|
||||
db->Put(wopts, key, new_val);
|
||||
}*/
|
||||
}*/
|
||||
}
|
||||
|
||||
// not only mapping also register type
|
||||
@@ -1639,7 +1639,7 @@ express::base::set_attribute_value(size_t i, const T& t) {
|
||||
register_inverse_visitor visitor(*file(), *this);
|
||||
apply_individual_instance_visitor(new_attribute, (int)i).apply(visitor);
|
||||
}
|
||||
|
||||
|
||||
// Register new attribute guid in guid map
|
||||
if (i == 0 && (file()->ifcroot_type() != nullptr) && this->declaration().is(*file()->ifcroot_type())) {
|
||||
try {
|
||||
@@ -1800,7 +1800,7 @@ file::file(void* data, int length, ifcopenshell::logger& log)
|
||||
, max_id_(0)
|
||||
{
|
||||
file_reader<pushed_sequential_impl> s(std::string((char*)data, length), caller_fed_tag{});
|
||||
|
||||
|
||||
storage_.emplace<1>(this, logger_.get());
|
||||
header_.reset(new spf_header(this, &logger_.get()));
|
||||
std::get<impl::in_memory_file_storage>(storage_).read_from_stream(&s, schema_, max_id_, types_to_bypass_loading_);
|
||||
@@ -2372,7 +2372,7 @@ void ifcopenshell::impl::in_memory_file_storage::read_from_stream(Reader* s, con
|
||||
} else {
|
||||
auto storage = owner;
|
||||
auto attr_index = p.first.index_;
|
||||
|
||||
|
||||
if (storage->template has_attribute_value<express::base>(attr_index)) {
|
||||
express::base inst = storage->get_attribute_value(attr_index);
|
||||
if (inst && !inst.declaration().as_entity()) {
|
||||
@@ -2416,7 +2416,7 @@ void ifcopenshell::impl::in_memory_file_storage::read_from_stream(Reader* s, con
|
||||
|
||||
auto storage = owner;
|
||||
auto attr_index = p.first.index_;
|
||||
|
||||
|
||||
if (storage->template has_attribute_value<express::base>(attr_index)) {
|
||||
express::base inst = storage->get_attribute_value(attr_index);
|
||||
if (inst && !inst.declaration().as_entity()) {
|
||||
@@ -2458,7 +2458,7 @@ void ifcopenshell::impl::in_memory_file_storage::read_from_stream(Reader* s, con
|
||||
|
||||
auto storage = owner;
|
||||
auto attr_index = p.first.index_;
|
||||
|
||||
|
||||
if (storage->template has_attribute_value<express::base>(attr_index)) {
|
||||
express::base inst = storage->get_attribute_value(attr_index);
|
||||
if (inst && !inst.declaration().as_entity()) {
|
||||
@@ -2648,7 +2648,7 @@ express::base file::add_entity(const express::base& entity, int id) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// In case an entity is added that contains geometry, the unit
|
||||
// information needs to be accounted for for IfcLengthMeasures.
|
||||
double conversion_factor = calculate_unit_factors ? std::numeric_limits<double>::quiet_NaN() : 1.0;
|
||||
@@ -2702,7 +2702,7 @@ express::base file::add_entity(const express::base& entity, int id) {
|
||||
new_instances.back().push_back(eit->second);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
new_entity.set_attribute_value(i, new_instances);
|
||||
} else if ((potentially_length_measure_decl != nullptr) && potentially_length_measure_decl->is(*schema()->declaration_by_name("IfcLengthMeasure"))) {
|
||||
if (boost::math::isnan(conversion_factor)) {
|
||||
@@ -3172,7 +3172,7 @@ std::vector<int> file::get_inverse_indices_by_id(int instance_id) {
|
||||
|
||||
std::vector<express::entity> file::get_inverse(int instance_id, const ifcopenshell::declaration* type, int attribute_index) {
|
||||
std::vector<express::entity> return_value;
|
||||
|
||||
|
||||
if (type == nullptr && attribute_index == -1) {
|
||||
// @todo this is silly.
|
||||
auto r = instances_by_reference(instance_id);
|
||||
@@ -3181,7 +3181,7 @@ std::vector<express::entity> file::get_inverse(int instance_id, const ifcopenshe
|
||||
}
|
||||
return return_value;
|
||||
}
|
||||
|
||||
|
||||
std::visit([&return_value, this, attribute_index, instance_id, type](auto& x) {
|
||||
if constexpr (std::is_same_v<std::decay_t<decltype(x)>, std::monostate>) {
|
||||
} else if constexpr (std::is_same_v<std::decay_t<decltype(x)>, impl::in_memory_file_storage>) {
|
||||
@@ -3431,7 +3431,7 @@ ifcopenshell::file* express::base::file() const {
|
||||
instance_data::instance_data(const instance_data& data)
|
||||
: storage_(data.size())
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
@@ -3470,7 +3470,7 @@ bool ifcopenshell::impl::rocks_db_file_storage::read_schema(const ifcopenshell::
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
/********************************************************************************
|
||||
* *
|
||||
* This file provides functions for loading an IFC file into memory and access *
|
||||
* its entities either by ID, by an IfcSchema::Type or by reference *
|
||||
* its entities either by ID, by an IfcSchema::Type or by reference *
|
||||
* *
|
||||
********************************************************************************/
|
||||
|
||||
@@ -53,7 +53,7 @@ class IFC_PARSE_API spf_lexer {
|
||||
private:
|
||||
character_decoder<Reader>* decoder_;
|
||||
ifcopenshell::logger& logger_;
|
||||
|
||||
|
||||
size_t skip_whitespace() const;
|
||||
size_t skip_comment() const;
|
||||
|
||||
@@ -61,7 +61,7 @@ class IFC_PARSE_API spf_lexer {
|
||||
mutable size_t pool_index = 0;
|
||||
|
||||
public:
|
||||
|
||||
|
||||
spf_lexer(const spf_lexer&) = delete;
|
||||
spf_lexer& operator=(const spf_lexer&) = delete;
|
||||
|
||||
|
||||
@@ -180,7 +180,7 @@ namespace ifcopenshell {
|
||||
|
||||
token(size_t start_position, char operator_character)
|
||||
: start_pos(start_position), type(Token_OPERATOR), value_char(operator_character) {}
|
||||
|
||||
|
||||
token(size_t start_position, token_type token_kind, char character_value)
|
||||
: start_pos(start_position), type(token_kind), value_char(character_value) {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user