]> git.tdb.fi Git - builder.git/blob - source/lib/pattern.h
Add visibility decorations to the library and plugins
[builder.git] / source / lib / pattern.h
1 #ifndef PATTERN_H_
2 #define PATTERN_H_
3
4 #include <string>
5 #include <vector>
6 #include "libbuilder_api.h"
7
8 /**
9 Stores a filename pattern.  A pattern consists of a prefix and a suffix, and
10 can be applied to a body to form a complete filename.  Either or both of the
11 prefix and suffix may be empty.
12 */
13 class LIBBUILDER_API Pattern
14 {
15 private:
16         std::string prefix;
17         std::string suffix;
18
19 public:
20         /** Constructs a pattern from a single string.  The string must have exactly
21         one percent sign (%) to separate the prefix and suffix. */
22         Pattern(const std::string &);
23
24         const std::string &get_prefix() const { return prefix; }
25         const std::string &get_suffix() const { return suffix; }
26
27         /** Applies the pattern to a body string. */
28         std::string apply(const std::string &) const;
29
30         /** Applies a list of patterns to the same body. */
31         static std::vector<std::string> apply_list(const std::vector<Pattern> &, const std::string &);
32 };
33
34 #endif