35 lines
709 B
C++
35 lines
709 B
C++
#pragma once
|
|
|
|
#include <string>
|
|
#include <unordered_map>
|
|
|
|
class TemplateSubstitutionContext
|
|
{
|
|
public:
|
|
|
|
void addSubstitution(const std::string& key, const std::string& value)
|
|
{
|
|
mSubstitutions[key] = value;
|
|
}
|
|
|
|
bool hasSubstitution(const std::string& key) const
|
|
{
|
|
return mSubstitutions.find(key) != mSubstitutions.end();
|
|
}
|
|
|
|
std::string getSubstitution(const std::string& key) const
|
|
{
|
|
auto iter = mSubstitutions.find(key);
|
|
if(iter != mSubstitutions.end())
|
|
{
|
|
return iter->second;
|
|
}
|
|
else
|
|
{
|
|
return {};
|
|
}
|
|
}
|
|
|
|
private:
|
|
std::unordered_map<std::string, std::string> mSubstitutions;
|
|
};
|