aboutsummaryrefslogtreecommitdiff
path: root/src/support/error/error_capacitor.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/support/error/error_capacitor.h')
-rw-r--r--src/support/error/error_capacitor.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/support/error/error_capacitor.h b/src/support/error/error_capacitor.h
new file mode 100644
index 0000000..6017cb4
--- /dev/null
+++ b/src/support/error/error_capacitor.h
@@ -0,0 +1,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_