From 80efca9b984967fc99d1649ccb024af23d09c8de Mon Sep 17 00:00:00 2001 From: cantor Date: Wed, 19 Dec 2007 22:21:00 +0000 Subject: [PATCH] Expose client request parameters to template engine. git-svn-id: https://svn.middleware.georgetown.edu/cpp-xmltooling/trunk@452 de75baf8-a10c-0410-a50a-987c0e22f00f --- xmltooling/util/TemplateEngine.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/xmltooling/util/TemplateEngine.h b/xmltooling/util/TemplateEngine.h index 35f589d..bbbcf18 100644 --- a/xmltooling/util/TemplateEngine.h +++ b/xmltooling/util/TemplateEngine.h @@ -23,7 +23,7 @@ #ifndef __xmltooling_template_h__ #define __xmltooling_template_h__ -#include +#include #include #include @@ -72,12 +72,15 @@ namespace xmltooling { class XMLTOOL_API TemplateParameters { MAKE_NONCOPYABLE(TemplateParameters); public: - TemplateParameters() {} + TemplateParameters() : m_request(NULL) {} virtual ~TemplateParameters() {} /** Map of known parameters to supply to template. */ std::map m_map; + /** Request from client that resulted in template being processed. */ + const GenericRequest* m_request; + /** * Returns the value of a parameter to plug into the template. * @@ -86,7 +89,7 @@ namespace xmltooling { */ virtual const char* getParameter(const char* name) const { std::map::const_iterator i=m_map.find(name); - return (i!=m_map.end() ? i->second.c_str() : NULL); + return (i!=m_map.end() ? i->second.c_str() : (m_request ? m_request->getParameter(name) : NULL)); } }; -- 2.1.4