3#include <CesiumUtility/Library.h>
4#include <CesiumUtility/Log.h>
5#include <CesiumUtility/joinToString.h>
7#include <spdlog/spdlog.h>
80 template <typename PromptStr>
82 const
std::shared_ptr<spdlog::logger>& pLogger,
83 PromptStr&& prompt) const noexcept {
88 std::forward<PromptStr>(prompt),
89 CesiumUtility::joinToString(errors,
"\n- "));
99 template <
typename PromptStr>
101 const std::shared_ptr<spdlog::logger>& pLogger,
102 PromptStr&& prompt)
const noexcept {
107 std::forward<PromptStr>(prompt),
118 template <
typename PromptStr>
120 log(
const std::shared_ptr<spdlog::logger>& pLogger,
121 PromptStr&& prompt)
const noexcept {
122 if (!this->
errors.empty()) {
125 this->
format(std::forward<PromptStr>(prompt)));
126 }
else if (!this->
warnings.empty()) {
129 this->
format(std::forward<PromptStr>(prompt)));
140 template <
typename PromptStr>
141 std::string
format(PromptStr&& prompt)
const noexcept {
142 if (this->
warnings.empty() && this->errors.empty()) {
143 return std::string();
146 std::string result = prompt;
148 if (!this->
errors.empty()) {
149 result +=
"\n- [Error] " +
154 result +=
"\n- [Warning] " +
164 explicit operator bool() const noexcept;
Utility classes for Cesium.
std::string joinToString(TIterator begin, TIterator end, const std::string &separator)
Joins multiple elements together into a string, separated by a given separator.
The container to store the error and warning list when loading a tile or glTF content.
bool hasErrors() const noexcept
Check if there are any error messages.
std::vector< std::string > errors
The error messages of this container.
static ErrorList error(std::string errorMessage)
Creates an ErrorList containing a single error.
void emplaceWarning(WarningStr &&warning)
Add a warning message.
std::string format(PromptStr &&prompt) const noexcept
Format all of the errors and warnings into a single string.
static ErrorList warning(std::string warningMessage)
Creates an ErrorList containing a single warning.
void log(const std::shared_ptr< spdlog::logger > &pLogger, PromptStr &&prompt) const noexcept
Log all the error and warning messages.
void logWarning(const std::shared_ptr< spdlog::logger > &pLogger, PromptStr &&prompt) const noexcept
Log all the warning messages.
std::vector< std::string > warnings
The warning messages of this container.
void merge(ErrorList &&errorList)
Merge the errors and warnings from other ErrorList together.
void logError(const std::shared_ptr< spdlog::logger > &pLogger, PromptStr &&prompt) const noexcept
Log all the error messages.
void emplaceError(ErrorStr &&error)
Add an error message.
void merge(const ErrorList &errorList)
Merge the errors and warnings from other ErrorList together.