Flutter Engine
The Flutter Engine
Public Member Functions | Friends | List of all members
SkTDArray< T > Class Template Reference

#include <SkTDArray.h>

Public Member Functions

 SkTDArray ()
 
 SkTDArray (const T src[], int count)
 
 SkTDArray (const std::initializer_list< T > &list)
 
 SkTDArray (const SkTDArray< T > &src)
 
SkTDArray< T > & operator= (const SkTDArray< T > &src)
 
 SkTDArray (SkTDArray< T > &&src)
 
SkTDArray< T > & operator= (SkTDArray< T > &&src)
 
void swap (SkTDArray< T > &that)
 
bool empty () const
 
int size () const
 
int capacity () const
 
size_t size_bytes () const
 
Tdata ()
 
const Tdata () const
 
Tbegin ()
 
const Tbegin () const
 
Tend ()
 
const Tend () const
 
Toperator[] (int index)
 
const Toperator[] (int index) const
 
const Tback () const
 
Tback ()
 
void reset ()
 
void clear ()
 
void resize (int count)
 
void reserve (int n)
 
Tappend ()
 
Tappend (int count)
 
Tappend (int count, const T *src)
 
Tinsert (int index)
 
Tinsert (int index, int count, const T *src=nullptr)
 
void remove (int index, int count=1)
 
void removeShuffle (int index)
 
void push_back (const T &v)
 
void pop_back ()
 
void shrink_to_fit ()
 

Friends

bool operator== (const SkTDArray< T > &a, const SkTDArray< T > &b)
 
bool operator!= (const SkTDArray< T > &a, const SkTDArray< T > &b)
 

Detailed Description

template<typename T>
class SkTDArray< T >

Definition at line 105 of file SkTDArray.h.

Constructor & Destructor Documentation

◆ SkTDArray() [1/5]

template<typename T >
SkTDArray< T >::SkTDArray ( )
inline

Definition at line 107 of file SkTDArray.h.

107: fStorage{sizeof(T)} {}
#define T
Definition: precompiler.cc:65

◆ SkTDArray() [2/5]

template<typename T >
SkTDArray< T >::SkTDArray ( const T  src[],
int  count 
)
inline

Definition at line 108 of file SkTDArray.h.

108: fStorage{src, count, sizeof(T)} { }
int count
Definition: FontMgrTest.cpp:50

◆ SkTDArray() [3/5]

template<typename T >
SkTDArray< T >::SkTDArray ( const std::initializer_list< T > &  list)
inline

Definition at line 109 of file SkTDArray.h.

109: SkTDArray(list.begin(), list.size()) {}

◆ SkTDArray() [4/5]

template<typename T >
SkTDArray< T >::SkTDArray ( const SkTDArray< T > &  src)
inline

Definition at line 112 of file SkTDArray.h.

112: SkTDArray(src.data(), src.size()) {}

◆ SkTDArray() [5/5]

template<typename T >
SkTDArray< T >::SkTDArray ( SkTDArray< T > &&  src)
inline

Definition at line 119 of file SkTDArray.h.

119: fStorage{std::move(src.fStorage)} {}

Member Function Documentation

◆ append() [1/3]

template<typename T >
T * SkTDArray< T >::append ( )
inline

Definition at line 191 of file SkTDArray.h.

191 {
192 fStorage.append();
193 return this->end() - 1;
194 }
T * end()
Definition: SkTDArray.h:152
void append()
Definition: SkTDArray.cpp:167

◆ append() [2/3]

template<typename T >
T * SkTDArray< T >::append ( int  count)
inline

Definition at line 195 of file SkTDArray.h.

195 {
196 fStorage.append(count);
197 return this->end() - count;
198 }

◆ append() [3/3]

template<typename T >
T * SkTDArray< T >::append ( int  count,
const T src 
)
inline

Definition at line 199 of file SkTDArray.h.

199 {
200 return static_cast<T*>(fStorage.append(src, count));
201 }

◆ back() [1/2]

template<typename T >
T & SkTDArray< T >::back ( )
inline

