From 272b34c1a4639cd0f909bfb52d30339c93b0c42b Mon Sep 17 00:00:00 2001 From: Adrian Kummerländer Date: Fri, 6 Jun 2014 22:00:39 +0200 Subject: Implemented WarningCapacitor as a counterpart to ErrorCapacitor * in difference to ErrorCapacitor this class doesn't throw an exception on "discharge" but returns the gathered warnings * adapted FunctionTransform and frontend error handling to include warnings * added static "try_create" method to TransformationFacade ** wraps construction error handling ** custom logic may be embedded using the std::function argument *** this was implemented to prevent unneccessary code duplication for handling both construction and generation errors * adapted FunctionTransform to return warning as "warning" nodes in the result tree ** added functional lambda expression factory method "handleErrors" *** returns a error handling lambda expression for a given ResultNodeFacade * implemented WarningGuard class in frontend executable ** guarantees warnings to be printed to std::cerr independent of any exceptions --- src/support/error/error_multiplexer.h | 36 +++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) (limited to 'src/support/error/error_multiplexer.h') diff --git a/src/support/error/error_multiplexer.h b/src/support/error/error_multiplexer.h index 02cfaf8..7d8544a 100644 --- a/src/support/error/error_multiplexer.h +++ b/src/support/error/error_multiplexer.h @@ -16,14 +16,14 @@ namespace InputXSLT { class ErrorMultiplexer : public xercesc::ErrorHandler, public xalan::ProblemListener { public: - enum class ErrorType; - struct Receiver; + enum class error_type; + class receiver; ErrorMultiplexer(xalan::XalanTransformer*); ~ErrorMultiplexer(); - void connectReceiver(Receiver*); - void disconnectReceiver(Receiver*); + void connectReceiver(receiver*); + void disconnectReceiver(receiver*); virtual void warning(const xercesc::SAXParseException&); virtual void error(const xercesc::SAXParseException&); @@ -61,22 +61,30 @@ class ErrorMultiplexer : public xercesc::ErrorHandler, private: xalan::XalanTransformer* const transformer_; - std::vector receivers_; + std::vector receivers_; - void multiplex(const ErrorType, const std::string&); + void multiplex(const error_type, const std::string&); }; -enum class ErrorMultiplexer::ErrorType { - Warning, - Error +enum class ErrorMultiplexer::error_type { + warning, + error }; -struct ErrorMultiplexer::Receiver { - virtual void receive( - const ErrorMultiplexer::ErrorType, - const std::string& - ) = 0; +class ErrorMultiplexer::receiver { + public: + receiver(ErrorMultiplexer*); + virtual ~receiver(); + + virtual void receive( + const ErrorMultiplexer::error_type, + const std::string& + ) = 0; + + private: + ErrorMultiplexer* const multiplexer_; + }; } -- cgit v1.2.3