aboutsummaryrefslogtreecommitdiff
path: root/src/support/error/warning_capacitor.cc
blob: 0d98977d5e038000d8904e94f342e5be73db8099 (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
27
28
#include "warning_capacitor.h"

namespace InputXSLT {

WarningCapacitor::WarningCapacitor(ErrorMultiplexer* multiplexer):
	ErrorMultiplexer::receiver(multiplexer),
	warning_cache_(std::make_unique<warning_cache>()) { }

auto WarningCapacitor::discharge() -> warning_cache_ptr {
	warning_cache_ptr tmp(
		std::make_unique<warning_cache>()
	);

	std::swap(tmp, this->warning_cache_);

	return 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);
	}
}

}