MCPcopy Create free account
hub / github.com/crosire/reshade / parse_errors

Function parse_errors

source/runtime_gui.cpp:48–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46
47template <typename F>
48static void parse_errors(const std::string_view errors, F &&callback)
49{
50 for (size_t offset = 0, next; offset != std::string_view::npos; offset = next)
51 {
52 const size_t pos_error = errors.find(": ", offset);
53 const size_t pos_error_line = errors.rfind('(', pos_error); // Paths can contain '(', but no ": ", so search backwards from the error location to find the line info
54 if (pos_error == std::string_view::npos || pos_error_line == std::string_view::npos || pos_error_line < offset)
55 break;
56
57 const size_t pos_linefeed = errors.find('\n', pos_error);
58
59 next = pos_linefeed != std::string_view::npos ? pos_linefeed + 1 : std::string_view::npos;
60
61 const std::string_view error_file = errors.substr(offset, pos_error_line - offset);
62 int error_line = static_cast<int>(std::strtol(errors.data() + pos_error_line + 1, nullptr, 10));
63 const std::string_view error_text = errors.substr(pos_error + 2 /* skip space */, pos_linefeed - pos_error - 2);
64
65 callback(error_file, error_line, error_text);
66 }
67}
68
69template <typename T>
70static std::string_view get_localized_annotation(T &object, const std::string_view ann_name, [[maybe_unused]] std::string language)

Callers 2

draw_technique_editorMethod · 0.85
open_code_editorMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected