OLD | NEW |
---|---|
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #ifndef SkTDArray_DEFINED | 10 #ifndef SkTDArray_DEFINED |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
94 } | 94 } |
95 | 95 |
96 bool isEmpty() const { return fCount == 0; } | 96 bool isEmpty() const { return fCount == 0; } |
97 | 97 |
98 /** | 98 /** |
99 * Return the number of elements in the array | 99 * Return the number of elements in the array |
100 */ | 100 */ |
101 int count() const { return fCount; } | 101 int count() const { return fCount; } |
102 | 102 |
103 /** | 103 /** |
104 * Return the number of elements there is space for without growing. | |
reed1
2014/02/06 20:14:40
// This includes however many elements may already
iancottrell
2014/02/06 21:33:06
Done. Is this better?
reed1
2014/02/06 21:41:34
If I add 3 elements, and call reserve() and it ret
| |
105 */ | |
106 int reserved() const { return fReserve; } | |
107 | |
108 /** | |
104 * return the number of bytes in the array: count * sizeof(T) | 109 * return the number of bytes in the array: count * sizeof(T) |
105 */ | 110 */ |
106 size_t bytes() const { return fCount * sizeof(T); } | 111 size_t bytes() const { return fCount * sizeof(T); } |
107 | 112 |
108 T* begin() { return fArray; } | 113 T* begin() { return fArray; } |
109 const T* begin() const { return fArray; } | 114 const T* begin() const { return fArray; } |
110 T* end() { return fArray ? fArray + fCount : NULL; } | 115 T* end() { return fArray ? fArray + fCount : NULL; } |
111 const T* end() const { return fArray ? fArray + fCount : NULL; } | 116 const T* end() const { return fArray ? fArray + fCount : NULL; } |
112 | 117 |
113 T& operator[](int index) { | 118 T& operator[](int index) { |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
360 #ifdef SK_DEBUG | 365 #ifdef SK_DEBUG |
361 fData = (ArrayT*)fArray; | 366 fData = (ArrayT*)fArray; |
362 #endif | 367 #endif |
363 fReserve = size; | 368 fReserve = size; |
364 } | 369 } |
365 fCount += extra; | 370 fCount += extra; |
366 } | 371 } |
367 }; | 372 }; |
368 | 373 |
369 #endif | 374 #endif |
OLD | NEW |