X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=xmltooling%2Futil%2FTemplateEngine.h;h=08db6e48f944a252aaf71d6618b43673286d4d72;hb=aed9b61b70fcc321f6e86f07b633dacbcc364d3d;hp=9bfec2478ae787b04b07f90a357fd74b6b82ed7f;hpb=182c331b48ac0d7f9f21725a8e090ba990be010d;p=shibboleth%2Fcpp-xmltooling.git diff --git a/xmltooling/util/TemplateEngine.h b/xmltooling/util/TemplateEngine.h index 9bfec24..08db6e4 100644 --- a/xmltooling/util/TemplateEngine.h +++ b/xmltooling/util/TemplateEngine.h @@ -1,5 +1,5 @@ /* - * Copyright 2001-2006 Internet2 + * Copyright 2001-2007 Internet2 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,12 +23,17 @@ #ifndef __xmltooling_template_h__ #define __xmltooling_template_h__ -#include +#include #include #include #include +#if defined (_MSC_VER) + #pragma warning( push ) + #pragma warning( disable : 4251 ) +#endif + namespace xmltooling { /** @@ -46,7 +51,6 @@ namespace xmltooling { { MAKE_NONCOPYABLE(TemplateEngine); public: - TemplateEngine() { setTagPrefix("mlp"); } @@ -67,12 +71,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. * @@ -81,7 +88,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)); } }; @@ -101,6 +108,12 @@ namespace xmltooling { const XMLToolingException* e=NULL ) const; + /** + * List of non-built-in characters considered "unsafe" and requiring HTML encoding. + * The default set is #%&():[]\\`{} + */ + static std::string unsafe_chars; + private: void trimspace(std::string& s) const; void html_encode(std::ostream& os, const char* start) const; @@ -117,4 +130,8 @@ namespace xmltooling { }; }; +#if defined (_MSC_VER) + #pragma warning( pop ) +#endif + #endif /* __xmltooling_template_h__ */