OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005 Frerich Raabe <raabe@kde.org> | 2 * Copyright (C) 2005 Frerich Raabe <raabe@kde.org> |
3 * Copyright (C) 2006, 2009 Apple Inc. | 3 * Copyright (C) 2006, 2009 Apple Inc. |
4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * | 9 * |
10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 }; | 65 }; |
66 | 66 |
67 struct FunctionRec { | 67 struct FunctionRec { |
68 typedef Function *(*FactoryFn)(); | 68 typedef Function *(*FactoryFn)(); |
69 FactoryFn factoryFn; | 69 FactoryFn factoryFn; |
70 Interval args; | 70 Interval args; |
71 }; | 71 }; |
72 | 72 |
73 static HashMap<String, FunctionRec>* functionMap; | 73 static HashMap<String, FunctionRec>* functionMap; |
74 | 74 |
75 class FunLast FINAL : public Function { | 75 class FunLast final : public Function { |
76 virtual Value evaluate(EvaluationContext&) const OVERRIDE; | 76 virtual Value evaluate(EvaluationContext&) const override; |
77 virtual Value::Type resultType() const OVERRIDE { return Value::NumberValue;
} | 77 virtual Value::Type resultType() const override { return Value::NumberValue;
} |
78 public: | 78 public: |
79 FunLast() { setIsContextSizeSensitive(true); } | 79 FunLast() { setIsContextSizeSensitive(true); } |
80 }; | 80 }; |
81 | 81 |
82 class FunPosition FINAL : public Function { | 82 class FunPosition final : public Function { |
83 virtual Value evaluate(EvaluationContext&) const OVERRIDE; | 83 virtual Value evaluate(EvaluationContext&) const override; |
84 virtual Value::Type resultType() const OVERRIDE { return Value::NumberValue;
} | 84 virtual Value::Type resultType() const override { return Value::NumberValue;
} |
85 public: | 85 public: |
86 FunPosition() { setIsContextPositionSensitive(true); } | 86 FunPosition() { setIsContextPositionSensitive(true); } |
87 }; | 87 }; |
88 | 88 |
89 class FunCount FINAL : public Function { | 89 class FunCount final : public Function { |
90 virtual Value evaluate(EvaluationContext&) const OVERRIDE; | 90 virtual Value evaluate(EvaluationContext&) const override; |
91 virtual Value::Type resultType() const OVERRIDE { return Value::NumberValue;
} | 91 virtual Value::Type resultType() const override { return Value::NumberValue;
} |
92 }; | 92 }; |
93 | 93 |
94 class FunId FINAL : public Function { | 94 class FunId final : public Function { |
95 virtual Value evaluate(EvaluationContext&) const OVERRIDE; | 95 virtual Value evaluate(EvaluationContext&) const override; |
96 virtual Value::Type resultType() const OVERRIDE { return Value::NodeSetValue
; } | 96 virtual Value::Type resultType() const override { return Value::NodeSetValue
; } |
97 }; | 97 }; |
98 | 98 |
99 class FunLocalName FINAL : public Function { | 99 class FunLocalName final : public Function { |
100 virtual Value evaluate(EvaluationContext&) const OVERRIDE; | 100 virtual Value evaluate(EvaluationContext&) const override; |
101 virtual Value::Type resultType() const OVERRIDE { return Value::StringValue;
} | 101 virtual Value::Type resultType() const override { return Value::StringValue;
} |
102 public: | 102 public: |
103 FunLocalName() { setIsContextNodeSensitive(true); } // local-name() with no
arguments uses context node. | 103 FunLocalName() { setIsContextNodeSensitive(true); } // local-name() with no
arguments uses context node. |
104 }; | 104 }; |
105 | 105 |
106 class FunNamespaceURI FINAL : public Function { | 106 class FunNamespaceURI final : public Function { |
107 virtual Value evaluate(EvaluationContext&) const OVERRIDE; | 107 virtual Value evaluate(EvaluationContext&) const override; |
108 virtual Value::Type resultType() const OVERRIDE { return Value::StringValue;
} | 108 virtual Value::Type resultType() const override { return Value::StringValue;
} |
109 public: | 109 public: |
110 FunNamespaceURI() { setIsContextNodeSensitive(true); } // namespace-uri() wi
th no arguments uses context node. | 110 FunNamespaceURI() { setIsContextNodeSensitive(true); } // namespace-uri() wi
th no arguments uses context node. |
111 }; | 111 }; |
112 | 112 |
113 class FunName FINAL : public Function { | 113 class FunName final : public Function { |
114 virtual Value evaluate(EvaluationContext&) const OVERRIDE; | 114 virtual Value evaluate(EvaluationContext&) const override; |
115 virtual Value::Type resultType() const OVERRIDE { return Value::StringValue;
} | 115 virtual Value::Type resultType() const override { return Value::StringValue;
} |
116 public: | 116 public: |
117 FunName() { setIsContextNodeSensitive(true); } // name() with no arguments u
ses context node. | 117 FunName() { setIsContextNodeSensitive(true); } // name() with no arguments u
ses context node. |
118 }; | 118 }; |
119 | 119 |
120 class FunString FINAL : public Function { | 120 class FunString final : public Function { |
121 virtual Value evaluate(EvaluationContext&) const OVERRIDE; | 121 virtual Value evaluate(EvaluationContext&) const override; |
122 virtual Value::Type resultType() const OVERRIDE { return Value::StringValue;
} | 122 virtual Value::Type resultType() const override { return Value::StringValue;
} |
123 public: | 123 public: |
124 FunString() { setIsContextNodeSensitive(true); } // string() with no argumen
ts uses context node. | 124 FunString() { setIsContextNodeSensitive(true); } // string() with no argumen
ts uses context node. |
125 }; | 125 }; |
126 | 126 |
127 class FunConcat FINAL : public Function { | 127 class FunConcat final : public Function { |
128 virtual Value evaluate(EvaluationContext&) const OVERRIDE; | 128 virtual Value evaluate(EvaluationContext&) const override; |
129 virtual Value::Type resultType() const OVERRIDE { return Value::StringValue;
} | 129 virtual Value::Type resultType() const override { return Value::StringValue;
} |
130 }; | 130 }; |
131 | 131 |
132 class FunStartsWith FINAL : public Function { | 132 class FunStartsWith final : public Function { |
133 virtual Value evaluate(EvaluationContext&) const OVERRIDE; | 133 virtual Value evaluate(EvaluationContext&) const override; |
134 virtual Value::Type resultType() const OVERRIDE { return Value::BooleanValue
; } | 134 virtual Value::Type resultType() const override { return Value::BooleanValue
; } |
135 }; | 135 }; |
136 | 136 |
137 class FunContains FINAL : public Function { | 137 class FunContains final : public Function { |
138 virtual Value evaluate(EvaluationContext&) const OVERRIDE; | 138 virtual Value evaluate(EvaluationContext&) const override; |
139 virtual Value::Type resultType() const OVERRIDE { return Value::BooleanValue
; } | 139 virtual Value::Type resultType() const override { return Value::BooleanValue
; } |
140 }; | 140 }; |
141 | 141 |
142 class FunSubstringBefore FINAL : public Function { | 142 class FunSubstringBefore final : public Function { |
143 virtual Value evaluate(EvaluationContext&) const OVERRIDE; | 143 virtual Value evaluate(EvaluationContext&) const override; |
144 virtual Value::Type resultType() const OVERRIDE { return Value::StringValue;
} | 144 virtual Value::Type resultType() const override { return Value::StringValue;
} |
145 }; | 145 }; |
146 | 146 |
147 class FunSubstringAfter FINAL : public Function { | 147 class FunSubstringAfter final : public Function { |
148 virtual Value evaluate(EvaluationContext&) const OVERRIDE; | 148 virtual Value evaluate(EvaluationContext&) const override; |
149 virtual Value::Type resultType() const OVERRIDE { return Value::StringValue;
} | 149 virtual Value::Type resultType() const override { return Value::StringValue;
} |
150 }; | 150 }; |
151 | 151 |
152 class FunSubstring FINAL : public Function { | 152 class FunSubstring final : public Function { |
153 virtual Value evaluate(EvaluationContext&) const OVERRIDE; | 153 virtual Value evaluate(EvaluationContext&) const override; |
154 virtual Value::Type resultType() const OVERRIDE { return Value::StringValue;
} | 154 virtual Value::Type resultType() const override { return Value::StringValue;
} |
155 }; | 155 }; |
156 | 156 |
157 class FunStringLength FINAL : public Function { | 157 class FunStringLength final : public Function { |
158 virtual Value evaluate(EvaluationContext&) const OVERRIDE; | 158 virtual Value evaluate(EvaluationContext&) const override; |
159 virtual Value::Type resultType() const OVERRIDE { return Value::NumberValue;
} | 159 virtual Value::Type resultType() const override { return Value::NumberValue;
} |
160 public: | 160 public: |
161 FunStringLength() { setIsContextNodeSensitive(true); } // string-length() wi
th no arguments uses context node. | 161 FunStringLength() { setIsContextNodeSensitive(true); } // string-length() wi
th no arguments uses context node. |
162 }; | 162 }; |
163 | 163 |
164 class FunNormalizeSpace FINAL : public Function { | 164 class FunNormalizeSpace final : public Function { |
165 virtual Value evaluate(EvaluationContext&) const OVERRIDE; | 165 virtual Value evaluate(EvaluationContext&) const override; |
166 virtual Value::Type resultType() const OVERRIDE { return Value::StringValue;
} | 166 virtual Value::Type resultType() const override { return Value::StringValue;
} |
167 public: | 167 public: |
168 FunNormalizeSpace() { setIsContextNodeSensitive(true); } // normalize-space(
) with no arguments uses context node. | 168 FunNormalizeSpace() { setIsContextNodeSensitive(true); } // normalize-space(
) with no arguments uses context node. |
169 }; | 169 }; |
170 | 170 |
171 class FunTranslate FINAL : public Function { | 171 class FunTranslate final : public Function { |
172 virtual Value evaluate(EvaluationContext&) const OVERRIDE; | 172 virtual Value evaluate(EvaluationContext&) const override; |
173 virtual Value::Type resultType() const OVERRIDE { return Value::StringValue;
} | 173 virtual Value::Type resultType() const override { return Value::StringValue;
} |
174 }; | 174 }; |
175 | 175 |
176 class FunBoolean FINAL : public Function { | 176 class FunBoolean final : public Function { |
177 virtual Value evaluate(EvaluationContext&) const OVERRIDE; | 177 virtual Value evaluate(EvaluationContext&) const override; |
178 virtual Value::Type resultType() const OVERRIDE { return Value::BooleanValue
; } | 178 virtual Value::Type resultType() const override { return Value::BooleanValue
; } |
179 }; | 179 }; |
180 | 180 |
181 class FunNot FINAL : public Function { | 181 class FunNot final : public Function { |
182 virtual Value evaluate(EvaluationContext&) const OVERRIDE; | 182 virtual Value evaluate(EvaluationContext&) const override; |
183 virtual Value::Type resultType() const OVERRIDE { return Value::BooleanValue
; } | 183 virtual Value::Type resultType() const override { return Value::BooleanValue
; } |
184 }; | 184 }; |
185 | 185 |
186 class FunTrue FINAL : public Function { | 186 class FunTrue final : public Function { |
187 virtual Value evaluate(EvaluationContext&) const OVERRIDE; | 187 virtual Value evaluate(EvaluationContext&) const override; |
188 virtual Value::Type resultType() const OVERRIDE { return Value::BooleanValue
; } | 188 virtual Value::Type resultType() const override { return Value::BooleanValue
; } |
189 }; | 189 }; |
190 | 190 |
191 class FunFalse FINAL : public Function { | 191 class FunFalse final : public Function { |
192 virtual Value evaluate(EvaluationContext&) const OVERRIDE; | 192 virtual Value evaluate(EvaluationContext&) const override; |
193 virtual Value::Type resultType() const OVERRIDE { return Value::BooleanValue
; } | 193 virtual Value::Type resultType() const override { return Value::BooleanValue
; } |
194 }; | 194 }; |
195 | 195 |
196 class FunLang FINAL : public Function { | 196 class FunLang final : public Function { |
197 virtual Value evaluate(EvaluationContext&) const OVERRIDE; | 197 virtual Value evaluate(EvaluationContext&) const override; |
198 virtual Value::Type resultType() const OVERRIDE { return Value::BooleanValue
; } | 198 virtual Value::Type resultType() const override { return Value::BooleanValue
; } |
199 public: | 199 public: |
200 FunLang() { setIsContextNodeSensitive(true); } // lang() always works on con
text node. | 200 FunLang() { setIsContextNodeSensitive(true); } // lang() always works on con
text node. |
201 }; | 201 }; |
202 | 202 |
203 class FunNumber FINAL : public Function { | 203 class FunNumber final : public Function { |
204 virtual Value evaluate(EvaluationContext&) const OVERRIDE; | 204 virtual Value evaluate(EvaluationContext&) const override; |
205 virtual Value::Type resultType() const OVERRIDE { return Value::NumberValue;
} | 205 virtual Value::Type resultType() const override { return Value::NumberValue;
} |
206 public: | 206 public: |
207 FunNumber() { setIsContextNodeSensitive(true); } // number() with no argumen
ts uses context node. | 207 FunNumber() { setIsContextNodeSensitive(true); } // number() with no argumen
ts uses context node. |
208 }; | 208 }; |
209 | 209 |
210 class FunSum FINAL : public Function { | 210 class FunSum final : public Function { |
211 virtual Value evaluate(EvaluationContext&) const OVERRIDE; | 211 virtual Value evaluate(EvaluationContext&) const override; |
212 virtual Value::Type resultType() const OVERRIDE { return Value::NumberValue;
} | 212 virtual Value::Type resultType() const override { return Value::NumberValue;
} |
213 }; | 213 }; |
214 | 214 |
215 class FunFloor FINAL : public Function { | 215 class FunFloor final : public Function { |
216 virtual Value evaluate(EvaluationContext&) const OVERRIDE; | 216 virtual Value evaluate(EvaluationContext&) const override; |
217 virtual Value::Type resultType() const OVERRIDE { return Value::NumberValue;
} | 217 virtual Value::Type resultType() const override { return Value::NumberValue;
} |
218 }; | 218 }; |
219 | 219 |
220 class FunCeiling FINAL : public Function { | 220 class FunCeiling final : public Function { |
221 virtual Value evaluate(EvaluationContext&) const OVERRIDE; | 221 virtual Value evaluate(EvaluationContext&) const override; |
222 virtual Value::Type resultType() const OVERRIDE { return Value::NumberValue;
} | 222 virtual Value::Type resultType() const override { return Value::NumberValue;
} |
223 }; | 223 }; |
224 | 224 |
225 class FunRound FINAL : public Function { | 225 class FunRound final : public Function { |
226 virtual Value evaluate(EvaluationContext&) const OVERRIDE; | 226 virtual Value evaluate(EvaluationContext&) const override; |
227 virtual Value::Type resultType() const OVERRIDE { return Value::NumberValue;
} | 227 virtual Value::Type resultType() const override { return Value::NumberValue;
} |
228 public: | 228 public: |
229 static double round(double); | 229 static double round(double); |
230 }; | 230 }; |
231 | 231 |
232 DEFINE_FUNCTION_CREATOR(FunLast) | 232 DEFINE_FUNCTION_CREATOR(FunLast) |
233 DEFINE_FUNCTION_CREATOR(FunPosition) | 233 DEFINE_FUNCTION_CREATOR(FunPosition) |
234 DEFINE_FUNCTION_CREATOR(FunCount) | 234 DEFINE_FUNCTION_CREATOR(FunCount) |
235 DEFINE_FUNCTION_CREATOR(FunId) | 235 DEFINE_FUNCTION_CREATOR(FunId) |
236 DEFINE_FUNCTION_CREATOR(FunLocalName) | 236 DEFINE_FUNCTION_CREATOR(FunLocalName) |
237 DEFINE_FUNCTION_CREATOR(FunNamespaceURI) | 237 DEFINE_FUNCTION_CREATOR(FunNamespaceURI) |
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 return 0; | 743 return 0; |
744 | 744 |
745 Function* function = functionRec->factoryFn(); | 745 Function* function = functionRec->factoryFn(); |
746 function->setArguments(args); | 746 function->setArguments(args); |
747 function->setName(name); | 747 function->setName(name); |
748 return function; | 748 return function; |
749 } | 749 } |
750 | 750 |
751 } | 751 } |
752 } | 752 } |
OLD | NEW |