X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fpattern.h;h=5965efaed69886ea489679f93b0e0d13774eef4d;hb=407b96515a5246384847d1835a2d69704e941ea1;hp=de8e7b2de962b8a1b1bb33ea887000e42b72202c;hpb=40177b0cfc0d4e67f971941f632e4f1f7e7c3f88;p=builder.git diff --git a/source/pattern.h b/source/pattern.h index de8e7b2..5965efa 100644 --- a/source/pattern.h +++ b/source/pattern.h @@ -1,8 +1,14 @@ #ifndef PATTERN_H_ #define PATTERN_H_ +#include #include +/** +Stores a filename pattern. A pattern consists of a prefix and a suffix, and +can be applied to a body to form a complete filename. Either or both of the +prefix and suffix may be empty. +*/ class Pattern { private: @@ -10,9 +16,15 @@ private: std::string suffix; public: + /** Constructs a pattern from a single string. The string must have exactly + one percent sign (%) to separate the prefix and suffix. */ Pattern(const std::string &); + /** Applies the pattern to a body string. */ std::string apply(const std::string &) const; + + /** Applies a list of patterns to the same body. */ + static std::list apply_list(const std::list &, const std::string &); }; #endif