Template: Use MapCache, getPage(): Return value, not reference
This commit is contained in:
12
template.h
12
template.h
@@ -8,16 +8,17 @@
|
||||
#include "response.h"
|
||||
#include "searchresult.h"
|
||||
#include "revision.h"
|
||||
#include "cache/mapcache.h"
|
||||
class Template
|
||||
{
|
||||
private:
|
||||
ConfigVariableResolver *configVarResolver;
|
||||
ConfigUrls *configUrls;
|
||||
MapCache<TemplatePage> *pageCache;
|
||||
|
||||
std::string templateprefix;
|
||||
std::string templatepath;
|
||||
|
||||
std::map<std::string, TemplatePage> pagesMap;
|
||||
std::string resolveIncludes(std::string_view content);
|
||||
|
||||
std::string getPartPath(std::string_view partname);
|
||||
@@ -27,12 +28,9 @@ class Template
|
||||
|
||||
public:
|
||||
Template(std::string templateprefix, std::string templatepath, ConfigUrls &configUrls,
|
||||
ConfigVariableResolver &configVarsResolver);
|
||||
/* TODO: returning this as a reference is by no means a risk free business,
|
||||
because between requests, different vars can be set conditionally,
|
||||
thus creating a mess
|
||||
*/
|
||||
TemplatePage &getPage(const std::string &pagename);
|
||||
ConfigVariableResolver &configVarsResolver, MapCache<TemplatePage> &pageCache);
|
||||
|
||||
TemplatePage getPage(const std::string &pagename);
|
||||
|
||||
std::string renderSearch(const std::vector<std::string> &results,
|
||||
std::function<std::string(std::string)> callback) const;
|
||||
|
Fai riferimento in un nuovo problema
Block a user