SmartFoxServer 2X C++ API
StringMatch.h
1 // ===================================================================
2 //
3 // Description
4 // Contains the definition of StringMatch
5 //
6 // Revision history
7 // Date Description
8 // 30-Nov-2012 First version
9 //
10 // ===================================================================
11 #ifndef __StringMatch__
12 #define __StringMatch__
13 
14 #include "IMatcher.h"
15 #include "../../Util/Common.h"
16 
17 #include <boost/shared_ptr.hpp> // Boost Asio shared pointer
18 
19 #if defined(_MSC_VER)
20 #pragma warning(disable:4786) // STL library: disable warning 4786; this warning is generated due to a Microsoft bug
21 #endif
22 #include <string> // STL library: string object
23 using namespace std; // STL library: declare the STL namespace
24 
25 namespace Sfs2X {
26 namespace Entities {
27 namespace Match {
28 
33  class DLLImportExport StringMatch : public IMatcher
34  {
35  public:
36 
37  // -------------------------------------------------------------------
38  // Public methods
39  // -------------------------------------------------------------------
40  StringMatch(string symbol);
41  StringMatch(boost::shared_ptr<string> symbol);
42  virtual ~StringMatch();
43  boost::shared_ptr<string> Symbol();
44  long int Type();
45 
46  // -------------------------------------------------------------------
47  // Public members
48  // -------------------------------------------------------------------
49  static const long int TYPE_ID;
50 
54  static boost::shared_ptr<StringMatch> EQUALS;
55 
59  static boost::shared_ptr<StringMatch> NOT_EQUALS;
60 
64  static boost::shared_ptr<StringMatch> CONTAINS;
65 
69  static boost::shared_ptr<StringMatch> STARTS_WITH;
70 
74  static boost::shared_ptr<StringMatch> ENDS_WITH;
75 
76  protected:
77 
78  // -------------------------------------------------------------------
79  // Protected methods
80  // -------------------------------------------------------------------
81 
82  // -------------------------------------------------------------------
83  // Protected members
84  // -------------------------------------------------------------------
85 
86  private:
87 
88  // -------------------------------------------------------------------
89  // Private methods
90  // -------------------------------------------------------------------
91 
92  // -------------------------------------------------------------------
93  // Private members
94  // -------------------------------------------------------------------
95  boost::shared_ptr<string> symbol;
96  };
97 
98 } // namespace Match
99 } // namespace Entities
100 } // namespace Sfs2X
101 
102 #endif
Definition: IMatcher.h:31
static boost::shared_ptr< StringMatch > ENDS_WITH
Checks that Str1 end with characters contained in Str2
Definition: StringMatch.h:74
static boost::shared_ptr< StringMatch > EQUALS
Checks that Str1 == Str2
Definition: StringMatch.h:54
STL namespace.
static boost::shared_ptr< StringMatch > NOT_EQUALS
Checks that Str1 != Str2
Definition: StringMatch.h:59
static boost::shared_ptr< StringMatch > CONTAINS
Checks that Str1.indexOf(Str2) != -1
Definition: StringMatch.h:64
This matcher is used in MatchExpressions to check String conditions
Definition: StringMatch.h:33
Definition: SmartFox.cpp:24
static boost::shared_ptr< StringMatch > STARTS_WITH
Checks that Str1 starts with characters contained in Str2
Definition: StringMatch.h:69