Definition at line 166 of file SkTDArray.h.

166 {
168 return this->data()[this->size() - 1];
169 }
SK_API void sk_collection_not_empty(bool empty)
Definition: SkAssert.h:175
int size() const
Definition: SkTDArray.h:138
bool empty() const
Definition: SkTDArray.h:135
T * data()
Definition: SkTDArray.h:148

◆ back() [2/2]

template<typename T >
const T & SkTDArray< T >::back ( ) const
inline

Definition at line 162 of file SkTDArray.h.

162 {
164 return this->data()[this->size() - 1];
165 }

◆ begin() [1/2]

template<typename T >
T * SkTDArray< T >::begin ( )
inline

Definition at line 150 of file SkTDArray.h.

150{ return this->data(); }

◆ begin() [2/2]

template<typename T >
const T * SkTDArray< T >::begin ( ) const
inline

Definition at line 151 of file SkTDArray.h.

151{ return this->data(); }

◆ capacity()

template<typename T >
int SkTDArray< T >::capacity ( ) const
inline

Definition at line 143 of file SkTDArray.h.

143{ return fStorage.capacity(); }
int capacity() const
Definition: SkTDArray.h:46

◆ clear()

template<typename T >
void SkTDArray< T >::clear ( )
inline

Definition at line 175 of file SkTDArray.h.

175 {
176 fStorage.clear();
177 }
void clear()
Definition: SkTDArray.h:40

◆ data() [1/2]

template<typename T >
T * SkTDArray< T >::data ( )
inline

Definition at line 148 of file SkTDArray.h.

148{ return static_cast<T*>(fStorage.data()); }
void * data()
Definition: SkTDArray.h:50

◆ data() [2/2]

template<typename T >
const T * SkTDArray< T >::data ( ) const
inline

Definition at line 149 of file SkTDArray.h.

149{ return static_cast<const T*>(fStorage.data()); }

◆ empty()

template<typename T >
bool SkTDArray< T >::empty ( ) const
inline

Definition at line 135 of file SkTDArray.h.

135{ return fStorage.empty(); }
bool empty() const
Definition: SkTDArray.h:39

◆ end() [1/2]

template<typename T >
T * SkTDArray< T >::end ( )
inline

Definition at line 152 of file SkTDArray.h.

152{ return this->data() + this->size(); }

◆ end() [2/2]

template<typename T >
const T * SkTDArray< T >::end ( ) const
inline

Definition at line 153 of file SkTDArray.h.

153{ return this->data() + this->size(); }

◆ insert() [1/2]

template<typename T >
T * SkTDArray< T >::insert ( int  index)
inline

Definition at line 203 of file SkTDArray.h.

203 {
204 return static_cast<T*>(fStorage.insert(index));
205 }
void * insert(int index)
Definition: SkTDArray.cpp:189

◆ insert() [2/2]

template<typename T >
T * SkTDArray< T >::insert ( int  index,
int  count,
const T src = nullptr 
)
inline

Definition at line 206 of file SkTDArray.h.

206 {
207 return static_cast<T*>(fStorage.insert(index, count, src));
208 }

◆ operator=() [1/2]

template<typename T >
SkTDArray< T > & SkTDArray< T >::operator= ( const SkTDArray< T > &  src)
inline

Definition at line 113 of file SkTDArray.h.

113 {
114 fStorage = src.fStorage;
115 return *this;
116 }

◆ operator=() [2/2]

template<typename T >
SkTDArray< T > & SkTDArray< T >::operator= ( SkTDArray< T > &&  src)
inline

Definition at line 120 of file SkTDArray.h.

120 {
121 fStorage = std::move(src.fStorage);
122 return *this;
123 }

◆ operator[]() [1/2]

template<typename T >
T & SkTDArray< T >::operator[] ( int  index)
inline

Definition at line 155 of file SkTDArray.h.

155 {
156 return this->data()[sk_collection_check_bounds(index, this->size())];
157 }
SK_API T sk_collection_check_bounds(T i, T size)
Definition: SkAssert.h:143

