cmatchexpression.h

00001 //==========================================================================
00002 //  CMATCHEXPRESSION.H - part of
00003 //                 OMNeT++/OMNEST
00004 //              Discrete System Simulation in C++
00005 //
00006 //  Author: Andras Varga
00007 //
00008 //==========================================================================
00009 
00010 /*--------------------------------------------------------------*
00011   Copyright (C) 2006-2008 OpenSim Ltd.
00012 
00013   This file is distributed WITHOUT ANY WARRANTY. See the file
00014   `license' for details on this and other legal matters.
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 
Generated on Tue Dec 2 11:16:27 2014 for OMNeT++ Simulation Library by  doxygen 1.6.3