TemplatePage: Change 'content' to shared_ptr
This commit is contained in:
والد
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:
|
||||
|
بارگذاری…
مرجع در شماره جدید
Block a user