/*
- * 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.
#ifndef __xmltooling_template_h__
#define __xmltooling_template_h__
-#include <xmltooling/base.h>
+#include <xmltooling/io/GenericRequest.h>
#include <map>
#include <string>
#include <iostream>
+#if defined (_MSC_VER)
+ #pragma warning( push )
+ #pragma warning( disable : 4251 )
+#endif
+
namespace xmltooling {
/**
{
MAKE_NONCOPYABLE(TemplateEngine);
public:
-
TemplateEngine() {
setTagPrefix("mlp");
}
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<std::string,std::string> 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.
*
*/
virtual const char* getParameter(const char* name) const {
std::map<std::string,std::string>::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));
}
};
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;
};
};
+#if defined (_MSC_VER)
+ #pragma warning( pop )
+#endif
+
#endif /* __xmltooling_template_h__ */