48 virtual void ApplyFilter(std::string& contents,
const std::string& path) = 0;
68 virtual void ApplyFilter(std::string& contents,
const std::string& path)
override
71 auto pattern = std::regex(
"\"@include\\((.*)\\)\"", std::regex::ECMAScript);
72 while(regex_search(contents, matches, pattern))
74 for(
size_t i = 1; i < matches.size(); ++i)
76 auto content =
GetFileContents((path +
"/" + matches[i].str()).c_str());
77 auto rpattern = std::regex(
"\"@include\\(" +
79 "\\)\"", std::regex::ECMAScript);
80 contents = regex_replace(contents, rpattern, content);
Class for JSON loader include plugin.
virtual void ApplyFilter(std::string &contents, const std::string &path) override
Apply filter to string.
Abstract class for JSON loader plugins.
virtual void ApplyFilter(std::string &contents, const std::string &path)=0
Apply filter to string.
std::string GetFileContents(const std::string filename)
Read contents from a file.