00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef GLOBPATTERN_H
00020 #define GLOBPATTERN_H
00021
00022 #include "pandabase.h"
00023 #include "filename.h"
00024 #include "vector_string.h"
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041 class EXPCL_PANDA GlobPattern {
00042 public:
00043 INLINE GlobPattern(const string &pattern = string());
00044 INLINE GlobPattern(const GlobPattern ©);
00045 INLINE void operator = (const GlobPattern ©);
00046
00047 INLINE void set_pattern(const string &pattern);
00048 INLINE const string &get_pattern() const;
00049
00050 INLINE bool matches(const string &candidate) const;
00051
00052 INLINE void output(ostream &out) const;
00053
00054 bool has_glob_characters() const;
00055 int match_files(vector_string &results, const Filename &cwd = Filename());
00056
00057 private:
00058 bool matches_substr(string::const_iterator pi,
00059 string::const_iterator pend,
00060 string::const_iterator ci,
00061 string::const_iterator cend) const;
00062
00063 bool matches_set(string::const_iterator &pi,
00064 string::const_iterator pend,
00065 char ch) const;
00066
00067 int r_match_files(const Filename &prefix, const string &suffix,
00068 vector_string &results, const Filename &cwd);
00069
00070 string _pattern;
00071 };
00072
00073 INLINE ostream &operator << (ostream &out, const GlobPattern &glob) {
00074 glob.output(out);
00075 return out;
00076 }
00077
00078
00079 #include "globPattern.I"
00080
00081 #endif