aboutsummaryrefslogtreecommitdiff
path: root/src/support/error/error_capacitor.h
blob: 6017cb4d7004b4c0129917030c156744a4f9d562 (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
45
46
#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*);
		~ErrorCapacitor();

		void discharge();

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

	private:
		ErrorMultiplexer* const multiplexer_;
		error_cache_ptr error_cache_;

};

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

		const error_cache* getCachedErrors() const;

	private:
		error_cache_ptr error_cache_;

};

}

#endif  // INPUTXSLT_SRC_SUPPORT_ERROR_ERROR_CAPACITOR_H_