From 78d3873061f1a974da4d0ccdcc1778c6a11139e8 Mon Sep 17 00:00:00 2001 From: Adrian Kummerländer Date: Thu, 24 Apr 2014 22:18:45 +0200 Subject: Added XercesStringGuard scope-guard to manage XMLCh * xercesc requires XMLCh* strings to be hand-allocated and released using the XMLString class * XercesStringGuard works as a scope-guard for XMLCh* string lifetime and greatly simplifies xerces DOM construction --- src/support/xerces_string_guard.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/support/xerces_string_guard.h (limited to 'src/support/xerces_string_guard.h') diff --git a/src/support/xerces_string_guard.h b/src/support/xerces_string_guard.h new file mode 100644 index 0000000..f64a53e --- /dev/null +++ b/src/support/xerces_string_guard.h @@ -0,0 +1,24 @@ +#ifndef INPUTXSLT_SRC_SUPPORT_XERCES_STRING_GUARD_H_ +#define INPUTXSLT_SRC_SUPPORT_XERCES_STRING_GUARD_H_ + +#include + +#include + +namespace InputXSLT { + +class XercesStringGuard { + public: + XercesStringGuard(const std::string&); + ~XercesStringGuard(); + + XMLCh* operator*(); + + private: + XMLCh* const string_; + +}; + +} + +#endif // INPUTXSLT_SRC_SUPPORT_XERCES_STRING_GUARD_H_ -- cgit v1.2.3