cmatchexpression.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __CMATCHEXPRESSION_H__
00019 #define __CMATCHEXPRESSION_H__
00020
00021 #include <string>
00022 #include "simkerneldefs.h"
00023
00024 NAMESPACE_BEGIN
00025
00026 class MatchExpression;
00027
00028
00051 class SIM_API cMatchExpression
00052 {
00053 public:
00057 class SIM_API Matchable
00058 {
00059 public:
00064 virtual const char *getAsString() const = 0;
00065
00071 virtual const char *getAsString(const char *attribute) const = 0;
00072
00076 virtual ~Matchable() {}
00077 };
00078
00079 private:
00080 MatchExpression *impl;
00081
00082 public:
00086 cMatchExpression();
00087
00091 cMatchExpression(const char *pattern, bool dottedpath, bool fullstring, bool casesensitive);
00092
00096 ~cMatchExpression();
00097
00103 void setPattern(const char *pattern, bool dottedpath, bool fullstring, bool casesensitive);
00104
00109 bool matches(const Matchable *object);
00110 };
00111
00112
00116 class SIM_API cMatchableString : public cMatchExpression::Matchable
00117 {
00118 private:
00119 std::string str;
00120 public:
00121 cMatchableString(const char *s) {str = s;}
00122 virtual const char *getAsString() const {return str.c_str();}
00123 virtual const char *getAsString(const char *attribute) const {return NULL;}
00124 };
00125
00126 NAMESPACE_END
00127
00128
00129 #endif
00130
00131