diff options
Diffstat (limited to 'src/support/error/warning_capacitor.cc')
-rw-r--r-- | src/support/error/warning_capacitor.cc | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/support/error/warning_capacitor.cc b/src/support/error/warning_capacitor.cc new file mode 100644 index 0000000..f8d2b99 --- /dev/null +++ b/src/support/error/warning_capacitor.cc @@ -0,0 +1,26 @@ +#include "warning_capacitor.h" + +namespace InputXSLT { + +WarningCapacitor::WarningCapacitor(ErrorMultiplexer* multiplexer): + ErrorMultiplexer::receiver(multiplexer), + warning_cache_(new warning_cache()) { } + +auto WarningCapacitor::discharge() -> warning_cache_ptr { + warning_cache_ptr tmp(std::move(this->warning_cache_)); + + this->warning_cache_.reset(new warning_cache()); + + return std::move(tmp); +} + +void WarningCapacitor::receive( + const ErrorMultiplexer::error_type type, + const std::string& message +) { + if ( type == ErrorMultiplexer::error_type::warning ) { + this->warning_cache_->emplace_back(message); + } +} + +} |