simplify code by appling varargs messages and warnings
This commit is contained in:
14
src/error.h
14
src/error.h
@ -31,12 +31,13 @@ class Error : protected Pointers {
|
||||
void universe_warn(const std::string &, int, const std::string &);
|
||||
|
||||
[[ noreturn ]] void all(const std::string &, int, const std::string &);
|
||||
[[ noreturn ]] void one(const std::string &, int, const std::string &);
|
||||
template <typename S, typename... Args>
|
||||
void all(const std::string &file, int line, const S &format,
|
||||
Args&&... args) {
|
||||
_all(file, line, format, fmt::make_args_checked<Args...>(format, args...));
|
||||
}
|
||||
|
||||
[[ noreturn ]] void one(const std::string &, int, const std::string &);
|
||||
template <typename S, typename... Args>
|
||||
void one(const std::string &file, int line, const S &format,
|
||||
Args&&... args) {
|
||||
@ -44,7 +45,16 @@ class Error : protected Pointers {
|
||||
}
|
||||
|
||||
void warning(const std::string &, int, const std::string &);
|
||||
template <typename S, typename... Args>
|
||||
void warning(const std::string &file, int line, const S &format, Args&&... args) {
|
||||
_warning(file, line, format, fmt::make_args_checked<Args...>(format, args...));
|
||||
}
|
||||
|
||||
void message(const std::string &, int, const std::string &);
|
||||
template <typename S, typename... Args>
|
||||
void message(const std::string &file, int line, const S &format, Args&&... args) {
|
||||
_message(file, line, format, fmt::make_args_checked<Args...>(format, args...));
|
||||
}
|
||||
[[ noreturn ]] void done(int = 0); // 1 would be fully backwards compatible
|
||||
|
||||
int get_numwarn() const { return numwarn; }
|
||||
@ -70,6 +80,8 @@ class Error : protected Pointers {
|
||||
fmt::format_args args);
|
||||
[[ noreturn ]] void _one(const std::string &, int, fmt::string_view,
|
||||
fmt::format_args args);
|
||||
void _warning(const std::string &, int, fmt::string_view, fmt::format_args args);
|
||||
void _message(const std::string &, int, fmt::string_view, fmt::format_args args);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user