Changeset 27571 in webkit for trunk/JavaScriptCore/kjs/regexp.h
- Timestamp:
- Nov 7, 2007, 9:18:39 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/regexp.h
r27419 r27571 23 23 #define KJS_REGEXP_H 24 24 25 #include "ustring.h" 26 #include <pcre.h> 25 27 #include <sys/types.h> 26 27 #if !USE(POSIX_REGEX)28 #include <pcre.h>29 #else30 // POSIX regex - not so good.31 extern "C" { // bug with some libc5 distributions32 #include <regex.h>33 }34 #endif35 36 #include "ustring.h"37 28 #include <wtf/OwnArrayPtr.h> 38 29 … … 40 31 41 32 class RegExp : Noncopyable { 33 private: 34 enum { 35 Global = 1, 36 IgnoreCase = 2, 37 Multiline = 4 38 }; 39 42 40 public: 43 enum { None = 0, Global = 1, IgnoreCase = 2, Multiline = 4 }; 41 RegExp(const UString& pattern); 42 RegExp(const UString& pattern, const UString& flags); 43 ~RegExp(); 44 45 void ref() { ++m_refCount; } 46 void deref() { if (--m_refCount == 0) delete this; } 47 int refCount() { return m_refCount; } 44 48 45 RegExp(const UString& pattern, int flags = None); 46 ~RegExp(); 49 bool global() const { return m_flags & Global; } 50 bool ignoreCase() const { return m_flags & IgnoreCase; } 51 bool multiline() const { return m_flags & Multiline; } 52 const UString& pattern() const { return m_pattern; } 47 53 48 int flags() const { return m_flags; }49 54 bool isValid() const { return !m_constructionError; } 50 55 const char* errorMessage() const { return m_constructionError; } 51 56 52 57 int match(const UString&, int offset, OwnArrayPtr<int>* ovector = 0); 53 unsigned subPatterns() const { return m_numSubPatterns; }58 unsigned numSubpatterns() const { return m_numSubpatterns; } 54 59 55 60 private: 56 #if !USE(POSIX_REGEX) 57 JSRegExp* m_regex; 58 #else 59 regex_t m_regex; 60 #endif 61 void compile(); 62 63 int m_refCount; 64 65 // Data supplied by caller. 66 UString m_pattern; 61 67 int m_flags; 68 69 // Data supplied by PCRE. 70 JSRegExp* m_regExp; 62 71 char* m_constructionError; 63 unsigned m_numSub Patterns;72 unsigned m_numSubpatterns; 64 73 }; 65 74
Note:
See TracChangeset
for help on using the changeset viewer.