MCPcopy Create free account
hub / github.com/IfcOpenShell/IfcOpenShell / plain_text_message

Function plain_text_message

src/ifcparse/IfcLogger.cpp:66–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64
65template <typename T>
66void plain_text_message(T& out, const IfcUtil::IfcBaseClass* current_product, Logger::Severity type, const std::string& message, const IfcUtil::IfcBaseInterface* instance) {
67 out << "[" << severity_strings<typename T::char_type>::value[type] << "] ";
68 out << "[" << get_time(type <= Logger::LOG_PERF).c_str() << "] ";
69 if (current_product) {
70 std::string global_id = current_product->as<IfcUtil::IfcBaseEntity>()->get("GlobalId");
71 out << "{" << global_id.c_str() << "} ";
72 }
73 out << message.c_str() << std::endl;
74 if (instance) {
75 std::ostringstream oss;
76 instance->as<IfcUtil::IfcBaseClass>()->toString(oss);
77 auto instance_string = oss.str();
78 if (instance_string.size() > 259) {
79 instance_string = instance_string.substr(0, 256) + "...";
80 }
81 out << instance_string.c_str() << std::endl;
82 }
83}
84
85template <typename T>
86std::basic_string<T> string_as(const std::string& string) {

Callers 1

MessageMethod · 0.85

Calls 6

get_timeFunction · 0.85
toStringMethod · 0.80
substrMethod · 0.80
getMethod · 0.45
strMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected