MCPcopy Create free account
hub / github.com/LASzip/LASzip / format_message

Function format_message

src/lasmessage.cpp:235–258  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

233}
234
235void format_message(std::string& messsage, unsigned multiline_ident, bool append_trailing_lf = true) {
236 size_t lines = messsage.find('\n');
237 if (lines == std::string::npos) {
238 lines = 1;
239 }
240 std::string result;
241 result.reserve(messsage.size() + (lines - 1) * multiline_ident + 1);
242
243 const std::string find_str = "\n\t";
244 std::string replace_str((size_t)multiline_ident + 1, ' ');
245 replace_str[0] = '\n';
246 size_t start_pos = 0, pos = messsage.find(find_str, start_pos);
247 while (pos != std::string::npos) {
248 result += messsage.substr(start_pos, pos - start_pos);
249 result += replace_str;
250 start_pos = pos + find_str.size();
251 pos = messsage.find(find_str, start_pos);
252 }
253 result += messsage.substr(start_pos, pos - start_pos);
254
255 if (append_trailing_lf) result += "\n";
256
257 messsage = result;
258}
259
260void las_default_message_handler(LAS_MESSAGE_TYPE type, const char* msg, void* user_data) {
261 std::string prefix;

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected