2
0

ppFilenamePattern.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // Filename: ppFilenamePattern.h
  2. // Created by: drose (25Sep00)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. #ifndef PPFILENAMEPATTERN_H
  6. #define PPFILENAMEPATTERN_H
  7. #include "ppremake.h"
  8. ///////////////////////////////////////////////////////////////////
  9. // Class : PPFilenamePattern
  10. // Description : This is a string that represents a filename, or a
  11. // family of filenames, using the make convention that a
  12. // wildcard sign (PATTERN_WILDCARD, typically '%') in
  13. // the filename represents any sequence of characters.
  14. ////////////////////////////////////////////////////////////////////
  15. class PPFilenamePattern {
  16. public:
  17. PPFilenamePattern(const string &pattern);
  18. PPFilenamePattern(const PPFilenamePattern &copy);
  19. void operator = (const PPFilenamePattern &copy);
  20. bool has_wildcard() const;
  21. string get_pattern() const;
  22. const string &get_prefix() const;
  23. const string &get_suffix() const;
  24. bool matches(const string &filename) const;
  25. string extract_body(const string &filename) const;
  26. string transform(const string &filename,
  27. const PPFilenamePattern &transform_from) const;
  28. private:
  29. bool _has_wildcard;
  30. string _prefix;
  31. string _suffix;
  32. };
  33. inline ostream &
  34. operator << (ostream &out, const PPFilenamePattern &pattern) {
  35. return out << pattern.get_pattern();
  36. }
  37. #endif