| OLD | NEW | 
|---|
| (Empty) |  | 
|  | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 
|  | 2 // Use of this source code is governed by a BSD-style license that can be | 
|  | 3 // found in the LICENSE file. | 
|  | 4 | 
|  | 5 #ifndef PPAPI_CPP_DEV_VAR_ARRAY_DEV_H_ | 
|  | 6 #define PPAPI_CPP_DEV_VAR_ARRAY_DEV_H_ | 
|  | 7 | 
|  | 8 #include "ppapi/c/pp_bool.h" | 
|  | 9 #include "ppapi/c/pp_stdint.h" | 
|  | 10 #include "ppapi/cpp/var.h" | 
|  | 11 | 
|  | 12 /// @file | 
|  | 13 /// This file defines the API for interacting with array vars. | 
|  | 14 | 
|  | 15 namespace pp { | 
|  | 16 | 
|  | 17 class VarArray_Dev : public Var { | 
|  | 18  public: | 
|  | 19   /// Constructs a new array var. | 
|  | 20   VarArray_Dev(); | 
|  | 21 | 
|  | 22   /// Contructs a <code>VarArray_Dev</code> given a var for which is_array() is | 
|  | 23   /// true. This will refer to the same array var, but allow you to access | 
|  | 24   /// methods specific to arrays. | 
|  | 25   /// | 
|  | 26   /// @param[in] var An array var. | 
|  | 27   explicit VarArray_Dev(const Var& var); | 
|  | 28 | 
|  | 29   /// Copy constructor. | 
|  | 30   VarArray_Dev(const VarArray_Dev& other); | 
|  | 31 | 
|  | 32   virtual ~VarArray_Dev(); | 
|  | 33 | 
|  | 34   /// Assignment operator. | 
|  | 35   VarArray_Dev& operator=(const VarArray_Dev& other); | 
|  | 36 | 
|  | 37   /// The <code>Var</code> assignment operator is overridden here so that we can | 
|  | 38   /// check for assigning a non-array var to a <code>VarArray_Dev</code>. | 
|  | 39   /// | 
|  | 40   /// @param[in] other The array var to be assigned. | 
|  | 41   /// | 
|  | 42   /// @return The resulting <code>VarArray_Dev</code> (as a <code>Var</code>&). | 
|  | 43   virtual Var& operator=(const Var& other); | 
|  | 44 | 
|  | 45   /// Gets an element from the array. | 
|  | 46   /// | 
|  | 47   /// @param[in] index An index indicating which element to return. | 
|  | 48   /// | 
|  | 49   /// @return The element at the specified position. If <code>index</code> is | 
|  | 50   /// larger than or equal to the array length, an undefined var is returned. | 
|  | 51   Var Get(uint32_t index) const; | 
|  | 52 | 
|  | 53   /// Sets the value of an element in the array. | 
|  | 54   /// | 
|  | 55   /// @param[in] index An index indicating which element to modify. If | 
|  | 56   /// <code>index</code> is larger than or equal to the array length, the length | 
|  | 57   /// is updated to be <code>index</code> + 1. Any position in the array that | 
|  | 58   /// hasn't been set before is set to undefined, i.e., <code>PP_Var</code> of | 
|  | 59   /// type <code>PP_VARTYPE_UNDEFINED</code>. | 
|  | 60   /// @param[in] value The value to set. | 
|  | 61   /// | 
|  | 62   /// @return A <code>PP_Bool</code> indicating whether the operation succeeds. | 
|  | 63   PP_Bool Set(uint32_t index, const Var& value); | 
|  | 64 | 
|  | 65   /// Gets the array length. | 
|  | 66   /// | 
|  | 67   /// @return The array length. | 
|  | 68   uint32_t GetLength() const; | 
|  | 69 | 
|  | 70   /// Sets the array length. | 
|  | 71   /// | 
|  | 72   /// @param[in] length The new array length. If <code>length</code> is smaller | 
|  | 73   /// than its current value, the array is truncated to the new length; any | 
|  | 74   /// elements that no longer fit are removed. If <code>length</code> is larger | 
|  | 75   /// than its current value, undefined vars are appended to increase the array | 
|  | 76   /// to the specified length. | 
|  | 77   /// | 
|  | 78   /// @return A <code>PP_Bool</code> indicating whether the operation succeeds. | 
|  | 79   PP_Bool SetLength(uint32_t length); | 
|  | 80 }; | 
|  | 81 | 
|  | 82 }  // namespace pp | 
|  | 83 | 
|  | 84 #endif  // PPAPI_CPP_DEV_VAR_ARRAY_DEV_H_ | 
| OLD | NEW | 
|---|