Porytiles
Loading...
Searching...
No Matches
buffered_user_diagnostics.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <map>
4#include <string>
5#include <vector>
6
9
10namespace porytiles2 {
11
32 public:
33 void note(const std::string &tag, const std::vector<std::string> &lines) const override;
34
35 void warn_note(const std::string &tag, const std::vector<std::string> &lines) const override;
36
37 void warn(const std::string &tag, const std::vector<std::string> &lines) const override;
38
39 void err(const std::string &tag, const std::vector<std::string> &lines) const override;
40
41 void emit_fatal_proximate(const Error &err) const override;
42
43 void emit_fatal_step(const Error &err) const override;
44
45 void emit_fatal_root(const Error &err) const override;
46
56 [[nodiscard]] const std::vector<std::vector<std::string>> &notes() const
57 {
58 return notes_;
59 }
60
70 [[nodiscard]] const std::vector<std::vector<std::string>> &warn_notes() const
71 {
72 return warn_notes_;
73 }
74
84 [[nodiscard]] const std::vector<std::vector<std::string>> &warnings() const
85 {
86 return warnings_;
87 }
88
98 [[nodiscard]] const std::vector<std::vector<std::string>> &errors() const
99 {
100 return errors_;
101 }
102
113 [[nodiscard]] const std::vector<std::vector<std::string>> &fatal_proximates() const
114 {
115 return fatal_proximates_;
116 }
117
127 [[nodiscard]] const std::vector<std::vector<std::string>> &fatal_steps() const
128 {
129 return fatal_steps_;
130 }
131
141 [[nodiscard]] const std::vector<std::vector<std::string>> &fatal_roots() const
142 {
143 return fatal_roots_;
144 }
145
155 [[nodiscard]] const std::map<std::string, size_t> &note_tag_counts() const
156 {
157 return note_tag_counts_;
158 }
159
169 [[nodiscard]] const std::map<std::string, size_t> &warn_note_tag_counts() const
170 {
171 return warn_note_tag_counts_;
172 }
173
183 [[nodiscard]] const std::map<std::string, size_t> &warning_tag_counts() const
184 {
185 return warning_tag_counts_;
186 }
187
197 [[nodiscard]] const std::map<std::string, size_t> &error_tag_counts() const
198 {
199 return error_tag_counts_;
200 }
201
202 private:
203 mutable std::vector<std::vector<std::string>> notes_;
204 mutable std::vector<std::vector<std::string>> warn_notes_;
205 mutable std::vector<std::vector<std::string>> warnings_;
206 mutable std::vector<std::vector<std::string>> errors_;
207 mutable std::vector<std::vector<std::string>> fatal_proximates_;
208 mutable std::vector<std::vector<std::string>> fatal_steps_;
209 mutable std::vector<std::vector<std::string>> fatal_roots_;
210 mutable std::map<std::string, size_t> note_tag_counts_;
211 mutable std::map<std::string, size_t> warn_note_tag_counts_;
212 mutable std::map<std::string, size_t> warning_tag_counts_;
213 mutable std::map<std::string, size_t> error_tag_counts_;
214};
215
216} // namespace porytiles2
Testing implementation of UserDiagnostics that buffers all diagnostic output.
const std::map< std::string, size_t > & note_tag_counts() const
Get the count of note messages by tag.
const std::vector< std::vector< std::string > > & warnings() const
Get the buffered warning messages.
const std::vector< std::vector< std::string > > & errors() const
Get the buffered error messages.
const std::vector< std::vector< std::string > > & fatal_proximates() const
Get the buffered fatal proximate error messages.
void warn(const std::string &tag, const std::vector< std::string > &lines) const override
Display a multi-line tagged warning message.
const std::map< std::string, size_t > & warn_note_tag_counts() const
Get the count of warning note messages by tag.
const std::map< std::string, size_t > & error_tag_counts() const
Get the count of error messages by tag.
void emit_fatal_root(const Error &err) const override
Emit the root cause error in a fatal error chain.
const std::vector< std::vector< std::string > > & fatal_steps() const
Get the buffered fatal step error messages.
void emit_fatal_proximate(const Error &err) const override
Emit the proximate (immediate) error in a fatal error chain.
void err(const std::string &tag, const std::vector< std::string > &lines) const override
Display a multi-line tagged error message.
const std::vector< std::vector< std::string > > & fatal_roots() const
Get the buffered fatal root error messages.
const std::vector< std::vector< std::string > > & warn_notes() const
Get the buffered warning note messages.
const std::map< std::string, size_t > & warning_tag_counts() const
Get the count of warning messages by tag.
void warn_note(const std::string &tag, const std::vector< std::string > &lines) const override
Display a multi-line tagged warning note message.
void note(const std::string &tag, const std::vector< std::string > &lines) const override
Display a multi-line tagged informational note message.
const std::vector< std::vector< std::string > > & notes() const
Get the buffered note messages.
void emit_fatal_step(const Error &err) const override
Emit an intermediate step error in a fatal error chain.
Abstract interface for all error types used in ChainableResult error chains.
Definition error.hpp:26
Abstract interface for structured error reporting and diagnostic output.