aboutsummaryrefslogtreecommitdiff
path: root/src/support/error/warning_capacitor.cc
blob: f8d2b99665aaa8d5a1ba3810dce845d1847cd889 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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);
	}
}

}