| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright (C) 2014 Google Inc. All rights reserved. | |
| 3 * | |
| 4 * Redistribution and use in source and binary forms, with or without | |
| 5 * modification, are permitted provided that the following conditions | |
| 6 * are met: | |
| 7 * | |
| 8 * 1. Redistributions of source code must retain the above copyright | |
| 9 * notice, this list of conditions and the following disclaimer. | |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | |
| 11 * notice, this list of conditions and the following disclaimer in the | |
| 12 * documentation and/or other materials provided with the distribution. | |
| 13 * | |
| 14 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY | |
| 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
| 16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
| 17 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY | |
| 18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
| 19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
| 20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |
| 21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
| 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 24 */ | |
| 25 | |
| 26 #ifndef ArrayValue_h | |
| 27 #define ArrayValue_h | |
| 28 | |
| 29 #include "bindings/common/AbstractArrayValue.h" | |
| 30 #include "wtf/PassRefPtr.h" | |
| 31 #include "wtf/RefPtr.h" | |
| 32 | |
| 33 namespace blink { | |
| 34 | |
| 35 class Dictionary; | |
| 36 | |
| 37 class ArrayValue { | |
| 38 public: | |
| 39 ArrayValue() : m_arrayValueImpl() { } | |
| 40 explicit ArrayValue(PassRefPtr<AbstractArrayValue> impl) : m_arrayValueImpl(
impl) { } | |
| 41 | |
| 42 bool isUndefinedOrNull() const | |
| 43 { | |
| 44 return !m_arrayValueImpl || m_arrayValueImpl->isUndefinedOrNull(); | |
| 45 } | |
| 46 | |
| 47 bool length(size_t& length) const | |
| 48 { | |
| 49 if (!m_arrayValueImpl) | |
| 50 return false; | |
| 51 return m_arrayValueImpl->length(length); | |
| 52 } | |
| 53 | |
| 54 bool get(size_t index, Dictionary& value) const | |
| 55 { | |
| 56 if (!m_arrayValueImpl) | |
| 57 return false; | |
| 58 return m_arrayValueImpl->get(index, value); | |
| 59 } | |
| 60 | |
| 61 private: | |
| 62 RefPtr<AbstractArrayValue> m_arrayValueImpl; | |
| 63 | |
| 64 // Disallow heap allocation. Only valid to use this object within a handle s
cope. | |
| 65 static void* operator new(size_t); | |
| 66 static void* operator new[](size_t); | |
| 67 static void operator delete(void *); | |
| 68 }; | |
| 69 | |
| 70 } | |
| 71 | |
| 72 #endif // ArrayValue_h | |
| OLD | NEW |