ifcparse: unify private member variables name to use trailing underscore

This commit is contained in:
Dirk Olbrich
2023-11-06 20:38:19 +01:00
committed by Thomas Krijnen
parent 8b145248c6
commit eea9a14722
20 changed files with 324 additions and 323 deletions
+9 -9
View File
@@ -72,7 +72,7 @@ using namespace IfcParse;
using namespace IfcWrite;
IfcCharacterDecoder::IfcCharacterDecoder(IfcParse::IfcSpfStream* f) {
file = f;
stream_ = f;
codepage_ = 0;
}
@@ -241,18 +241,18 @@ class pure_impure_helper {
} // namespace
IfcCharacterDecoder::operator std::string() {
return pure_impure_helper(file).get(mode, substitution_character);
return pure_impure_helper(stream_).get(mode, substitution_character);
}
std::string IfcCharacterDecoder::get(unsigned int& ptr) {
return pure_impure_helper(file, ptr).get(mode, substitution_character);
return pure_impure_helper(stream_, ptr).get(mode, substitution_character);
}
void IfcCharacterDecoder::skip() {
unsigned int parse_state = 0;
char current_char;
unsigned int hex_count = 0;
while ((current_char = file->Peek()) != 0) {
while ((current_char = stream_->Peek()) != 0) {
if (EXPECTS_CHARACTER(parse_state)) {
parse_state = 0;
} else if (current_char == '\'' && (parse_state == 0U)) {
@@ -307,11 +307,11 @@ void IfcCharacterDecoder::skip() {
if (parse_state == APOSTROPHE && current_char != '\'') {
break;
}
throw IfcInvalidTokenException(file->Tell(), current_char);
throw IfcInvalidTokenException(stream_->Tell(), current_char);
} else {
parse_state = hex_count = 0;
}
file->Inc();
stream_->Inc();
}
}
@@ -319,7 +319,7 @@ IfcCharacterDecoder::ConversionMode IfcCharacterDecoder::mode = IfcCharacterDeco
char IfcCharacterDecoder::substitution_character = '_';
IfcCharacterEncoder::IfcCharacterEncoder(const std::string& input)
: str(IfcUtil::convert_utf8_to_utf32(input)) {}
: str_(IfcUtil::convert_utf8_to_utf32(input)) {}
IfcCharacterEncoder::operator std::string() {
std::ostringstream oss;
@@ -328,12 +328,12 @@ IfcCharacterEncoder::operator std::string() {
// Either 2 or 4 to uses \X2 or \X4 respectively.
// Currently hardcoded to 4, but \X2 might be
// sufficient for nearly all purposes.
const int num_bytes = (str.empty() || (*std::max_element(str.begin(), str.end()) > 0xffff)) ? 4 : 2;
const int num_bytes = (str_.empty() || (*std::max_element(str_.begin(), str_.end()) > 0xffff)) ? 4 : 2;
const std::string num_bytes_str = std::string(1, num_bytes + 0x30);
bool in_extended = false;
for (auto it = str.begin(); it != str.end(); ++it) {
for (auto it = str_.begin(); it != str_.end(); ++it) {
auto ch = *it;
const bool within_spf_range = ch >= 0x20 && ch <= 0x7e;
if (in_extended && within_spf_range) {
+2 -2
View File
@@ -42,7 +42,7 @@ namespace IfcParse {
class IFC_PARSE_API IfcCharacterDecoder {
private:
IfcParse::IfcSpfStream* file;
IfcParse::IfcSpfStream* stream_;
int codepage_;
public:
@@ -72,7 +72,7 @@ namespace IfcWrite {
class IFC_PARSE_API IfcCharacterEncoder {
private:
std::u32string str;
std::u32string str_;
public:
IfcCharacterEncoder(const std::string& input);
+3 -3
View File
@@ -36,14 +36,14 @@
namespace IfcParse {
class IFC_PARSE_API IfcException : public std::exception {
private:
std::string message;
std::string message_;
public:
IfcException(const std::string& m)
: message(m) {}
: message_(m) {}
virtual ~IfcException() throw() {}
virtual const char* what() const throw() {
return message.c_str();
return message_.c_str();
}
};
+9 -9
View File
@@ -135,15 +135,15 @@ class IFC_PARSE_API IfcFile {
std::vector<Argument*> internal_attribute_vector_, internal_attribute_vector_simple_type_;
entity_by_id_t byid;
entity_by_id_t byid_;
// this is for simple types
entity_by_iden_t byidentity;
entities_by_type_t bytype;
entities_by_type_t bytype_excl;
entities_by_ref_t byref;
entities_by_ref_excl_t byref_excl;
entity_by_guid_t byguid;
entity_entity_map_t entity_file_map;
entity_by_iden_t byidentity_;
entities_by_type_t bytype_;
entities_by_type_t bytype_excl_;
entities_by_ref_t byref_;
entities_by_ref_excl_t byref_excl_;
entity_by_guid_t byguid_;
entity_entity_map_t entity_file_map_;
unsigned int MaxId;
@@ -316,7 +316,7 @@ class IFC_PARSE_API IfcFile {
void build_inverses();
entity_by_guid_t& internal_guid_map() { return byguid; };
entity_by_guid_t& internal_guid_map() { return byguid_; };
};
#ifdef WITH_IFCXML
+12 -12
View File
@@ -89,14 +89,14 @@ void expand(const std::string& s, std::vector<unsigned char>& v) {
static boost::uuids::basic_random_generator<boost::mt19937> gen;
IfcParse::IfcGlobalId::IfcGlobalId() {
uuid_data = gen();
std::vector<unsigned char> v(uuid_data.size());
std::copy(uuid_data.begin(), uuid_data.end(), v.begin());
string_data = compress(&v[0]);
uuid_data_ = gen();
std::vector<unsigned char> v(uuid_data_.size());
std::copy(uuid_data_.begin(), uuid_data_.end(), v.begin());
string_data_ = compress(&v[0]);
#if BOOST_VERSION < 104400
formatted_string = boost::lexical_cast<std::string>(uuid_data);
#else
formatted_string = boost::uuids::to_string(uuid_data);
formatted_string_ = boost::uuids::to_string(uuid_data_);
#endif
#ifndef NDEBUG
@@ -111,14 +111,14 @@ IfcParse::IfcGlobalId::IfcGlobalId() {
}
IfcParse::IfcGlobalId::IfcGlobalId(const std::string& s)
: string_data(s) {
: string_data_(s) {
std::vector<unsigned char> v;
expand(string_data, v);
std::copy(v.begin(), v.end(), uuid_data.begin());
expand(string_data_, v);
std::copy(v.begin(), v.end(), uuid_data_.begin());
#if BOOST_VERSION < 104400
formatted_string = boost::lexical_cast<std::string>(uuid_data);
#else
formatted_string = boost::uuids::to_string(uuid_data);
formatted_string_ = boost::uuids::to_string(uuid_data_);
#endif
#ifndef NDEBUG
@@ -130,13 +130,13 @@ IfcParse::IfcGlobalId::IfcGlobalId(const std::string& s)
}
IfcParse::IfcGlobalId::operator const std::string&() const {
return string_data;
return string_data_;
}
IfcParse::IfcGlobalId::operator const boost::uuids::uuid&() const {
return uuid_data;
return uuid_data_;
}
const std::string& IfcParse::IfcGlobalId::formatted() const {
return formatted_string;
return formatted_string_;
}
+3 -2
View File
@@ -30,8 +30,9 @@ namespace IfcParse {
/// A helper class for the creation of IFC GlobalIds.
class IFC_PARSE_API IfcGlobalId {
private:
std::string string_data, formatted_string;
boost::uuids::uuid uuid_data;
std::string string_data_;
std::string formatted_string_;
boost::uuids::uuid uuid_data_;
public:
static const unsigned int length = 22;
+3 -3
View File
@@ -995,8 +995,8 @@ void push_back_to_maybe_optional(boost::optional<boost::shared_ptr<T>>& t, U* u)
template <typename Schema>
typename Schema::IfcGeometricRepresentationContext* IfcHierarchyHelper<Schema>::getRepresentationContext(const std::string& s) {
typename std::map<std::string, typename Schema::IfcGeometricRepresentationContext*>::const_iterator it = contexts.find(s);
if (it != contexts.end()) {
typename std::map<std::string, typename Schema::IfcGeometricRepresentationContext*>::const_iterator it = contexts_.find(s);
if (it != contexts_.end()) {
return it->second;
}
typename Schema::IfcProject* project = getSingle<typename Schema::IfcProject>();
@@ -1010,7 +1010,7 @@ typename Schema::IfcGeometricRepresentationContext* IfcHierarchyHelper<Schema>::
push_back_to_maybe_optional(project_contexts, context);
project->setRepresentationContexts(project_contexts);
return contexts[s] = context;
return contexts_[s] = context;
}
#ifdef HAS_SCHEMA_2x3
+1 -1
View File
@@ -517,7 +517,7 @@ class IFC_PARSE_API IfcHierarchyHelper : public IfcParse::IfcFile {
typename Schema::IfcGeometricRepresentationContext* getRepresentationContext(const std::string&);
private:
std::map<std::string, typename Schema::IfcGeometricRepresentationContext*> contexts;
std::map<std::string, typename Schema::IfcGeometricRepresentationContext*> contexts_;
};
#ifdef HAS_SCHEMA_2x3
+58 -58
View File
@@ -61,7 +61,7 @@ template <>
const std::array<std::basic_string<wchar_t>, 5> severity_strings<wchar_t>::value = {L"Performance", L"Debug", L"Notice", L"Warning", L"Error"};
template <typename T>
void plain_text_message(T& os, const boost::optional<const IfcUtil::IfcBaseClass*>& current_product, Logger::Severity type, const std::string& message, const IfcUtil::IfcBaseInterface* instance) {
void plain_text_message(T& os, const boost::optional<IfcUtil::IfcBaseClass*>& current_product, Logger::Severity type, const std::string& message, const IfcUtil::IfcBaseInterface* instance) {
os << "[" << severity_strings<typename T::char_type>::value[type] << "] ";
os << "[" << get_time(type <= Logger::LOG_PERF).c_str() << "] ";
if (current_product) {
@@ -86,7 +86,7 @@ std::basic_string<T> string_as(const std::string& s) {
}
template <typename T>
void json_message(T& os, const boost::optional<const IfcUtil::IfcBaseClass*>& current_product, Logger::Severity type, const std::string& message, const IfcUtil::IfcBaseInterface* instance) {
void json_message(T& os, const boost::optional<IfcUtil::IfcBaseClass*>& current_product, Logger::Severity type, const std::string& message, const IfcUtil::IfcBaseInterface* instance) {
boost::property_tree::basic_ptree<std::basic_string<typename T::char_type>, std::basic_string<typename T::char_type>> pt;
// @todo this is crazy
@@ -112,31 +112,31 @@ void json_message(T& os, const boost::optional<const IfcUtil::IfcBaseClass*>& cu
} // namespace
void Logger::SetProduct(boost::optional<const IfcUtil::IfcBaseClass*> product) {
if (verbosity <= LOG_DEBUG && product) {
if (verbosity_ <= LOG_DEBUG && product) {
Message(LOG_DEBUG, "Begin processing", *product);
}
if (!product && print_perf_stats_on_element) {
if (!product && print_perf_stats_on_element_) {
PrintPerformanceStats();
performance_statistics.clear();
performance_statistics_.clear();
}
current_product = product;
current_product_ = product;
}
void Logger::SetOutput(std::ostream* l1, std::ostream* l2) {
wlog1 = wlog2 = 0;
log1 = l1;
log2 = l2;
if (log2 == nullptr) {
log2 = &log_stream;
wlog1_ = wlog2_ = 0;
log1_ = l1;
log2_ = l2;
if (log2_ == nullptr) {
log2_ = &log_stream_;
}
}
void Logger::SetOutput(std::wostream* l1, std::wostream* l2) {
log1 = log2 = 0;
wlog1 = l1;
wlog2 = l2;
if (wlog2 == nullptr) {
log2 = &log_stream;
log1_ = log2_ = 0;
wlog1_ = l1;
wlog2_ = l2;
if (wlog2_ == nullptr) {
log2_ = &log_stream_;
}
}
@@ -145,33 +145,33 @@ void Logger::Message(Logger::Severity type, const std::string& message, const If
std::lock_guard<std::mutex> lk(m);
if (type == LOG_PERF) {
if (!first_timepoint) {
first_timepoint = std::chrono::time_point_cast<std::chrono::nanoseconds>(std::chrono::high_resolution_clock::now()).time_since_epoch().count();
if (!first_timepoint_) {
first_timepoint_ = std::chrono::time_point_cast<std::chrono::nanoseconds>(std::chrono::high_resolution_clock::now()).time_since_epoch().count();
}
double t0 = (std::chrono::time_point_cast<std::chrono::nanoseconds>(std::chrono::high_resolution_clock::now()).time_since_epoch().count() - *first_timepoint) / 1.e9;
double t0 = (std::chrono::time_point_cast<std::chrono::nanoseconds>(std::chrono::high_resolution_clock::now()).time_since_epoch().count() - *first_timepoint_) / 1.e9;
if (message.substr(0, 5) == "done ") {
auto orig = message.substr(5);
performance_statistics[orig] += t0 - performance_signal_start[orig];
performance_statistics_[orig] += t0 - performance_signal_start_[orig];
} else {
performance_signal_start[message] = t0;
performance_signal_start_[message] = t0;
}
}
if (type > max_severity) {
max_severity = type;
if (type > max_severity_) {
max_severity_ = type;
}
if (((log2 != nullptr) || (wlog2 != nullptr)) && type >= verbosity) {
if (format == FMT_PLAIN) {
if (log2 != nullptr) {
plain_text_message(*log2, current_product, type, message, instance);
} else if (wlog2 != nullptr) {
plain_text_message(*wlog2, current_product, type, message, instance);
if (((log2_ != nullptr) || (wlog2_ != nullptr)) && type >= verbosity_) {
if (format_ == FMT_PLAIN) {
if (log2_ != nullptr) {
plain_text_message(*log2_, current_product_, type, message, instance);
} else if (wlog2_ != nullptr) {
plain_text_message(*wlog2_, current_product_, type, message, instance);
}
} else if (format == FMT_JSON) {
if (log2 != nullptr) {
json_message(*log2, current_product, type, message, instance);
} else if (wlog2 != nullptr) {
json_message(*wlog2, current_product, type, message, instance);
} else if (format_ == FMT_JSON) {
if (log2_ != nullptr) {
json_message(*log2_, current_product_, type, message, instance);
} else if (wlog2_ != nullptr) {
json_message(*wlog2_, current_product_, type, message, instance);
}
}
}
@@ -192,10 +192,10 @@ void status(T& log1, const std::string& message, bool new_line) {
}
void Logger::Status(const std::string& message, bool new_line) {
if (log1 != nullptr) {
status(*log1, message, new_line);
} else if (wlog1 != nullptr) {
status(*wlog1, message, new_line);
if (log1_ != nullptr) {
status(*log1_, message, new_line);
} else if (wlog1_ != nullptr) {
status(*wlog1_, message, new_line);
}
}
@@ -204,12 +204,12 @@ void Logger::ProgressBar(int progress) {
}
std::string Logger::GetLog() {
return log_stream.str();
return log_stream_.str();
}
void Logger::PrintPerformanceStats() {
std::vector<std::pair<double, std::string>> items;
for (auto& p : performance_statistics) {
for (auto& p : performance_statistics_) {
items.push_back({p.second, p.first});
}
@@ -229,24 +229,24 @@ void Logger::PrintPerformanceStats() {
}
}
void Logger::Verbosity(Logger::Severity v) { verbosity = v; }
Logger::Severity Logger::Verbosity() { return verbosity; }
void Logger::Verbosity(Logger::Severity v) { verbosity_ = v; }
Logger::Severity Logger::Verbosity() { return verbosity_; }
Logger::Severity Logger::MaxSeverity() { return max_severity; }
Logger::Severity Logger::MaxSeverity() { return max_severity_; }
void Logger::OutputFormat(Format f) { format = f; }
Logger::Format Logger::OutputFormat() { return format; }
void Logger::OutputFormat(Format f) { format_ = f; }
Logger::Format Logger::OutputFormat() { return format_; }
std::ostream* Logger::log1 = 0;
std::ostream* Logger::log2 = 0;
std::wostream* Logger::wlog1 = 0;
std::wostream* Logger::wlog2 = 0;
std::stringstream Logger::log_stream;
Logger::Severity Logger::verbosity = Logger::LOG_NOTICE;
Logger::Severity Logger::max_severity = Logger::LOG_NOTICE;
Logger::Format Logger::format = Logger::FMT_PLAIN;
boost::optional<const IfcUtil::IfcBaseClass*> Logger::current_product;
boost::optional<long long> Logger::first_timepoint;
std::map<std::string, double> Logger::performance_statistics;
std::map<std::string, double> Logger::performance_signal_start;
bool Logger::print_perf_stats_on_element = false;
std::ostream* Logger::log1_ = 0;
std::ostream* Logger::log2_ = 0;
std::wostream* Logger::wlog1_ = 0;
std::wostream* Logger::wlog2_ = 0;
std::stringstream Logger::log_stream_;
Logger::Severity Logger::verbosity_ = Logger::LOG_NOTICE;
Logger::Severity Logger::max_severity_ = Logger::LOG_NOTICE;
Logger::Format Logger::format_ = Logger::FMT_PLAIN;
boost::optional<IfcUtil::IfcBaseClass*> Logger::current_product_;
boost::optional<long long> Logger::first_timepoint_;
std::map<std::string, double> Logger::performance_statistics_;
std::map<std::string, double> Logger::performance_signal_start_;
bool Logger::print_perf_stats_on_element_ = false;
+14 -14
View File
@@ -47,24 +47,24 @@ class IFC_PARSE_API Logger {
private:
// To both stream variants need to exist at runtime or should this be a
// template argument of Logger or controlled using preprocessor directives?
static std::ostream* log1;
static std::ostream* log2;
static std::ostream* log1_;
static std::ostream* log2_;
static std::wostream* wlog1;
static std::wostream* wlog2;
static std::wostream* wlog1_;
static std::wostream* wlog2_;
static std::stringstream log_stream;
static std::stringstream log_stream_;
static Severity verbosity;
static Format format;
static boost::optional<const IfcUtil::IfcBaseClass*> current_product;
static Severity max_severity;
static Severity verbosity_;
static Format format_;
static boost::optional<IfcUtil::IfcBaseClass*> current_product_;
static Severity max_severity_;
static boost::optional<long long> first_timepoint;
static std::map<std::string, double> performance_statistics;
static std::map<std::string, double> performance_signal_start;
static boost::optional<long long> first_timepoint_;
static std::map<std::string, double> performance_statistics_;
static std::map<std::string, double> performance_signal_start_;
static bool print_perf_stats_on_element;
static bool print_perf_stats_on_element_;
public:
static void SetProduct(boost::optional<const IfcUtil::IfcBaseClass*> product);
@@ -101,7 +101,7 @@ class IFC_PARSE_API Logger {
static void ProgressBar(int progress);
static std::string GetLog();
static void PrintPerformanceStats();
static void PrintPerformanceStatsOnElement(bool b) { print_perf_stats_on_element = b; }
static void PrintPerformanceStatsOnElement(bool b) { print_perf_stats_on_element_ = b; }
};
#define PERF(x) \
+126 -127
View File
@@ -110,8 +110,8 @@ IfcSpfStream::IfcSpfStream(const std::string& fn, bool mmap)
#else
IfcSpfStream::IfcSpfStream(const std::string& fn)
#endif
: stream(0),
buffer(0),
: stream_(0),
buffer_(0),
valid(false),
eof(false) {
#ifdef _MSC_VER
@@ -123,7 +123,7 @@ IfcSpfStream::IfcSpfStream(const std::string& fn)
mfs = boost::iostreams::mapped_file_source(boost::filesystem::wpath(fn_wide));
} else {
#endif
stream = _wfopen(fn_wide, L"rb");
stream_ = _wfopen(fn_wide, L"rb");
#ifdef USE_MMAP
}
#endif
@@ -135,7 +135,7 @@ IfcSpfStream::IfcSpfStream(const std::string& fn)
mfs = boost::iostreams::mapped_file_source(fn);
} else {
#endif
stream = fopen(fn.c_str(), "rb");
stream_ = fopen(fn.c_str(), "rb");
#ifdef USE_MMAP
}
#endif
@@ -149,53 +149,53 @@ IfcSpfStream::IfcSpfStream(const std::string& fn)
}
valid = true;
buffer = mfs.data();
ptr = 0;
len = mfs.size();
buffer_ = mfs.data();
ptr_ = 0;
len_ = mfs.size();
} else {
#endif
if (stream == NULL) {
if (stream_ == NULL) {
return;
}
valid = true;
fseek(stream, 0, SEEK_END);
size = (unsigned int)ftell(stream);
rewind(stream);
fseek(stream_, 0, SEEK_END);
size = (unsigned int)ftell(stream_);
rewind(stream_);
char* buffer_rw = new char[size];
len = (unsigned int)fread(buffer_rw, 1, size, stream);
buffer = buffer_rw;
eof = len == 0;
ptr = 0;
fclose(stream);
stream = nullptr;
len_ = (unsigned int)fread(buffer_rw, 1, size, stream_);
buffer_ = buffer_rw;
eof = len_ == 0;
ptr_ = 0;
fclose(stream_);
stream_ = nullptr;
#ifdef USE_MMAP
}
#endif
}
IfcSpfStream::IfcSpfStream(std::istream& f, int l)
: stream(0),
buffer(0) {
: stream_(0),
buffer_(0) {
eof = false;
size = l;
char* buffer_rw = new char[size];
f.read(buffer_rw, size);
buffer = buffer_rw;
buffer_ = buffer_rw;
valid = f.gcount() == size;
ptr = 0;
len = l;
ptr_ = 0;
len_ = l;
}
IfcSpfStream::IfcSpfStream(void* data, int l)
: stream(0),
buffer(0) {
: stream_(0),
buffer_(0) {
eof = false;
size = l;
buffer = (char*)data;
buffer_ = (char*)data;
valid = true;
ptr = 0;
len = l;
ptr_ = 0;
len_ = l;
}
IfcSpfStream::~IfcSpfStream() {
@@ -209,9 +209,9 @@ void IfcSpfStream::Close() {
return;
}
#endif
delete[] buffer;
if (stream != nullptr) {
fclose(stream);
delete[] buffer_;
if (stream_ != nullptr) {
fclose(stream_);
}
}
@@ -219,8 +219,8 @@ void IfcSpfStream::Close() {
// Seeks an arbitrary position in the file
//
void IfcSpfStream::Seek(unsigned int o) {
ptr = o;
if (ptr >= len) {
ptr_ = o;
if (ptr_ >= len_) {
throw IfcException("Reading outside of file limits");
}
eof = false;
@@ -230,28 +230,28 @@ void IfcSpfStream::Seek(unsigned int o) {
// Returns the character at the cursor
//
char IfcSpfStream::Peek() {
return buffer[ptr];
return buffer_[ptr_];
}
//
// Returns the character at specified offset
//
char IfcSpfStream::Read(unsigned int o) {
return buffer[o];
return buffer_[o];
}
//
// Returns the cursor position
//
unsigned int IfcSpfStream::Tell() {
return ptr;
return ptr_;
}
//
// Increments cursor and reads new chunk if necessary
//
void IfcSpfStream::Inc() {
if (++ptr == len) {
if (++ptr_ == len_) {
eof = true;
return;
}
@@ -265,11 +265,11 @@ void IfcSpfStream::Inc() {
IfcSpfLexer::IfcSpfLexer(IfcParse::IfcSpfStream* s, IfcParse::IfcFile* f) {
file = f;
stream = s;
decoder = new IfcCharacterDecoder(s);
decoder_ = new IfcCharacterDecoder(s);
}
IfcSpfLexer::~IfcSpfLexer() {
delete decoder;
delete decoder_;
}
unsigned int IfcSpfLexer::skipWhitespace() {
@@ -350,7 +350,7 @@ Token IfcSpfLexer::Next() {
// If a string is encountered defer processing to the IfcCharacterDecoder
if (c == '\'') {
decoder->skip();
decoder_->skip();
}
}
if (len != 0) {
@@ -360,11 +360,11 @@ Token IfcSpfLexer::Next() {
}
bool IfcSpfStream::is_eof_at(unsigned int local_ptr) {
return local_ptr >= len;
return local_ptr >= len_;
}
void IfcSpfStream::increment_at(unsigned int& local_ptr) {
if (++local_ptr == len) {
if (++local_ptr == len_) {
return;
}
const char current = IfcSpfStream::peek_at(local_ptr);
@@ -374,7 +374,7 @@ void IfcSpfStream::increment_at(unsigned int& local_ptr) {
}
char IfcSpfStream::peek_at(unsigned int local_ptr) {
return buffer[local_ptr];
return buffer_[local_ptr];
}
//
@@ -394,7 +394,7 @@ void IfcSpfLexer::TokenString(unsigned int offset, std::string& buffer) {
}
if (c == '\'') {
// todo, make decoder use local offset ptr
buffer = decoder->get(offset);
buffer = decoder_->get(offset);
break;
}
buffer.push_back(c);
@@ -664,7 +664,7 @@ EntityArgument::EntityArgument(const Token& t) {
// Data needs to be loaded, for the tokens
// to be consumed and parsing to continue.
data->load();
entity = file->schema()->instantiate(data);
entity_ = file->schema()->instantiate(data);
}
namespace {
@@ -989,7 +989,7 @@ IfcUtil::ArgumentType EntityArgument::type() const {
// Functions for casting the EntityArgument to other types
//
EntityArgument::operator IfcUtil::IfcBaseClass*() const {
return entity;
return entity_;
}
unsigned int EntityArgument::size() const {
@@ -1001,7 +1001,7 @@ Argument* EntityArgument::operator[](unsigned int /*i*/) const {
}
std::string EntityArgument::toString(bool upper) const {
return entity->data().toString(upper);
return entity_->data().toString(upper);
}
bool EntityArgument::isNull() const { return false; }
@@ -1052,18 +1052,18 @@ void IfcParse::IfcFile::try_read_semicolon() {
void IfcParse::IfcFile::register_inverse(unsigned id_from, const IfcParse::entity* from_entity, Token t, int attribute_index) {
// Assume a check on token type has already been performed
const auto* e = from_entity;
byref_excl[t.value_int].push_back(id_from);
byref_excl_[t.value_int].push_back(id_from);
while (e != nullptr) {
byref[{t.value_int, e->index_in_schema(), attribute_index}].push_back(id_from);
byref_[{t.value_int, e->index_in_schema(), attribute_index}].push_back(id_from);
e = e->supertype();
}
}
void IfcParse::IfcFile::register_inverse(unsigned id_from, const IfcParse::entity* from_entity, IfcUtil::IfcBaseClass* inst, int attribute_index) {
const auto* e = from_entity;
byref_excl[inst->data().id()].push_back(id_from);
byref_excl_[inst->data().id()].push_back(id_from);
while (e != nullptr) {
byref[{inst->data().id(), e->index_in_schema(), attribute_index}].push_back(id_from);
byref_[{inst->data().id(), e->index_in_schema(), attribute_index}].push_back(id_from);
e = e->supertype();
}
}
@@ -1071,7 +1071,7 @@ void IfcParse::IfcFile::register_inverse(unsigned id_from, const IfcParse::entit
void IfcParse::IfcFile::unregister_inverse(unsigned id_from, const IfcParse::entity* from_entity, IfcUtil::IfcBaseClass* inst, int attribute_index) {
const auto* e = from_entity;
while (e != nullptr) {
std::vector<int>& ids = byref[{inst->data().id(), e->index_in_schema(), attribute_index}];
std::vector<int>& ids = byref_[{inst->data().id(), e->index_in_schema(), attribute_index}];
std::vector<int>::iterator it = std::find(ids.begin(), ids.end(), id_from);
if (it == ids.end()) {
// @todo inverses also need to be populated when multiple instances are added to a new file.
@@ -1082,7 +1082,7 @@ void IfcParse::IfcFile::unregister_inverse(unsigned id_from, const IfcParse::ent
e = e->supertype();
}
std::vector<int>& ids = byref_excl[inst->data().id()];
std::vector<int>& ids = byref_excl_[inst->data().id()];
std::vector<int>::iterator it = std::find(ids.begin(), ids.end(), id_from);
if (it == ids.end()) {
// @todo inverses also need to be populated when multiple instances are added to a new file.
@@ -1675,12 +1675,12 @@ void IfcFile::initialize_(IfcParse::IfcSpfStream* s) {
if (instance->declaration().is(*ifcroot_type_)) {
try {
const std::string guid = *instance->data().getArgument(0);
if (byguid.find(guid) != byguid.end()) {
if (byguid_.find(guid) != byguid_.end()) {
std::stringstream ss;
ss << "Instance encountered with non-unique GlobalId " << guid;
Logger::Message(Logger::LOG_WARNING, ss.str());
}
byguid[guid] = instance;
byguid_[guid] = instance;
} catch (const IfcException& ex) {
Logger::Message(Logger::LOG_ERROR, ex.what());
}
@@ -1695,7 +1695,7 @@ void IfcFile::initialize_(IfcParse::IfcSpfStream* s) {
aggregate_of_instance::ptr insts = instances_by_type_excl_subtypes(ty);
if (!insts) {
insts = aggregate_of_instance::ptr(new aggregate_of_instance());
bytype_excl[ty] = insts;
bytype_excl_[ty] = insts;
}
insts->push(instance);
}
@@ -1704,7 +1704,7 @@ void IfcFile::initialize_(IfcParse::IfcSpfStream* s) {
aggregate_of_instance::ptr insts = instances_by_type(ty);
if (!insts) {
insts = aggregate_of_instance::ptr(new aggregate_of_instance());
bytype[ty] = insts;
bytype_[ty] = insts;
}
insts->push(instance);
const IfcParse::declaration* pt = ty->as_entity()->supertype();
@@ -1715,12 +1715,12 @@ void IfcFile::initialize_(IfcParse::IfcSpfStream* s) {
}
}
if (byid.find(current_id) != byid.end()) {
if (byid_.find(current_id) != byid_.end()) {
std::stringstream ss;
ss << "Overwriting instance with name #" << current_id;
Logger::Message(Logger::LOG_WARNING, ss.str());
}
byid[current_id] = instance;
byid_[current_id] = instance;
MaxId = (std::max)(MaxId, current_id);
} else if (token_stream[0].type == IfcParse::Token_IDENTIFIER && (instance != nullptr)) {
@@ -1762,7 +1762,7 @@ void IfcFile::initialize_(IfcParse::IfcSpfStream* s) {
void IfcFile::recalculate_id_counter() {
entity_by_id_t::key_type k = 0;
for (auto& p : byid) {
for (auto& p : byid_) {
if (p.first > k) {
k = p.first;
}
@@ -1875,7 +1875,7 @@ void IfcFile::addEntities(aggregate_of_instance::ptr es) {
}
IfcUtil::IfcBaseClass* IfcFile::addEntity(IfcUtil::IfcBaseClass* entity, int id) {
if (id != -1 && byid.find((unsigned)id) != byid.end()) {
if (id != -1 && byid_.find((unsigned)id) != byid_.end()) {
throw IfcParse::IfcException("An instance with id " + boost::lexical_cast<std::string>(id) + " is already part of this file");
}
@@ -1885,8 +1885,8 @@ IfcUtil::IfcBaseClass* IfcFile::addEntity(IfcUtil::IfcBaseClass* entity, int id)
// If this instance has been inserted before, return
// a reference to the copy that was created from it.
entity_entity_map_t::iterator mit = entity_file_map.find(entity->identity());
if (mit != entity_file_map.end()) {
entity_entity_map_t::iterator mit = entity_file_map_.find(entity->identity());
if (mit != entity_file_map_.end()) {
return mit->second;
}
@@ -1899,9 +1899,9 @@ IfcUtil::IfcBaseClass* IfcFile::addEntity(IfcUtil::IfcBaseClass* entity, int id)
aggregate_of_instance::ptr entity_attributes = traverse(entity, 1);
for (aggregate_of_instance::it it = entity_attributes->begin(); it != entity_attributes->end(); ++it) {
if (*it != entity) {
entity_entity_map_t::iterator mit2 = entity_file_map.find((*it)->identity());
if (mit2 == entity_file_map.end()) {
entity_file_map.insert(entity_entity_map_t::value_type((*it)->identity(), addEntity(*it)));
entity_entity_map_t::iterator mit2 = entity_file_map_.find((*it)->identity());
if (mit2 == entity_file_map_.end()) {
entity_file_map_.insert(entity_entity_map_t::value_type((*it)->identity(), addEntity(*it)));
}
}
}
@@ -1915,7 +1915,7 @@ IfcUtil::IfcBaseClass* IfcFile::addEntity(IfcUtil::IfcBaseClass* entity, int id)
if (entity->data().file == this) {
if (entity->declaration().as_entity() == nullptr) {
// While not a mapping that can be queried, we do need to free the instance later on
byidentity[new_entity->identity()] = new_entity;
byidentity_[new_entity->identity()] = new_entity;
}
// If it is part of this file
@@ -1951,8 +1951,8 @@ IfcUtil::IfcBaseClass* IfcFile::addEntity(IfcUtil::IfcBaseClass* entity, int id)
}
if (attr_type == IfcUtil::Argument_ENTITY_INSTANCE) {
entity_entity_map_t::const_iterator eit = entity_file_map.find(((IfcUtil::IfcBaseClass*)(*attr))->identity());
if (eit == entity_file_map.end()) {
entity_entity_map_t::const_iterator eit = entity_file_map_.find(((IfcUtil::IfcBaseClass*)(*attr))->identity());
if (eit == entity_file_map_.end()) {
throw IfcParse::IfcException("Unable to map instance to file");
}
@@ -1963,8 +1963,8 @@ IfcUtil::IfcBaseClass* IfcFile::addEntity(IfcUtil::IfcBaseClass* entity, int id)
aggregate_of_instance::ptr instances = *attr;
aggregate_of_instance::ptr new_instances(new aggregate_of_instance);
for (aggregate_of_instance::it it = instances->begin(); it != instances->end(); ++it) {
entity_entity_map_t::const_iterator eit = entity_file_map.find((*it)->identity());
if (eit == entity_file_map.end()) {
entity_entity_map_t::const_iterator eit = entity_file_map_.find((*it)->identity());
if (eit == entity_file_map_.end()) {
throw IfcParse::IfcException("Unable to map instance to file");
}
new_instances->push(eit->second);
@@ -1979,8 +1979,8 @@ IfcUtil::IfcBaseClass* IfcFile::addEntity(IfcUtil::IfcBaseClass* entity, int id)
for (aggregate_of_aggregate_of_instance::outer_it it = instances->begin(); it != instances->end(); ++it) {
std::vector<IfcUtil::IfcBaseClass*> list;
for (aggregate_of_aggregate_of_instance::inner_it jt = it->begin(); jt != it->end(); ++jt) {
entity_entity_map_t::const_iterator eit = entity_file_map.find((*jt)->identity());
if (eit == entity_file_map.end()) {
entity_entity_map_t::const_iterator eit = entity_file_map_.find((*jt)->identity());
if (eit == entity_file_map_.end()) {
throw IfcParse::IfcException("Unable to map instance to file");
}
list.push_back(eit->second);
@@ -2052,19 +2052,19 @@ IfcUtil::IfcBaseClass* IfcFile::addEntity(IfcUtil::IfcBaseClass* entity, int id)
}
}
entity_file_map.insert(entity_entity_map_t::value_type(entity->identity(), new_entity));
entity_file_map_.insert(entity_entity_map_t::value_type(entity->identity(), new_entity));
}
// For subtypes of IfcRoot, the GUID mapping needs to be updated.
if (new_entity->declaration().is(*ifcroot_type_)) {
try {
const std::string guid = *new_entity->data().getArgument(0);
if (byguid.find(guid) != byguid.end()) {
if (byguid_.find(guid) != byguid_.end()) {
std::stringstream ss;
ss << "Overwriting entity with guid " << guid;
Logger::Message(Logger::LOG_WARNING, ss.str());
}
byguid[guid] = new_entity;
byguid_[guid] = new_entity;
} catch (const IfcException& ex) {
Logger::Message(Logger::LOG_ERROR, ex.what());
}
@@ -2077,7 +2077,7 @@ IfcUtil::IfcBaseClass* IfcFile::addEntity(IfcUtil::IfcBaseClass* entity, int id)
aggregate_of_instance::ptr insts = instances_by_type_excl_subtypes(ty);
if (!insts) {
insts = aggregate_of_instance::ptr(new aggregate_of_instance());
bytype_excl[ty] = insts;
bytype_excl_[ty] = insts;
}
insts->push(new_entity);
}
@@ -2086,7 +2086,7 @@ IfcUtil::IfcBaseClass* IfcFile::addEntity(IfcUtil::IfcBaseClass* entity, int id)
aggregate_of_instance::ptr insts = instances_by_type(ty);
if (!insts) {
insts = aggregate_of_instance::ptr(new aggregate_of_instance());
bytype[ty] = insts;
bytype_[ty] = insts;
}
insts->push(new_entity);
@@ -2115,15 +2115,14 @@ IfcUtil::IfcBaseClass* IfcFile::addEntity(IfcUtil::IfcBaseClass* entity, int id)
new_id = new_entity->data().id();
}
if (byid.find(new_id) != byid.end()) {
if (byid_.find(new_id) != byid_.end()) {
// This should not happen
std::stringstream ss;
ss << "Overwriting entity with id " << new_id;
Logger::Message(Logger::LOG_WARNING, ss.str());
}
// The mapping by entity instance name is updated.
byid[new_id] = new_entity;
byid_[new_id] = new_entity;
} else if (new_entity->data().file == nullptr) {
// For non-entity instances, no mappings are updated, but the file
// pointer has to be set, so that actual copies are created in subsequent
@@ -2131,7 +2130,7 @@ IfcUtil::IfcBaseClass* IfcFile::addEntity(IfcUtil::IfcBaseClass* entity, int id)
new_entity->data().file = this;
// While not a mapping that can be queried, we do need to free the instance
byidentity[new_entity->identity()] = new_entity;
byidentity_[new_entity->identity()] = new_entity;
}
if (parsing_complete_ && (ty->as_entity() != nullptr)) {
@@ -2248,11 +2247,11 @@ void IfcFile::process_deletion_() {
}
if (!batch_mode_) {
byref.erase(
byref.lower_bound({id, -1, -1}),
byref.upper_bound({id, std::numeric_limits<int>::max(), std::numeric_limits<int>::max()}));
byref_.erase(
byref_.lower_bound({id, -1, -1}),
byref_.upper_bound({id, std::numeric_limits<int>::max(), std::numeric_limits<int>::max()}));
byref_excl.erase(id);
byref_excl_.erase(id);
// This is based on traversal which needs instances to still be contained in the map.
// another option would be to keep byid intact for the remainder of this loop
@@ -2266,8 +2265,8 @@ void IfcFile::process_deletion_() {
// Do not update inverses for simple types (which have id()==0 in IfcOpenShell).
if (name != 0) {
{
auto lower = byref.lower_bound({name, -1, -1});
auto upper = byref.upper_bound({name, std::numeric_limits<int>::max(), std::numeric_limits<int>::max()});
auto lower = byref_.lower_bound({name, -1, -1});
auto upper = byref_.upper_bound({name, std::numeric_limits<int>::max(), std::numeric_limits<int>::max()});
for (auto byref_it = lower; byref_it != upper; ++byref_it) {
auto& ids = byref_it->second;
@@ -2275,8 +2274,8 @@ void IfcFile::process_deletion_() {
}
}
{
auto byref_it = byref_excl.find(name);
if (byref_it != byref_excl.end()) {
auto byref_it = byref_excl_.find(name);
if (byref_it != byref_excl_.end()) {
auto& ids = byref_it->second;
ids.erase(std::remove(ids.begin(), ids.end(), id), ids.end());
}
@@ -2287,15 +2286,15 @@ void IfcFile::process_deletion_() {
if (entity->declaration().is(*ifcroot_type_)) {
const std::string global_id = *entity->data().getArgument(0);
auto it = byguid.find(global_id);
if (it != byguid.end()) {
byguid.erase(it);
auto it = byguid_.find(global_id);
if (it != byguid_.end()) {
byguid_.erase(it);
} else {
Logger::Warning("GlobalId on rooted instance not encountered in map");
}
}
byid.erase(byid.find(id));
byid_.erase(byid_.find(id));
const IfcParse::declaration* ty = &entity->declaration();
@@ -2303,7 +2302,7 @@ void IfcFile::process_deletion_() {
aggregate_of_instance::ptr instances_of_same_type = instances_by_type_excl_subtypes(ty);
instances_of_same_type->remove(entity);
if (instances_of_same_type->size() == 0) {
bytype_excl.erase(ty);
bytype_excl_.erase(ty);
}
}
@@ -2313,7 +2312,7 @@ void IfcFile::process_deletion_() {
instances_of_same_type->remove(entity);
}
if (instances_of_same_type->size() == 0) {
bytype.erase(ty);
bytype_.erase(ty);
}
const IfcParse::declaration* pt = ty->as_entity()->supertype();
@@ -2326,9 +2325,9 @@ void IfcFile::process_deletion_() {
// entity_file_map is in place to prevent duplicate definitions with usage of add().
// Upon deletion the pairs need to be erased.
for (auto it = entity_file_map.begin(); it != entity_file_map.end();) {
for (auto it = entity_file_map_.begin(); it != entity_file_map_.end();) {
if (it->second == entity) {
it = entity_file_map.erase(it);
it = entity_file_map_.erase(it);
} else {
++it;
}
@@ -2338,7 +2337,7 @@ void IfcFile::process_deletion_() {
}
if (batch_mode_) {
for (auto it = byref.begin(); it != byref.end();) {
for (auto it = byref_.begin(); it != byref_.end();) {
bool do_delete = batch_deletion_ids_.get<1>().find(std::get<INSTANCE_ID>(it->first)) != batch_deletion_ids_.get<1>().end();
if (!do_delete) {
it->second.erase(std::remove_if(it->second.begin(), it->second.end(), [this](int x) {
@@ -2348,13 +2347,13 @@ void IfcFile::process_deletion_() {
do_delete = it->second.empty();
}
if (do_delete) {
it = byref.erase(it);
it = byref_.erase(it);
} else {
++it;
}
}
for (auto it = byref_excl.begin(); it != byref_excl.end();) {
for (auto it = byref_excl_.begin(); it != byref_excl_.end();) {
bool do_delete = batch_deletion_ids_.get<1>().find(it->first) != batch_deletion_ids_.get<1>().end();
if (!do_delete) {
it->second.erase(std::remove_if(it->second.begin(), it->second.end(), [this](int x) {
@@ -2364,7 +2363,7 @@ void IfcFile::process_deletion_() {
do_delete = it->second.empty();
}
if (do_delete) {
it = byref_excl.erase(it);
it = byref_excl_.erase(it);
} else {
++it;
}
@@ -2375,13 +2374,13 @@ void IfcFile::process_deletion_() {
}
aggregate_of_instance::ptr IfcFile::instances_by_type(const IfcParse::declaration* t) {
entities_by_type_t::const_iterator it = bytype.find(t);
return (it == bytype.end()) ? aggregate_of_instance::ptr() : it->second;
entities_by_type_t::const_iterator it = bytype_.find(t);
return (it == bytype_.end()) ? aggregate_of_instance::ptr() : it->second;
}
aggregate_of_instance::ptr IfcFile::instances_by_type_excl_subtypes(const IfcParse::declaration* t) {
entities_by_type_t::const_iterator it = bytype_excl.find(t);
return (it == bytype_excl.end()) ? aggregate_of_instance::ptr() : it->second;
entities_by_type_t::const_iterator it = bytype_excl_.find(t);
return (it == bytype_excl_.end()) ? aggregate_of_instance::ptr() : it->second;
}
aggregate_of_instance::ptr IfcFile::instances_by_type(const std::string& t) {
@@ -2394,23 +2393,23 @@ aggregate_of_instance::ptr IfcFile::instances_by_type_excl_subtypes(const std::s
aggregate_of_instance::ptr IfcFile::instances_by_reference(int t) {
aggregate_of_instance::ptr ret(new aggregate_of_instance);
for (auto& i : byref_excl[t]) {
for (auto& i : byref_excl_[t]) {
ret->push(instance_by_id(i));
}
return ret;
}
IfcUtil::IfcBaseClass* IfcFile::instance_by_id(int id) {
entity_by_id_t::const_iterator it = byid.find(id);
if (it == byid.end()) {
entity_by_id_t::const_iterator it = byid_.find(id);
if (it == byid_.end()) {
throw IfcException("Instance #" + boost::lexical_cast<std::string>(id) + " not found");
}
return it->second;
}
IfcUtil::IfcBaseClass* IfcFile::instance_by_guid(const std::string& guid) {
entity_by_guid_t::const_iterator it = byguid.find(guid);
if (it == byguid.end()) {
entity_by_guid_t::const_iterator it = byguid_.find(guid);
if (it == byguid_.end()) {
throw IfcException("Instance with GlobalId '" + guid + "' not found");
}
return it->second;
@@ -2419,10 +2418,10 @@ IfcUtil::IfcBaseClass* IfcFile::instance_by_guid(const std::string& guid) {
// FIXME: Test destructor to delete entity and arg allocations
IfcFile::~IfcFile() {
std::set<IfcUtil::IfcBaseClass*> entities_to_delete;
for (const auto& pair : byid) {
for (const auto& pair : byid_) {
entities_to_delete.insert(pair.second);
}
for (const auto& pair : byidentity) {
for (const auto& pair : byidentity_) {
entities_to_delete.insert(pair.second);
}
for (auto* entity : entities_to_delete) {
@@ -2433,27 +2432,27 @@ IfcFile::~IfcFile() {
}
IfcFile::entity_by_id_t::const_iterator IfcFile::begin() const {
return byid.begin();
return byid_.begin();
}
IfcFile::entity_by_id_t::const_iterator IfcFile::end() const {
return byid.end();
return byid_.end();
}
IfcFile::type_iterator IfcFile::types_begin() const {
return bytype_excl.begin();
return bytype_excl_.begin();
}
IfcFile::type_iterator IfcFile::types_end() const {
return bytype_excl.end();
return bytype_excl_.end();
}
IfcFile::type_iterator IfcFile::types_incl_super_begin() const {
return bytype.begin();
return bytype_.begin();
}
IfcFile::type_iterator IfcFile::types_incl_super_end() const {
return bytype.end();
return bytype_.end();
}
namespace {
@@ -2503,8 +2502,8 @@ std::string IfcFile::createTimestamp() const {
std::vector<int> IfcFile::get_inverse_indices(int instance_id) {
std::vector<int> return_value;
auto lower = byref.lower_bound({instance_id, -1, -1});
auto upper = byref.upper_bound({instance_id, std::numeric_limits<int>::max(), std::numeric_limits<int>::max()});
auto lower = byref_.lower_bound({instance_id, -1, -1});
auto upper = byref_.upper_bound({instance_id, std::numeric_limits<int>::max(), std::numeric_limits<int>::max()});
// Mapping of instance id to attribute offset.
std::map<int, std::vector<int>> mapping;
@@ -2549,8 +2548,8 @@ aggregate_of_instance::ptr IfcFile::getInverse(int instance_id, const IfcParse::
aggregate_of_instance::ptr return_value(new aggregate_of_instance);
if (attribute_index == -1) {
auto lower = byref.lower_bound({instance_id, type->index_in_schema(), -1});
auto upper = byref.upper_bound({instance_id, type->index_in_schema(), std::numeric_limits<int>::max()});
auto lower = byref_.lower_bound({instance_id, type->index_in_schema(), -1});
auto upper = byref_.upper_bound({instance_id, type->index_in_schema(), std::numeric_limits<int>::max()});
for (auto it = lower; it != upper; ++it) {
for (auto& i : it->second) {
@@ -2558,8 +2557,8 @@ aggregate_of_instance::ptr IfcFile::getInverse(int instance_id, const IfcParse::
}
}
} else {
auto it = byref.find({instance_id, type->index_in_schema(), attribute_index});
if (it != byref.end()) {
auto it = byref_.find({instance_id, type->index_in_schema(), attribute_index});
if (it != byref_.end()) {
for (auto& i : it->second) {
return_value->push(instance_by_id(i));
}
@@ -2570,7 +2569,7 @@ aggregate_of_instance::ptr IfcFile::getInverse(int instance_id, const IfcParse::
}
int IfcFile::getTotalInverses(int instance_id) {
return byref_excl[instance_id].size();
return byref_excl_[instance_id].size();
}
void IfcFile::setDefaultHeaderValues() {
@@ -2668,9 +2667,9 @@ void IfcParse::IfcFile::build_inverses_(IfcUtil::IfcBaseClass* inst) {
if (attr->declaration().as_entity() != nullptr) {
unsigned entity_attribute_id = attr->data().id();
const auto* decl = inst->declaration().as_entity();
byref_excl[entity_attribute_id].push_back(inst->data().id());
byref_excl_[entity_attribute_id].push_back(inst->data().id());
while (decl != nullptr) {
byref[{entity_attribute_id, decl->index_in_schema(), idx}].push_back(inst->data().id());
byref_[{entity_attribute_id, decl->index_in_schema(), idx}].push_back(inst->data().id());
decl = decl->supertype();
}
}
+2 -3
View File
@@ -146,7 +146,7 @@ Token NoneTokenPtr();
/// A stream of tokens to be read from a IfcSpfStream.
class IFC_PARSE_API IfcSpfLexer {
private:
IfcCharacterDecoder* decoder;
IfcCharacterDecoder* decoder_;
unsigned int skipWhitespace();
unsigned int skipComment();
@@ -219,7 +219,6 @@ class IFC_PARSE_API NullArgument : public Argument {
/// #1=IfcVector(#2,1.0);
/// == ===
class IFC_PARSE_API TokenArgument : public Argument {
private:
public:
Token token;
TokenArgument(const Token& t);
@@ -246,7 +245,7 @@ class IFC_PARSE_API TokenArgument : public Argument {
/// ===================== =====================
class IFC_PARSE_API EntityArgument : public Argument {
private:
IfcUtil::IfcBaseClass* entity;
IfcUtil::IfcBaseClass* entity_;
public:
EntityArgument(const Token& t);
+4 -2
View File
@@ -117,7 +117,8 @@ class IFC_PARSE_API aggregation_type : public parameter_type {
protected:
aggregate_type type_of_aggregation_;
int bound1_, bound2_;
int bound1_;
int bound2_;
parameter_type* type_of_element_;
public:
@@ -268,7 +269,8 @@ class IFC_PARSE_API inverse_attribute {
protected:
std::string name_;
aggregate_type type_of_aggregation_;
int bound1_, bound2_;
int bound1_;
int bound2_;
const entity* entity_reference_;
const attribute* attribute_reference_;
+19 -19
View File
@@ -38,7 +38,7 @@ using namespace IfcParse;
HeaderEntity::HeaderEntity(const char* const datatype, size_t size, IfcFile* file)
: IfcEntityInstanceData(file, size),
_datatype(datatype),
datatype_(datatype),
size_(size) {
if (file != nullptr) {
offset_in_file_ = file->stream->Tell();
@@ -88,18 +88,18 @@ void IfcSpfHeader::read() {
// ISO 10303-21 Second edition 2002-01-15 p. 16
readTerminal(FILE_DESCRIPTION, NONE);
delete _file_description;
_file_description = new FileDescription(file_);
delete file_description_;
file_description_ = new FileDescription(file_);
// readSemicolon();
readTerminal(FILE_NAME, NONE);
delete _file_name;
_file_name = new FileName(file_);
delete file_name_;
file_name_ = new FileName(file_);
// readSemicolon();
readTerminal(FILE_SCHEMA, NONE);
delete _file_schema;
_file_schema = new FileSchema(file_);
delete file_schema_;
file_schema_ = new FileSchema(file_);
// readSemicolon();
}
@@ -131,45 +131,45 @@ void IfcSpfHeader::write(std::ostream& os) const {
}
const FileDescription& IfcSpfHeader::file_description() const {
if (_file_description == nullptr) {
if (file_description_ == nullptr) {
throw IfcException("File description not set");
}
return *_file_description;
return *file_description_;
}
const FileName& IfcSpfHeader::file_name() const {
if (_file_name == nullptr) {
if (file_name_ == nullptr) {
throw IfcException("File name not set");
}
return *_file_name;
return *file_name_;
}
const FileSchema& IfcSpfHeader::file_schema() const {
if (_file_schema == nullptr) {
if (file_schema_ == nullptr) {
throw IfcException("File schema not set");
}
return *_file_schema;
return *file_schema_;
}
FileDescription& IfcSpfHeader::file_description() {
if (_file_description == nullptr) {
if (file_description_ == nullptr) {
throw IfcException("File description not set");
}
return *_file_description;
return *file_description_;
}
FileName& IfcSpfHeader::file_name() {
if (_file_name == nullptr) {
if (file_name_ == nullptr) {
throw IfcException("File name not set");
}
return *_file_name;
return *file_name_;
}
FileSchema& IfcSpfHeader::file_schema() {
if (_file_schema == nullptr) {
if (file_schema_ == nullptr) {
throw IfcException("File schema not set");
}
return *_file_schema;
return *file_schema_;
}
FileDescription::FileDescription(IfcFile* file) : HeaderEntity(FILE_DESCRIPTION, 2, file) {}
+14 -14
View File
@@ -27,7 +27,7 @@ namespace IfcParse {
class IFC_PARSE_API HeaderEntity : public IfcEntityInstanceData {
private:
const char* const _datatype;
const char* const datatype_;
size_t size_;
HeaderEntity(const HeaderEntity&); //N/A
@@ -55,7 +55,7 @@ class IFC_PARSE_API HeaderEntity : public IfcEntityInstanceData {
std::string toString(bool upper = false) const {
std::stringstream ss;
ss << _datatype << IfcEntityInstanceData::toString(upper);
ss << datatype_ << IfcEntityInstanceData::toString(upper);
return ss.str();
}
};
@@ -104,9 +104,9 @@ class IFC_PARSE_API FileSchema : public HeaderEntity {
class IFC_PARSE_API IfcSpfHeader {
private:
IfcFile* file_;
FileDescription* _file_description;
FileName* _file_name;
FileSchema* _file_schema;
FileDescription* file_description_;
FileName* file_name_;
FileSchema* file_schema_;
void readParen();
void readSemicolon();
enum Trail {
@@ -119,18 +119,18 @@ class IFC_PARSE_API IfcSpfHeader {
public:
explicit IfcSpfHeader(IfcParse::IfcFile* file = 0)
: file_(file),
_file_description(0),
_file_name(0),
_file_schema(0) {
_file_description = new FileDescription(file_);
_file_name = new FileName(file_);
_file_schema = new FileSchema(file_);
file_description_(0),
file_name_(0),
file_schema_(0) {
file_description_ = new FileDescription(file_);
file_name_ = new FileName(file_);
file_schema_ = new FileSchema(file_);
}
~IfcSpfHeader() {
delete _file_schema;
delete _file_name;
delete _file_description;
delete file_schema_;
delete file_name_;
delete file_description_;
}
IfcParse::IfcFile* file() { return file_; }
+4 -4
View File
@@ -44,10 +44,10 @@ class IFC_PARSE_API IfcSpfStream {
#ifdef USE_MMAP
boost::iostreams::mapped_file_source mfs;
#endif
FILE* stream;
const char* buffer;
unsigned int ptr;
unsigned int len;
FILE* stream_;
const char* buffer_;
unsigned int ptr_;
unsigned int len_;
public:
bool valid;
+10 -10
View File
@@ -63,32 +63,32 @@
void aggregate_of_instance::push(IfcUtil::IfcBaseClass* l) {
if (l != nullptr) {
ls.push_back(l);
list_.push_back(l);
}
}
void aggregate_of_instance::push(const aggregate_of_instance::ptr& l) {
if (l) {
for (it i = l->begin(); i != l->end(); ++i) {
if (*i != nullptr) {
ls.push_back(*i);
list_.push_back(*i);
}
}
}
}
unsigned int aggregate_of_instance::size() const { return (unsigned int)ls.size(); }
void aggregate_of_instance::reserve(unsigned capacity) { ls.reserve((size_t)capacity); }
aggregate_of_instance::it aggregate_of_instance::begin() { return ls.begin(); }
aggregate_of_instance::it aggregate_of_instance::end() { return ls.end(); }
unsigned int aggregate_of_instance::size() const { return (unsigned int)list_.size(); }
void aggregate_of_instance::reserve(unsigned capacity) { list_.reserve((size_t)capacity); }
aggregate_of_instance::it aggregate_of_instance::begin() { return list_.begin(); }
aggregate_of_instance::it aggregate_of_instance::end() { return list_.end(); }
IfcUtil::IfcBaseClass* aggregate_of_instance::operator[](int i) {
return ls[i];
return list_[i];
}
bool aggregate_of_instance::contains(IfcUtil::IfcBaseClass* instance) const {
return std::find(ls.begin(), ls.end(), instance) != ls.end();
return std::find(list_.begin(), list_.end(), instance) != list_.end();
}
void aggregate_of_instance::remove(IfcUtil::IfcBaseClass* instance) {
std::vector<IfcUtil::IfcBaseClass*>::iterator it;
while ((it = std::find(ls.begin(), ls.end(), instance)) != ls.end()) {
ls.erase(it);
while ((it = std::find(list_.begin(), list_.end(), instance)) != list_.end()) {
list_.erase(it);
}
}
+9 -9
View File
@@ -273,12 +273,12 @@ std::string IfcWriteArgument::toString(bool upper) const {
std::ostringstream str;
str.imbue(std::locale::classic());
StringBuilderVisitor v(str, upper);
container.apply_visitor(v);
container_.apply_visitor(v);
return v;
}
unsigned int IfcWriteArgument::size() const {
SizeVisitor v;
const int size = container.apply_visitor(v);
const int size = container_.apply_visitor(v);
if (size == -1) {
throw IfcParse::IfcException("Invalid cast");
}
@@ -286,32 +286,32 @@ unsigned int IfcWriteArgument::size() const {
}
IfcUtil::ArgumentType IfcWriteArgument::type() const {
return static_cast<IfcUtil::ArgumentType>(container.which());
return static_cast<IfcUtil::ArgumentType>(container_.which());
}
// Overload to detect null values
void IfcWriteArgument::set(const aggregate_of_instance::ptr& v) {
if (v) {
container = v;
container_ = v;
} else {
container = boost::blank();
container_ = boost::blank();
}
}
// Overload to detect null values
void IfcWriteArgument::set(const aggregate_of_aggregate_of_instance::ptr& v) {
if (v) {
container = v;
container_ = v;
} else {
container = boost::blank();
container_ = boost::blank();
}
}
// Overload to detect null values
void IfcWriteArgument::set(IfcUtil::IfcBaseInterface* const& v) {
if (v != nullptr) {
container = v->as<IfcUtil::IfcBaseClass>();
container_ = v->as<IfcUtil::IfcBaseClass>();
} else {
container = boost::blank();
container_ = boost::blank();
}
}
+3 -3
View File
@@ -115,12 +115,12 @@ class IFC_PARSE_API IfcWriteArgument : public Argument {
std::vector<std::vector<double>>,
// An aggregate of an aggregate of entities. E.g. ((#1, #2), (#3))
aggregate_of_aggregate_of_instance::ptr>
container;
container_;
public:
template <typename T>
const T& as() const {
if (const T* val = boost::get<T>(&container)) {
if (const T* val = boost::get<T>(&container_)) {
return *val;
}
throw IfcParse::IfcException("Invalid cast");
@@ -129,7 +129,7 @@ class IFC_PARSE_API IfcWriteArgument : public Argument {
template <typename T>
typename boost::disable_if<boost::is_base_of<IfcUtil::IfcBaseInterface, typename boost::remove_pointer<T>::type>, void>::type
set(const T& t) {
container = t;
container_ = t;
}
// Overload to detect null values
+19 -19
View File
@@ -29,7 +29,7 @@ template <class T>
class aggregate_of;
class IFC_PARSE_API aggregate_of_instance {
std::vector<IfcUtil::IfcBaseClass*> ls;
std::vector<IfcUtil::IfcBaseClass*> list_;
public:
typedef boost::shared_ptr<aggregate_of_instance> ptr;
@@ -59,14 +59,14 @@ class IFC_PARSE_API aggregate_of_instance {
template <class T>
class aggregate_of {
std::vector<T*> ls;
std::vector<T*> list_;
public:
typedef boost::shared_ptr<aggregate_of<T>> ptr;
typedef typename std::vector<T*>::const_iterator it;
void push(T* t) {
if (t) {
ls.push_back(t);
list_.push_back(t);
}
}
void push(ptr t) {
@@ -76,9 +76,9 @@ class aggregate_of {
}
}
}
it begin() { return ls.begin(); }
it end() { return ls.end(); }
unsigned int size() const { return (unsigned int)ls.size(); }
it begin() { return list_.begin(); }
it end() { return list_.end(); }
unsigned int size() const { return (unsigned int)list_.size(); }
aggregate_of_instance::ptr generalize() {
aggregate_of_instance::ptr r(new aggregate_of_instance());
for (it i = begin(); i != end(); ++i) {
@@ -86,7 +86,7 @@ class aggregate_of {
}
return r;
}
bool contains(T* t) const { return std::find(ls.begin(), ls.end(), t) != ls.end(); }
bool contains(T* t) const { return std::find(list_.begin(), list_.end(), t) != list_.end(); }
template <class U>
typename U::list::ptr as() {
typename U::list::ptr r(new typename U::list);
@@ -100,8 +100,8 @@ class aggregate_of {
}
void remove(T* t) {
typename std::vector<T*>::iterator it;
while ((it = std::find(ls.begin(), ls.end(), t)) != ls.end()) {
ls.erase(it);
while ((it = std::find(list_.begin(), list_.end(), t)) != list_.end()) {
list_.erase(it);
}
}
};
@@ -110,14 +110,14 @@ template <class T>
class aggregate_of_aggregate_of;
class IFC_PARSE_API aggregate_of_aggregate_of_instance {
std::vector<std::vector<IfcUtil::IfcBaseClass*>> ls;
std::vector<std::vector<IfcUtil::IfcBaseClass*>> list_;
public:
typedef boost::shared_ptr<aggregate_of_aggregate_of_instance> ptr;
typedef std::vector<std::vector<IfcUtil::IfcBaseClass*>>::const_iterator outer_it;
typedef std::vector<IfcUtil::IfcBaseClass*>::const_iterator inner_it;
void push(const std::vector<IfcUtil::IfcBaseClass*>& l) {
ls.push_back(l);
list_.push_back(l);
}
void push(const aggregate_of_instance::ptr& l) {
if (l) {
@@ -128,9 +128,9 @@ class IFC_PARSE_API aggregate_of_aggregate_of_instance {
push(li);
}
}
outer_it begin() const { return ls.begin(); }
outer_it end() const { return ls.end(); }
int size() const { return (int)ls.size(); }
outer_it begin() const { return list_.begin(); }
outer_it end() const { return list_.end(); }
int size() const { return (int)list_.size(); }
int totalSize() const {
int accum = 0;
for (outer_it it = begin(); it != end(); ++it) {
@@ -167,16 +167,16 @@ class IFC_PARSE_API aggregate_of_aggregate_of_instance {
template <class T>
class aggregate_of_aggregate_of {
std::vector<std::vector<T*>> ls;
std::vector<std::vector<T*>> list_;
public:
typedef typename boost::shared_ptr<aggregate_of_aggregate_of<T>> ptr;
typedef typename std::vector<std::vector<T*>>::const_iterator outer_it;
typedef typename std::vector<T*>::const_iterator inner_it;
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 (int)ls.size(); }
void push(const std::vector<T*>& t) { list_.push_back(t); }
outer_it begin() { return list_.begin(); }
outer_it end() { return list_.end(); }
int size() const { return (int)list_.size(); }
int totalSize() const {
int accum = 0;
for (outer_it it = begin(); it != end(); ++it) {