|
1 // tregexoptions.inl |
|
2 // |
|
3 // Copyright (c) 2005 - 2006, Google Inc. |
|
4 // All rights reserved. |
|
5 // |
|
6 // Redistribution and use in source and binary forms, with or without |
|
7 // modification, are permitted provided that the following conditions are |
|
8 // met: |
|
9 // |
|
10 // * Redistributions of source code must retain the above copyright |
|
11 // notice, this list of conditions and the following disclaimer. |
|
12 // * Redistributions in binary form must reproduce the above |
|
13 // copyright notice, this list of conditions and the following disclaimer |
|
14 // in the documentation and/or other materials provided with the |
|
15 // distribution. |
|
16 // * Neither the name of Google Inc. nor the names of its |
|
17 // contributors may be used to endorse or promote products derived from |
|
18 // this software without specific prior written permission. |
|
19 // |
|
20 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
21 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
22 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
|
23 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
|
24 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
25 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
26 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
|
27 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
|
28 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|
29 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
|
30 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
31 // |
|
32 // Author: Sanjay Ghemawat |
|
33 // |
|
34 // Heavily refactored for Symbian OS by Accenture. |
|
35 |
|
36 #ifndef TREGEXOPTIONS_INL_ |
|
37 #define TREGEXOPTIONS_INL_ |
|
38 |
|
39 #define PCRE_SET_OR_CLEAR(b, o) \ |
|
40 if (b) iAllOptions |= (o); else iAllOptions &= ~(o); |
|
41 |
|
42 #define PCRE_IS_SET(o) \ |
|
43 (iAllOptions & o) == o |
|
44 |
|
45 inline TInt TRegExOptions::MatchLimit() const |
|
46 { |
|
47 return iMatchLimit; |
|
48 } |
|
49 |
|
50 inline TRegExOptions TRegExOptions::SetMatchLimit(TInt aLimit) |
|
51 { |
|
52 iMatchLimit = aLimit; |
|
53 return *this; |
|
54 } |
|
55 |
|
56 inline TInt TRegExOptions::MatchLimitRecursion() const |
|
57 { |
|
58 return iMatchLimitRecursion; |
|
59 } |
|
60 |
|
61 inline TRegExOptions TRegExOptions::SetMatchLimitRecursion(TInt aLimit) |
|
62 { |
|
63 iMatchLimitRecursion = aLimit; |
|
64 return *this; |
|
65 } |
|
66 |
|
67 inline TInt TRegExOptions::AllOptions() const |
|
68 { |
|
69 return iAllOptions; |
|
70 } |
|
71 |
|
72 inline TRegExOptions TRegExOptions::SetAllOptions(TInt aOptions) |
|
73 { |
|
74 iAllOptions = aOptions; |
|
75 return *this; |
|
76 } |
|
77 |
|
78 inline TBool TRegExOptions::Caseless() const |
|
79 { |
|
80 return PCRE_IS_SET(EPcreCaseless); |
|
81 } |
|
82 |
|
83 inline TRegExOptions TRegExOptions::SetCaseless(TBool aCaseLess) |
|
84 { |
|
85 PCRE_SET_OR_CLEAR(aCaseLess, EPcreCaseless); |
|
86 return *this; |
|
87 } |
|
88 |
|
89 inline TBool TRegExOptions::Multiline() const |
|
90 { |
|
91 return PCRE_IS_SET(EPcreMultiline); |
|
92 } |
|
93 |
|
94 inline TRegExOptions TRegExOptions::SetMultiline(TBool aMultiline) |
|
95 { |
|
96 PCRE_SET_OR_CLEAR(aMultiline, EPcreMultiline); |
|
97 return *this; |
|
98 } |
|
99 |
|
100 inline TBool TRegExOptions::DotAll() const |
|
101 { |
|
102 return PCRE_IS_SET(EPcreDotAll); |
|
103 } |
|
104 |
|
105 inline TRegExOptions TRegExOptions::SetDotAll(TBool aDotAll) |
|
106 { |
|
107 PCRE_SET_OR_CLEAR(aDotAll, EPcreDotAll); |
|
108 return *this; |
|
109 } |
|
110 |
|
111 inline TBool TRegExOptions::Extended() const |
|
112 { |
|
113 return PCRE_IS_SET(EPcreExtended); |
|
114 } |
|
115 |
|
116 inline TRegExOptions TRegExOptions::SetExtended(TBool aExtended) |
|
117 { |
|
118 PCRE_SET_OR_CLEAR(aExtended, EPcreExtended); |
|
119 return *this; |
|
120 } |
|
121 |
|
122 inline TBool TRegExOptions::DollarEndOnly() const |
|
123 { |
|
124 return PCRE_IS_SET(EPcreDollarEndOnly); |
|
125 } |
|
126 |
|
127 inline TRegExOptions TRegExOptions::SetDollarEndOnly(TBool aDollarEndOnly) |
|
128 { |
|
129 PCRE_SET_OR_CLEAR(aDollarEndOnly, EPcreDollarEndOnly); |
|
130 return *this; |
|
131 } |
|
132 |
|
133 inline TBool TRegExOptions::Extra() const |
|
134 { |
|
135 return PCRE_IS_SET(EPcreExtra); |
|
136 } |
|
137 |
|
138 inline TRegExOptions TRegExOptions::SetExtra(TBool aSetExtra) |
|
139 { |
|
140 PCRE_SET_OR_CLEAR(aSetExtra, EPcreExtra); |
|
141 return *this; |
|
142 } |
|
143 |
|
144 inline TBool TRegExOptions::Ungreedy() const |
|
145 { |
|
146 return PCRE_IS_SET(EPcreUngreedy); |
|
147 } |
|
148 |
|
149 inline TRegExOptions TRegExOptions::SetUngreedy(TBool aUngreedy) |
|
150 { |
|
151 PCRE_SET_OR_CLEAR(aUngreedy, EPcreUngreedy); |
|
152 return *this; |
|
153 } |
|
154 |
|
155 inline TBool TRegExOptions::Utf8() const |
|
156 { |
|
157 return PCRE_IS_SET(EPcreUtf8); |
|
158 } |
|
159 |
|
160 inline TRegExOptions TRegExOptions::SetUtf8(TBool aUtf8) |
|
161 { |
|
162 PCRE_SET_OR_CLEAR(aUtf8, EPcreUtf8); |
|
163 return *this; |
|
164 } |
|
165 |
|
166 inline TBool TRegExOptions::NoAutoCapture() const |
|
167 { |
|
168 return PCRE_IS_SET(EPcreNoAutoCapture); |
|
169 } |
|
170 |
|
171 inline TRegExOptions TRegExOptions::SetNoAutoCapture(TBool aAutoCapture) |
|
172 { |
|
173 PCRE_SET_OR_CLEAR(aAutoCapture, EPcreNoAutoCapture); |
|
174 return *this; |
|
175 } |
|
176 |
|
177 #undef PCRE_IS_SET |
|
178 #undef PCRE_SET_OR_CLEAR |
|
179 #endif /* TREGEXOPTIONS_INL_ */ |