◆ operator[]() [2/2]

template<typename T >
const T & SkTDArray< T >::operator[] ( int  index) const
inline

Definition at line 158 of file SkTDArray.h.

158 {
159 return this->data()[sk_collection_check_bounds(index, this->size())];
160 }

◆ pop_back()

template<typename T >
void SkTDArray< T >::pop_back ( )
inline

Definition at line 223 of file SkTDArray.h.

223{ fStorage.pop_back(); }
void pop_back()
Definition: SkTDArray.h:68

◆ push_back()

template<typename T >
void SkTDArray< T >::push_back ( const T v)
inline

Definition at line 219 of file SkTDArray.h.

219 {
220 this->append();
221 this->back() = v;
222 }
const T & back() const
Definition: SkTDArray.h:162
T * append()
Definition: SkTDArray.h:191

◆ remove()

template<typename T >
void SkTDArray< T >::remove ( int  index,
int  count = 1 
)
inline

Definition at line 210 of file SkTDArray.h.

210 {
211 fStorage.erase(index, count);
212 }
void erase(int index, int count)
Definition: SkTDArray.cpp:141

◆ removeShuffle()

template<typename T >
void SkTDArray< T >::removeShuffle ( int  index)
inline

Definition at line 214 of file SkTDArray.h.

214 {
215 fStorage.removeShuffle(index);
216 }
void removeShuffle(int index)
Definition: SkTDArray.cpp:154

◆ reserve()

template<typename T >
void SkTDArray< T >::reserve ( int  n)
inline

Definition at line 187 of file SkTDArray.h.

187 {
188 fStorage.reserve(n);
189 }
void reserve(int newCapacity)
Definition: SkTDArray.cpp:92

◆ reset()

template<typename T >
void SkTDArray< T >::reset ( )
inline

Definition at line 171 of file SkTDArray.h.

171 {
172 fStorage.reset();
173 }
void reset()
Definition: SkTDArray.cpp:70

◆ resize()

template<typename T >
void SkTDArray< T >::resize ( int  count)
inline

Definition at line 183 of file SkTDArray.h.

183 {
184 fStorage.resize(count);
185 }
void resize(int newSize)
Definition: SkTDArray.cpp:84

◆ shrink_to_fit()

template<typename T >
void SkTDArray< T >::shrink_to_fit ( )
inline

Definition at line 225 of file SkTDArray.h.

225 {
226 fStorage.shrink_to_fit();
227 }
void shrink_to_fit()
Definition: SkTDArray.cpp:127

◆ size()

template<typename T >
int SkTDArray< T >::size ( ) const
inline

Definition at line 138 of file SkTDArray.h.

138{ return fStorage.size(); }
int size() const
Definition: SkTDArray.h:41

◆ size_bytes()

template<typename T >
size_t SkTDArray< T >::size_bytes ( ) const
inline

Definition at line 146 of file SkTDArray.h.

146{ return fStorage.size_bytes(); }
size_t size_bytes() const
Definition: SkTDArray.h:43

◆ swap()

template<typename T >
void SkTDArray< T >::swap ( SkTDArray< T > &  that)
inline

Definition at line 130 of file SkTDArray.h.

130 {
131 using std::swap;
132 swap(fStorage, that.fStorage);
133 }
static void swap(SkTDStorage &a, SkTDStorage &b)
Definition: SkTDArray.h:98
void swap(SkTDArray< T > &that)
Definition: SkTDArray.h:130

Friends And Related Function Documentation

◆ operator!=

template<typename T >
bool operator!= ( const SkTDArray< T > &  a,
const SkTDArray< T > &  b 
)
friend

Definition at line 128 of file SkTDArray.h.

128{ return !(a == b); }
static bool b
struct MyStruct a[10]

◆ operator==

template<typename T >
bool operator== ( const SkTDArray< T > &  a,
const SkTDArray< T > &  b 
)
friend

Definition at line 125 of file SkTDArray.h.

125 {
126 return a.fStorage == b.fStorage;
127 }

The documentation for this class was generated from the following file: