39 "<<placeholder" + PLACEHOLDERSEPARATOR;
46 : entityStr_(entityStr), replacers_() {}
63 const std::string& key,
const std::string& replacer,
bool append) {
71 "The placeholder \"" + key +
"\" is already filled. ");
73 replacers_.insert(std::pair<PlaceholderKey, Replacer>(key, replacer));
90 const std::string& key,
const Path& filePath,
bool append) {
91 std::string snippetFileName = filePath;
92 std::ifstream snippetfile(snippetFileName.c_str());
93 if (!snippetfile.is_open()) {
96 snippetFileName +
"\" for reading.");
99 (std::istreambuf_iterator<char>(snippetfile)),
100 std::istreambuf_iterator<char>());
114 const std::string& templateFile,
115 const std::string& dstFile) {
116 std::ifstream input(templateFile.c_str());
118 if (!input.is_open())
121 TCEString(
"Could not open ") + templateFile +
" for reading.");
123 std::ofstream output(dstFile.c_str(), std::ios::trunc);
125 if (!output.is_open())
128 TCEString(
"Could not open ") + dstFile +
" for writing.");
130 while (!input.eof()) {
132 input.getline(line_buf, 1024);
136 output << line << std::endl;
168 if (!target.empty()) {
171 while (i < target.size() && target.at(i) ==
' ') {
172 identation.append(
" ");
191 if (beginpos == std::string::npos) {
196 if (endpos == std::string::npos) {
217 if (placeholder.empty()) {
224 if (beginpos == std::string::npos || endpos == std::string::npos) {
231 assert(endpos >= beginpos);
249 if (placeholder.empty()) {
254 offset != std::string::npos;
255 offset = placeholder.find(
262 if (beginpos == std::string::npos || endpos == std::string::npos) {
265 assert(endpos >= beginpos);
267 defaultStr = placeholder.substr(