|
@@ -738,9 +738,9 @@ public:
|
|
|
return detail::ScopedState(tracking_, StoreResults::ForAnything);
|
|
return detail::ScopedState(tracking_, StoreResults::ForAnything);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- ANNOTATION_HELPER(error, error, fmt)
|
|
|
|
|
- ANNOTATION_HELPER(annotate, annotate, fmt)
|
|
|
|
|
- ANNOTATION_HELPER(annotate_list, annotate, fmtlist)
|
|
|
|
|
|
|
+ ANNOTATION_HELPER(error, error, jvalidate::to_string)
|
|
|
|
|
+ ANNOTATION_HELPER(annotate, annotate, jvalidate::to_string)
|
|
|
|
|
+ ANNOTATION_HELPER(annotate_list, annotate, jvalidate::to_string_list)
|
|
|
|
|
|
|
|
bool should_annotate(Status stat) const {
|
|
bool should_annotate(Status stat) const {
|
|
|
if (not result_) {
|
|
if (not result_) {
|
|
@@ -851,33 +851,6 @@ public:
|
|
|
}
|
|
}
|
|
|
return rval;
|
|
return rval;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
-private:
|
|
|
|
|
- template <typename S>
|
|
|
|
|
- requires(std::is_constructible_v<std::string, S>)
|
|
|
|
|
- // Optimization to avoid running string-like objects through a
|
|
|
|
|
- // std::stringstream in fmtlist.
|
|
|
|
|
- static std::string fmt(S const & str) {
|
|
|
|
|
- return std::string(str);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // Format va_args into a single string to annotate or mark an error message
|
|
|
|
|
- static std::string fmt(auto const &... args) {
|
|
|
|
|
- std::stringstream ss;
|
|
|
|
|
- using ::jvalidate::operator<<;
|
|
|
|
|
- [[maybe_unused]] int _[] = {(ss << args, 0)...};
|
|
|
|
|
- return ss.str();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // Format an iterable argument into a vector of strings to annotate or mark
|
|
|
|
|
- // an error.
|
|
|
|
|
- static std::vector<std::string> fmtlist(auto const & arg) {
|
|
|
|
|
- std::vector<std::string> strs;
|
|
|
|
|
- for (auto const & elem : arg) {
|
|
|
|
|
- strs.push_back(fmt(elem));
|
|
|
|
|
- }
|
|
|
|
|
- return strs;
|
|
|
|
|
- }
|
|
|
|
|
};
|
|
};
|
|
|
}
|
|
}
|
|
|
|
|
|