OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 bool convert(ConversionContext&, const String&, String&) const; | 152 bool convert(ConversionContext&, const String&, String&) const; |
153 bool convert(ConversionContext&, const String&, ScriptValue&) const; | 153 bool convert(ConversionContext&, const String&, ScriptValue&) const; |
154 | 154 |
155 template<typename IntegralType> | 155 template<typename IntegralType> |
156 bool convert(ConversionContext&, const String&, IntegralType&) const; | 156 bool convert(ConversionContext&, const String&, IntegralType&) const; |
157 bool convert(ConversionContext&, const String&, MessagePortArray&) const; | 157 bool convert(ConversionContext&, const String&, MessagePortArray&) const; |
158 bool convert(ConversionContext&, const String&, HashSet<AtomicString>&) cons
t; | 158 bool convert(ConversionContext&, const String&, HashSet<AtomicString>&) cons
t; |
159 bool convert(ConversionContext&, const String&, Dictionary&) const; | 159 bool convert(ConversionContext&, const String&, Dictionary&) const; |
160 bool convert(ConversionContext&, const String&, Vector<String>&) const; | 160 bool convert(ConversionContext&, const String&, Vector<String>&) const; |
161 bool convert(ConversionContext&, const String&, ArrayValue&) const; | 161 bool convert(ConversionContext&, const String&, ArrayValue&) const; |
162 template<typename T> | 162 template<template <typename> class PointerType, typename T> |
163 bool convert(ConversionContext&, const String&, RefPtr<T>&) const; | 163 bool convert(ConversionContext&, const String&, PointerType<T>&) const; |
164 template<typename T> | |
165 bool convert(ConversionContext&, const String&, RawPtr<T>&) const; | |
166 | 164 |
167 template<typename StringType> | 165 template<typename StringType> |
168 bool getStringType(const String&, StringType&) const; | 166 bool getStringType(const String&, StringType&) const; |
169 | 167 |
170 bool getOwnPropertiesAsStringHashMap(HashMap<String, String>&) const; | 168 bool getOwnPropertiesAsStringHashMap(HashMap<String, String>&) const; |
171 bool getOwnPropertyNames(Vector<String>&) const; | 169 bool getOwnPropertyNames(Vector<String>&) const; |
172 | 170 |
173 bool getWithUndefinedOrNullCheck(const String&, String&) const; | 171 bool getWithUndefinedOrNullCheck(const String&, String&) const; |
174 | 172 |
175 bool hasProperty(const String&) const; | 173 bool hasProperty(const String&) const; |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 if (!getKey(key, v8Value)) | 295 if (!getKey(key, v8Value)) |
298 return true; | 296 return true; |
299 | 297 |
300 value = IntegralTypeTraits<T>::toIntegral(v8Value, NormalConversion, context
.exceptionState()); | 298 value = IntegralTypeTraits<T>::toIntegral(v8Value, NormalConversion, context
.exceptionState()); |
301 if (context.exceptionState().throwIfNeeded()) | 299 if (context.exceptionState().throwIfNeeded()) |
302 return false; | 300 return false; |
303 | 301 |
304 return true; | 302 return true; |
305 } | 303 } |
306 | 304 |
307 template<typename T> bool Dictionary::convert(ConversionContext& context, const
String& key, RefPtr<T>& value) const | 305 template<template <typename> class PointerType, typename T> bool Dictionary::con
vert(ConversionContext& context, const String& key, PointerType<T>& value) const |
308 { | 306 { |
309 ConversionContextScope scope(context); | 307 ConversionContextScope scope(context); |
310 | 308 |
311 if (!get(key, value)) | |
312 return true; | |
313 | |
314 if (value) | |
315 return true; | |
316 | |
317 v8::Local<v8::Value> v8Value; | |
318 getKey(key, v8Value); | |
319 if (context.isNullable() && WebCore::isUndefinedOrNull(v8Value)) | |
320 return true; | |
321 | |
322 context.throwTypeError(ExceptionMessages::incorrectPropertyType(key, "does n
ot have a " + context.typeName() + " type.")); | |
323 return false; | |
324 } | |
325 | |
326 template<typename T> bool Dictionary::convert(ConversionContext& context, const
String& key, RawPtr<T>& value) const | |
327 { | |
328 ConversionContextScope scope(context); | |
329 | |
330 if (!get(key, value)) | 309 if (!get(key, value)) |
331 return true; | 310 return true; |
332 | 311 |
333 if (value) | 312 if (value) |
334 return true; | 313 return true; |
335 | 314 |
336 v8::Local<v8::Value> v8Value; | 315 v8::Local<v8::Value> v8Value; |
337 getKey(key, v8Value); | 316 getKey(key, v8Value); |
338 if (context.isNullable() && WebCore::isUndefinedOrNull(v8Value)) | 317 if (context.isNullable() && WebCore::isUndefinedOrNull(v8Value)) |
339 return true; | 318 return true; |
340 | 319 |
341 context.throwTypeError(ExceptionMessages::incorrectPropertyType(key, "does n
ot have a " + context.typeName() + " type.")); | 320 context.throwTypeError(ExceptionMessages::incorrectPropertyType(key, "does n
ot have a " + context.typeName() + " type.")); |
342 return false; | 321 return false; |
343 } | 322 } |
344 | 323 |
345 } | 324 } |
346 | 325 |
347 #endif // Dictionary_h | 326 #endif // Dictionary_h |
OLD | NEW |