aboutsummaryrefslogtreecommitdiff
path: root/src/support/error/error_capacitor.h
blob: 03f155d205dea903018cb91fa6b18113acdd13ca (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#ifndef INPUTXSLT_SRC_SUPPORT_ERROR_ERROR_CAPACITOR_H_
#define INPUTXSLT_SRC_SUPPORT_ERROR_ERROR_CAPACITOR_H_

#include <memory>

#include "error_multiplexer.h"

namespace InputXSLT {

class ErrorCapacitor : public ErrorMultiplexer::receiver {
	public:
		class exception;

		typedef std::vector<std::string> error_cache;

		ErrorCapacitor(ErrorMultiplexer*);

		void discharge();

		virtual void receive(
			const ErrorMultiplexer::error_type,
			const std::string&
		);

	private:
		std::unique_ptr<error_cache> error_cache_;

};

class ErrorCapacitor::exception {
	public:
		exception(std::unique_ptr<error_cache>);

		const error_cache& operator*() const;

	private:
		std::unique_ptr<error_cache> error_cache_;

};

}

#endif  // INPUTXSLT_SRC_SUPPORT_ERROR_ERROR_CAPACITOR_H_