source:
webkit/trunk/JavaScriptCore/kjs/regexp.h@
37240
Last change on this file since 37240 was 36263, checked in by [email protected], 17 years ago | |
---|---|
2008-09-07 Cameron Zwarich <[email protected]>
|
|
|
|
File size: 2.5 KB |
Line | |
---|---|
1 | /* |
2 | * Copyright (C) 1999-2000 Harri Porten ([email protected]) |
3 | * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
4 | * |
5 | * This library is free software; you can redistribute it and/or |
6 | * modify it under the terms of the GNU Lesser General Public |
7 | * License as published by the Free Software Foundation; either |
8 | * version 2 of the License, or (at your option) any later version. |
9 | * |
10 | * This library is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | * Lesser General Public License for more details. |
14 | * |
15 | * You should have received a copy of the GNU Lesser General Public |
16 | * License along with this library; if not, write to the Free Software |
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
18 | * |
19 | */ |
20 | |
21 | #ifndef KJS_REGEXP_H |
22 | #define KJS_REGEXP_H |
23 | |
24 | #include "ustring.h" |
25 | #include "ExecState.h" |
26 | #include <wtf/Forward.h> |
27 | #include <wtf/RefCounted.h> |
28 | #include <wrec/WREC.h> |
29 | |
30 | struct JSRegExp; |
31 | |
32 | namespace JSC { |
33 | |
34 | class RegExp : public RefCounted<RegExp> { |
35 | public: |
36 | static PassRefPtr<RegExp> create(ExecState*, const UString& pattern); |
37 | static PassRefPtr<RegExp> create(ExecState*, const UString& pattern, const UString& flags); |
38 | ~RegExp(); |
39 | |
40 | bool global() const { return m_flagBits & Global; } |
41 | bool ignoreCase() const { return m_flagBits & IgnoreCase; } |
42 | bool multiline() const { return m_flagBits & Multiline; } |
43 | |
44 | const UString& pattern() const { return m_pattern; } |
45 | const UString& flags() const { return m_flags; } |
46 | |
47 | bool isValid() const { return !m_constructionError; } |
48 | const char* errorMessage() const { return m_constructionError; } |
49 | |
50 | int match(const UString&, int offset, OwnArrayPtr<int>* ovector = 0); |
51 | unsigned numSubpatterns() const { return m_numSubpatterns; } |
52 | |
53 | private: |
54 | RegExp(ExecState*, const UString& pattern); |
55 | RegExp(ExecState*, const UString& pattern, const UString& flags); |
56 | |
57 | void compile(); |
58 | |
59 | enum FlagBits { Global = 1, IgnoreCase = 2, Multiline = 4 }; |
60 | |
61 | UString m_pattern; // FIXME: Just decompile m_regExp instead of storing this. |
62 | UString m_flags; // FIXME: Just decompile m_regExp instead of storing this. |
63 | int m_flagBits; |
64 | JSRegExp* m_regExp; |
65 | const char* m_constructionError; |
66 | unsigned m_numSubpatterns; |
67 | |
68 | #if ENABLE(WREC) |
69 | WRECFunction m_wrecFunction; |
70 | #endif |
71 | }; |
72 | |
73 | } // namespace JSC |
74 | |
75 | #endif // KJS_REGEXP_H |
Note:
See TracBrowser
for help on using the repository browser.