diff options
author | Adrian Kummerländer | 2014-05-29 13:26:37 +0200 |
---|---|---|
committer | Adrian Kummerländer | 2014-05-29 13:26:37 +0200 |
commit | 3bc793d95293d40dbab62c593ce4ceaa86fae25b (patch) | |
tree | 07a0f99d72a074a75955a593318cc8bcd394f4c2 /src/support/error_handler.h | |
parent | 52b60c1a8c23f11ab18fad06e0957490c7436e0a (diff) | |
download | InputXSLT-3bc793d95293d40dbab62c593ce4ceaa86fae25b.tar InputXSLT-3bc793d95293d40dbab62c593ce4ceaa86fae25b.tar.gz InputXSLT-3bc793d95293d40dbab62c593ce4ceaa86fae25b.tar.bz2 InputXSLT-3bc793d95293d40dbab62c593ce4ceaa86fae25b.tar.lz InputXSLT-3bc793d95293d40dbab62c593ce4ceaa86fae25b.tar.xz InputXSLT-3bc793d95293d40dbab62c593ce4ceaa86fae25b.tar.zst InputXSLT-3bc793d95293d40dbab62c593ce4ceaa86fae25b.zip |
Improved TransformationFacade error handling
* ErrorHandler class created in 5859cb6 now caches all errors instead of pushing them to std::cerr
** cached errors are retrieved by TransformationFacade's "generate" member method
* test frontend pushes all errors to std::cerr
* FunctionTransform returns errors to the calling template as XML
** FunctionTransform test case demonstrates how one may test for successful transformation
* "generate" member method returns std::string vector wrapped in a std::unique_ptr
** this is used as a kind of optional pointer, as the std::unique_ptr instance only wraps a vector if errors where actually generated
Diffstat (limited to 'src/support/error_handler.h')
-rw-r--r-- | src/support/error_handler.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/support/error_handler.h b/src/support/error_handler.h index 7835292..77a46d8 100644 --- a/src/support/error_handler.h +++ b/src/support/error_handler.h @@ -3,21 +3,30 @@ #include <xercesc/sax/ErrorHandler.hpp> +#include <memory> +#include <vector> #include <string> namespace InputXSLT { class ErrorHandler : public xercesc::ErrorHandler { public: - ErrorHandler(const std::string&); + typedef std::vector<std::string> error_cache; + typedef std::unique_ptr<error_cache> error_cache_ptr; + + ErrorHandler(); virtual void warning(const xercesc::SAXParseException&); virtual void error(const xercesc::SAXParseException&); virtual void fatalError(const xercesc::SAXParseException&); virtual void resetErrors(); + error_cache_ptr getCachedErrors(); + private: - const std::string& transformation_path_; + error_cache_ptr error_cache_; + + void constructErrorCache(); }; |