aboutsummaryrefslogtreecommitdiff
path: root/src/support/error/error_capacitor.h
blob: 1c225e9b4df0b1280e468391af7e982867daa596 (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
44
#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;
		typedef std::unique_ptr<error_cache> error_cache_ptr;

		ErrorCapacitor(ErrorMultiplexer*);

		void discharge();

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

	private:
		error_cache_ptr error_cache_;

};

class ErrorCapacitor::exception {
	public:
		exception(error_cache_ptr);

		const error_cache& operator*() const;

	private:
		error_cache_ptr error_cache_;

};

}

#endif  // INPUTXSLT_SRC_SUPPORT_ERROR_ERROR_CAPACITOR_H_