6 Pattern::Pattern(const string &pat)
8 string::size_type percent = pat.find('%');
9 if(percent==string::npos)
10 throw invalid_argument("No percent sign in pattern");
11 prefix = pat.substr(0, percent);
12 suffix = pat.substr(percent+1);
15 string Pattern::apply(const string &body) const
17 return prefix+body+suffix;
20 list<string> Pattern::apply_list(const list<Pattern> &patterns, const string &body)
23 for(list<Pattern>::const_iterator i=patterns.begin(); i!=patterns.end(); ++i)
24 result.push_back(i->apply(body));