TemplatePage: Change 'content' to shared_ptr
这个提交包含在:
父节点
92be470545
当前提交
c9dc3416d7
@ -27,7 +27,7 @@ TemplatePage::TemplatePage()
|
||||
|
||||
TemplatePage::TemplatePage(std::string content)
|
||||
{
|
||||
this->content = content;
|
||||
this->content = std::make_shared<std::string>(content);
|
||||
}
|
||||
|
||||
void TemplatePage::setVar(const std::string &key, std::string value)
|
||||
@ -40,5 +40,5 @@ std::string TemplatePage::render() const
|
||||
Varreplacer replacer("{qswiki:");
|
||||
replacer.addResolver("var",
|
||||
[&](std::string_view key) { return utils::getKeyOrEmpty(this->varsMap, std::string(key)); });
|
||||
return replacer.parse(this->content);
|
||||
return replacer.parse(*this->content);
|
||||
}
|
||||
|
@ -3,10 +3,11 @@
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
class TemplatePage
|
||||
{
|
||||
private:
|
||||
std::string content;
|
||||
std::shared_ptr<const std::string> content;
|
||||
std::map<std::string, std::string> varsMap;
|
||||
|
||||
public:
|
||||
|
正在加载...
在新工单中引用
屏蔽一个用户